This commit is contained in:
parent
7b0610418d
commit
bd54f54483
|
@ -9,6 +9,29 @@ import { computed, ref, watch } from 'vue';
|
|||
import { toDateFormat } from '../../../filters/date';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const newPayedHolidays = ref(0);
|
||||
|
||||
function openDialog() {
|
||||
holidayDialogRef.value = true;
|
||||
}
|
||||
|
||||
async function updatePayedHolidays() {
|
||||
try {
|
||||
await axios.patch(`/api/business/${selectedBusinessFk.value}`, {
|
||||
payedHolidays: newPayedHolidays.value,
|
||||
});
|
||||
|
||||
notify(t('Paid holidays updated successfully'), 'positive');
|
||||
holidayDialogRef.value = false;
|
||||
emit('refreshData'); // Si necesitas actualizar la vista
|
||||
} catch (error) {
|
||||
notify(t('Error updating paid holidays'), 'negative');
|
||||
console.error('Update Error:', error);
|
||||
}
|
||||
}
|
||||
|
||||
const { notify } = useNotify();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -45,9 +68,7 @@ watch(
|
|||
},
|
||||
{ deep: true, immediate: true },
|
||||
);
|
||||
function openDialog() {
|
||||
holidayDialogRef.value = true;
|
||||
}
|
||||
|
||||
const emit = defineEmits(['update:businessFk', 'update:year', 'update:absenceType']);
|
||||
|
||||
const selectedBusinessFk = computed({
|
||||
|
@ -74,7 +95,9 @@ function generateYears() {
|
|||
|
||||
return Array.from({ length: 5 }, (_, i) => String(maxYear - i)) || [];
|
||||
}
|
||||
|
||||
const onDataSaved = (formData, requestResponse) => {
|
||||
emit('onDataSaved', formData, requestResponse);
|
||||
};
|
||||
function checkHolidays(contractHolidays) {
|
||||
if (!contractHolidays) return;
|
||||
if (
|
||||
|
@ -103,15 +126,19 @@ const yearList = ref(generateYears());
|
|||
/>
|
||||
<QDialog v-model="holidayDialogRef" :maximized="true" :class="['vn-row', 'wrap']">
|
||||
<FormModelPopup
|
||||
:url-update="`Business/${route.params.id}`"
|
||||
model="travel"
|
||||
:url-update="`Business/${props.businessFk}`"
|
||||
model="Business"
|
||||
:title="t('paidHolidays')"
|
||||
:form-initial-data="{ id: route.params.id }"
|
||||
@on-data-saved="fetchDataRef.fetch()"
|
||||
:form-initial-data="{
|
||||
id: props.businessFk,
|
||||
payedHolidays: contractHolidays.payedHolidays,
|
||||
}"
|
||||
@on-data-saved="onDataSaved"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
{{ data }}
|
||||
<VnInput
|
||||
v-model="contractHolidays.payedHolidays"
|
||||
v-model="data.payedHolidays"
|
||||
:label="t('paidHolidays')"
|
||||
type="number"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue