fix(TicketSaleMoreActions): hotFix isClaimable
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Alex Moreno 2024-12-09 07:56:50 +01:00
parent ebf5b74660
commit 88863a215a
2 changed files with 7 additions and 5 deletions

View File

@ -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;
}

View File

@ -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;
});