0
0
Fork 0

refs #7767 check holiday

This commit is contained in:
Carlos Satorres 2024-10-04 11:29:21 +02:00
parent 222e83cad8
commit 0d31adaa4b
1 changed files with 16 additions and 1 deletions

View File

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