forked from verdnatura/salix-front
refs #7767 fix contractHolidays
This commit is contained in:
parent
2edeb1043e
commit
b225f6a4c8
|
@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import useNotify from 'src/composables/useNotify';
|
import useNotify from 'src/composables/useNotify';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
import { toDateFormat } from '../../../filters/date';
|
import { toDateFormat } from '../../../filters/date';
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
|
@ -35,9 +35,13 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
watch(
|
||||||
await checkHolidays(props.contractHolidays);
|
() => props.contractHolidays,
|
||||||
});
|
(newValue) => {
|
||||||
|
checkHolidays(newValue);
|
||||||
|
},
|
||||||
|
{ deep: true, immediate: true }
|
||||||
|
);
|
||||||
const emit = defineEmits(['update:businessFk', 'update:year', 'update:absenceType']);
|
const emit = defineEmits(['update:businessFk', 'update:year', 'update:absenceType']);
|
||||||
|
|
||||||
const selectedBusinessFk = computed({
|
const selectedBusinessFk = computed({
|
||||||
|
@ -58,22 +62,23 @@ const selectedAbsenceType = computed({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const generateYears = () => {
|
function generateYears() {
|
||||||
const now = Date.vnNew();
|
const now = Date.vnNew();
|
||||||
const maxYear = now.getFullYear() + 1;
|
const maxYear = now.getFullYear() + 1;
|
||||||
|
|
||||||
return Array.from({ length: 5 }, (_, i) => String(maxYear - i)) || [];
|
return Array.from({ length: 5 }, (_, i) => String(maxYear - i)) || [];
|
||||||
};
|
}
|
||||||
|
|
||||||
const checkHolidays = (contractHolidays) => {
|
function checkHolidays(contractHolidays) {
|
||||||
console.log('contractHolidays', contractHolidays);
|
console.log('contractHolidays', contractHolidays);
|
||||||
|
if (!contractHolidays) return;
|
||||||
if (
|
if (
|
||||||
contractHolidays.holidaysEnjoyed > contractHolidays.totalHolidays ||
|
contractHolidays.holidaysEnjoyed > contractHolidays.totalHolidays ||
|
||||||
contractHolidays.hoursEnjoyed > contractHolidays.totalHours
|
contractHolidays.hoursEnjoyed > contractHolidays.totalHours
|
||||||
) {
|
) {
|
||||||
notify(t('Vacation days have been exceeded'), 'negative');
|
notify(t('Vacation days have been exceeded'), 'negative');
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
const absenceTypeList = ref([]);
|
const absenceTypeList = ref([]);
|
||||||
const contractList = ref([]);
|
const contractList = ref([]);
|
||||||
|
|
Loading…
Reference in New Issue