forked from verdnatura/salix-front
Reviewed-on: verdnatura/salix-front#800 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
22cc9d689d
|
@ -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, ref, watch } from 'vue';
|
||||
import { toDateFormat } from '../../../filters/date';
|
||||
const { notify } = useNotify();
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
@ -33,6 +35,13 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.contractHolidays,
|
||||
(newValue) => {
|
||||
checkHolidays(newValue);
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
const emit = defineEmits(['update:businessFk', 'update:year', 'update:absenceType']);
|
||||
|
||||
const selectedBusinessFk = computed({
|
||||
|
@ -53,12 +62,22 @@ const selectedAbsenceType = computed({
|
|||
},
|
||||
});
|
||||
|
||||
const generateYears = () => {
|
||||
function generateYears() {
|
||||
const now = Date.vnNew();
|
||||
const maxYear = now.getFullYear() + 1;
|
||||
|
||||
return Array.from({ length: 5 }, (_, i) => String(maxYear - i)) || [];
|
||||
};
|
||||
}
|
||||
|
||||
function checkHolidays(contractHolidays) {
|
||||
if (!contractHolidays) return;
|
||||
if (
|
||||
contractHolidays.holidaysEnjoyed > contractHolidays.totalHolidays ||
|
||||
contractHolidays.hoursEnjoyed > contractHolidays.totalHours
|
||||
) {
|
||||
notify(t('Vacation days have been exceeded'), 'negative');
|
||||
}
|
||||
}
|
||||
|
||||
const absenceTypeList = ref([]);
|
||||
const contractList = ref([]);
|
||||
|
|
Loading…
Reference in New Issue