From 0d31adaa4b1cdd85ca24825969d3cc25a44884bc Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 4 Oct 2024 11:29:21 +0200 Subject: [PATCH] refs #7767 check holiday --- src/pages/Worker/Card/WorkerCalendarFilter.vue | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/pages/Worker/Card/WorkerCalendarFilter.vue b/src/pages/Worker/Card/WorkerCalendarFilter.vue index 2b81b6eaf..95fb2d393 100644 --- a/src/pages/Worker/Card/WorkerCalendarFilter.vue +++ b/src/pages/Worker/Card/WorkerCalendarFilter.vue @@ -3,9 +3,11 @@ import WorkerEventLabel from 'pages/Worker/Card/WorkerEventLabel.vue'; import FetchData from 'components/FetchData.vue'; import { useI18n } from 'vue-i18n'; import VnSelect from 'components/common/VnSelect.vue'; +import useNotify from 'src/composables/useNotify'; import { useRoute } from 'vue-router'; -import { computed, ref } from 'vue'; +import { computed, onMounted, ref } from 'vue'; import { toDateFormat } from '../../../filters/date'; +const { notify } = useNotify(); const { t } = useI18n(); const route = useRoute(); @@ -33,6 +35,9 @@ const props = defineProps({ }, }); +onMounted(async () => { + await checkHolidays(props.contractHolidays); +}); const emit = defineEmits(['update:businessFk', 'update:year', 'update:absenceType']); const selectedBusinessFk = computed({ @@ -60,6 +65,16 @@ const generateYears = () => { return Array.from({ length: 5 }, (_, i) => String(maxYear - i)) || []; }; +const checkHolidays = (contractHolidays) => { + console.log('contractHolidays', contractHolidays); + if ( + contractHolidays.holidaysEnjoyed > contractHolidays.totalHolidays || + contractHolidays.hoursEnjoyed > contractHolidays.totalHours + ) { + notify(t('Vacation days have been exceeded'), 'negative'); + } +}; + const absenceTypeList = ref([]); const contractList = ref([]); const yearList = ref(generateYears());