Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into dev
This commit is contained in:
commit
3069ac27d0
|
@ -31,8 +31,8 @@ const countriesFilter = {
|
||||||
|
|
||||||
const countriesOptions = ref([]);
|
const countriesOptions = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (formData, requestResponse) => {
|
const onDataSaved = (...args) => {
|
||||||
emit('onDataSaved', formData, requestResponse);
|
emit('onDataSaved', ...args);
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
|
@ -3,9 +3,11 @@ import WorkerEventLabel from 'pages/Worker/Card/WorkerEventLabel.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
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 { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
import { toDateFormat } from '../../../filters/date';
|
import { toDateFormat } from '../../../filters/date';
|
||||||
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
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 emit = defineEmits(['update:businessFk', 'update:year', 'update:absenceType']);
|
||||||
|
|
||||||
const selectedBusinessFk = computed({
|
const selectedBusinessFk = computed({
|
||||||
|
@ -53,12 +62,22 @@ 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)) || [];
|
||||||
};
|
}
|
||||||
|
|
||||||
|
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 absenceTypeList = ref([]);
|
||||||
const contractList = ref([]);
|
const contractList = ref([]);
|
||||||
|
|
|
@ -29,6 +29,7 @@ const postcodesOptions = ref([]);
|
||||||
|
|
||||||
const user = useState().getUser();
|
const user = useState().getUser();
|
||||||
const defaultPayMethod = ref();
|
const defaultPayMethod = ref();
|
||||||
|
const bankEntitiesRef = ref();
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -118,6 +119,12 @@ onBeforeMount(async () => {
|
||||||
).data?.payMethodFk;
|
).data?.payMethodFk;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function handleNewBankEntity(data, resp) {
|
||||||
|
await bankEntitiesRef.value.fetch();
|
||||||
|
data.bankEntityFk = resp.id;
|
||||||
|
bankEntitiesOptions.value.push(resp);
|
||||||
|
}
|
||||||
|
|
||||||
function handleLocation(data, location) {
|
function handleLocation(data, location) {
|
||||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||||
data.postcode = code;
|
data.postcode = code;
|
||||||
|
@ -177,6 +184,7 @@ async function autofillBic(worker) {
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
ref="bankEntitiesRef"
|
||||||
url="BankEntities"
|
url="BankEntities"
|
||||||
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
|
@ -344,7 +352,9 @@ async function autofillBic(worker) {
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateBankEntityForm
|
<CreateBankEntityForm
|
||||||
@on-data-saved="(data) => bankEntitiesOptions.push(data)"
|
@on-data-saved="
|
||||||
|
(_, resp) => handleNewBankEntity(data, resp)
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
|
|
Loading…
Reference in New Issue