diff --git a/src/components/CreateBankEntityForm.vue b/src/components/CreateBankEntityForm.vue index 0a3c10f57..a42be6ef8 100644 --- a/src/components/CreateBankEntityForm.vue +++ b/src/components/CreateBankEntityForm.vue @@ -31,8 +31,8 @@ const countriesFilter = { const countriesOptions = ref([]); -const onDataSaved = (formData, requestResponse) => { - emit('onDataSaved', formData, requestResponse); +const onDataSaved = (...args) => { + emit('onDataSaved', ...args); }; onMounted(async () => { diff --git a/src/pages/Worker/Card/WorkerCalendarFilter.vue b/src/pages/Worker/Card/WorkerCalendarFilter.vue index 2b81b6eaf..67b7df907 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, 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([]); diff --git a/src/pages/Worker/WorkerList.vue b/src/pages/Worker/WorkerList.vue index 9795cbed0..7a3f760bc 100644 --- a/src/pages/Worker/WorkerList.vue +++ b/src/pages/Worker/WorkerList.vue @@ -29,6 +29,7 @@ const postcodesOptions = ref([]); const user = useState().getUser(); const defaultPayMethod = ref(); +const bankEntitiesRef = ref(); const columns = computed(() => [ { align: 'left', @@ -118,6 +119,12 @@ onBeforeMount(async () => { ).data?.payMethodFk; }); +async function handleNewBankEntity(data, resp) { + await bankEntitiesRef.value.fetch(); + data.bankEntityFk = resp.id; + bankEntitiesOptions.value.push(resp); +} + function handleLocation(data, location) { const { town, code, provinceFk, countryFk } = location ?? {}; data.postcode = code; @@ -177,6 +184,7 @@ async function autofillBic(worker) { auto-load />