diff --git a/src/composables/useRole.js b/src/composables/useRole.js index d1a6d6ef3..3ec65dd0a 100644 --- a/src/composables/useRole.js +++ b/src/composables/useRole.js @@ -20,7 +20,7 @@ export function useRole() { function hasAny(roles) { const roleStore = state.getRoles(); - + if (typeof roles === 'string') roles = [roles]; for (const role of roles) { if (roleStore.value.indexOf(role) !== -1) return true; } diff --git a/src/pages/Ticket/Card/TicketSaleMoreActions.vue b/src/pages/Ticket/Card/TicketSaleMoreActions.vue index 87e1d2a48..2dafd8512 100644 --- a/src/pages/Ticket/Card/TicketSaleMoreActions.vue +++ b/src/pages/Ticket/Card/TicketSaleMoreActions.vue @@ -11,7 +11,7 @@ import VnInput from 'src/components/common/VnInput.vue'; import useNotify from 'src/composables/useNotify.js'; import axios from 'axios'; import { toDateFormat } from 'src/filters/date'; -import { useRole } from 'src/composables/useRole'; +import { useAcl } from 'src/composables/useAcl'; import { useVnConfirm } from 'composables/useVnConfirm'; const emit = defineEmits(['updateDiscounts', 'getMana', 'refreshTable']); @@ -48,7 +48,7 @@ const { push } = useRouter(); const { t } = useI18n(); const { dialog } = useQuasar(); const { notify } = useNotify(); -const role = useRole(); +const acl = useAcl(); const btnDropdownRef = ref(null); const { openConfirmationModal } = useVnConfirm(); @@ -58,8 +58,10 @@ const isClaimable = computed(() => { if (ticket.value) { const landedPlusWeek = new Date(ticket.value.landed); landedPlusWeek.setDate(landedPlusWeek.getDate() + 7); - const hasClaimManagerRole = role.hasAny('claimManager'); - return landedPlusWeek >= Date.vnNew() || hasClaimManagerRole; + const createAfterDeadline = acl.hasAny([ + { model: 'Claim', props: 'createAfterDeadline', accessType: 'WRITE' }, + ]); + return landedPlusWeek >= Date.vnNew() || createAfterDeadline; } return false; });