forked from verdnatura/salix-front
Merge pull request 'fix(TicketSaleMoreActions): hotFix isClaimable' (!1055) from hotFix_ticketSale_isClaimable into master
Reviewed-on: verdnatura/salix-front#1055 Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
This commit is contained in:
commit
8a1812dbb0
|
@ -20,7 +20,7 @@ export function useRole() {
|
||||||
|
|
||||||
function hasAny(roles) {
|
function hasAny(roles) {
|
||||||
const roleStore = state.getRoles();
|
const roleStore = state.getRoles();
|
||||||
|
if (typeof roles === 'string') roles = [roles];
|
||||||
for (const role of roles) {
|
for (const role of roles) {
|
||||||
if (roleStore.value.indexOf(role) !== -1) return true;
|
if (roleStore.value.indexOf(role) !== -1) return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { toDateFormat } from 'src/filters/date';
|
import { toDateFormat } from 'src/filters/date';
|
||||||
import { useRole } from 'src/composables/useRole';
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
|
||||||
const emit = defineEmits(['updateDiscounts', 'getMana', 'refreshTable']);
|
const emit = defineEmits(['updateDiscounts', 'getMana', 'refreshTable']);
|
||||||
|
@ -48,7 +48,7 @@ const { push } = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { dialog } = useQuasar();
|
const { dialog } = useQuasar();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const role = useRole();
|
const acl = useAcl();
|
||||||
const btnDropdownRef = ref(null);
|
const btnDropdownRef = ref(null);
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
|
||||||
|
@ -58,8 +58,10 @@ const isClaimable = computed(() => {
|
||||||
if (ticket.value) {
|
if (ticket.value) {
|
||||||
const landedPlusWeek = new Date(ticket.value.landed);
|
const landedPlusWeek = new Date(ticket.value.landed);
|
||||||
landedPlusWeek.setDate(landedPlusWeek.getDate() + 7);
|
landedPlusWeek.setDate(landedPlusWeek.getDate() + 7);
|
||||||
const hasClaimManagerRole = role.hasAny('claimManager');
|
const createAfterDeadline = acl.hasAny([
|
||||||
return landedPlusWeek >= Date.vnNew() || hasClaimManagerRole;
|
{ model: 'Claim', props: 'createAfterDeadline', accessType: 'WRITE' },
|
||||||
|
]);
|
||||||
|
return landedPlusWeek >= Date.vnNew() || createAfterDeadline;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue