fix Leave reason

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-10 18:09:23 +07:00
parent a3d008024e
commit 698d03ce00
12 changed files with 64 additions and 16 deletions

View file

@ -142,6 +142,7 @@ function onValidate() {
* @param formData * @param formData
*/ */
const isLeave = ref<boolean>(true); const isLeave = ref<boolean>(true);
const reasonLeave = ref<string>("");
async function fetchCheck() { async function fetchCheck() {
await http await http
.post(config.API.leaveCheck(), { .post(config.API.leaveCheck(), {
@ -154,6 +155,7 @@ async function fetchCheck() {
formDataSick.leaveTotal = formDataSick.leaveTotal =
data.totalDate - data.sumDateWork - data.sumDateHoliday; data.totalDate - data.sumDateWork - data.sumDateHoliday;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
reasonLeave.value = data.reason ? data.reason : "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -394,7 +396,7 @@ onMounted(() => {
> >
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -122,11 +122,12 @@ function onValidate() {
} }
} }
const isLeave = ref<boolean>(true);
const reasonLeave = ref<string>("");
/** /**
* check าลาไดไหม จาก api * check าลาไดไหม จาก api
* @param formData * @param formData
*/ */
const isLeave = ref<boolean>(true);
async function fetchCheck() { async function fetchCheck() {
await http await http
.post(config.API.leaveCheck(), { .post(config.API.leaveCheck(), {
@ -138,6 +139,9 @@ async function fetchCheck() {
const data = res.data.result; const data = res.data.result;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataBirth.leaveTotal = data.totalDate; formDataBirth.leaveTotal = data.totalDate;
reasonLeave.value = data.reason
? data.reason
: "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -321,7 +325,7 @@ onMounted(() => {
> >
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -149,6 +149,8 @@ function updateLeaveTotal() {
formDataHelpWife.leaveTotal = newLeaveTotal; formDataHelpWife.leaveTotal = newLeaveTotal;
} }
const reasonLeave = ref<string>("");
/** /**
* check าลาไดไหม จาก api * check าลาไดไหม จาก api
* @param formData * @param formData
@ -165,6 +167,10 @@ async function fetchCheck() {
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataHelpWife.leaveTotal = formDataHelpWife.leaveTotal =
data.totalDate - data.sumDateWork - data.sumDateHoliday; data.totalDate - data.sumDateWork - data.sumDateHoliday;
reasonLeave.value = data.reason
? data.reason
: "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -344,7 +350,7 @@ onMounted(() => {
> >
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -158,6 +158,8 @@ function onValidate() {
* @param formData * @param formData
*/ */
const isLeave = ref<boolean>(true); const isLeave = ref<boolean>(true);
const reasonLeave = ref<string>("");
async function fetchCheck() { async function fetchCheck() {
await http await http
.post(config.API.leaveCheck(), { .post(config.API.leaveCheck(), {
@ -170,6 +172,10 @@ async function fetchCheck() {
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataVacation.leaveTotal = formDataVacation.leaveTotal =
data.totalDate - data.sumDateWork - data.sumDateHoliday; data.totalDate - data.sumDateWork - data.sumDateHoliday;
reasonLeave.value = data.reason
? data.reason
: "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -410,7 +416,7 @@ onMounted(() => {
> >
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -160,11 +160,12 @@ function onValidate() {
} }
} }
const isLeave = ref<boolean>(true);
const reasonLeave = ref<string>("");
/** /**
* check าลาไดไหม จาก api * check าลาไดไหม จาก api
* @param formData * @param formData
*/ */
const isLeave = ref<boolean>(true);
async function fetchCheck() { async function fetchCheck() {
await http await http
.post(config.API.leaveCheck(), { .post(config.API.leaveCheck(), {
@ -176,6 +177,9 @@ async function fetchCheck() {
const data = res.data.result; const data = res.data.result;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataOrdination.leaveTotal = data.totalDate; formDataOrdination.leaveTotal = data.totalDate;
reasonLeave.value = data.reason
? data.reason
: "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -388,7 +392,7 @@ onMounted(() => {
> >
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -118,6 +118,7 @@ function onValidate() {
* @param formData * @param formData
*/ */
const isLeave = ref<boolean>(true); const isLeave = ref<boolean>(true);
const reasonLeave = ref<string>("");
async function fetchCheck() { async function fetchCheck() {
await http await http
.post(config.API.leaveCheck(), { .post(config.API.leaveCheck(), {
@ -129,6 +130,10 @@ async function fetchCheck() {
const data = res.data.result; const data = res.data.result;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataHaji.leaveTotal = data.totalDate; formDataHaji.leaveTotal = data.totalDate;
reasonLeave.value = data.reason
? data.reason
: "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -324,7 +329,7 @@ onMounted(() => {
> >
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -137,12 +137,12 @@ function onValidate() {
props.onSubmit(formData, isLeave.value); props.onSubmit(formData, isLeave.value);
} }
} }
const reasonLeave = ref<string>("");
/** /**
* check าลาไดไหม จาก api * check าลาไดไหม จาก api
* @param formData * @param formData
*/ */
async function fetchCheck() { async function fetchCheck() {
await http await http
.post(config.API.leaveCheck(), { .post(config.API.leaveCheck(), {
@ -154,6 +154,9 @@ async function fetchCheck() {
const data = res.data.result; const data = res.data.result;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataMilitary.leaveTotal = data.totalDate; formDataMilitary.leaveTotal = data.totalDate;
reasonLeave.value = data.reason
? data.reason
: "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -343,7 +346,7 @@ onMounted(() => {
> >
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -161,6 +161,8 @@ function onValidate() {
} }
} }
const reasonLeave = ref<string>("");
async function fetchCheck() { async function fetchCheck() {
await http await http
.post(config.API.leaveCheck(), { .post(config.API.leaveCheck(), {
@ -172,6 +174,7 @@ async function fetchCheck() {
const data = res.data.result; const data = res.data.result;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataStudy.leaveTotalDay = data.totalDate; formDataStudy.leaveTotalDay = data.totalDate;
reasonLeave.value = data.reason ? data.reason : "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -384,7 +387,7 @@ onMounted(async () => {
> >
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -148,6 +148,8 @@ function onValidate() {
} }
} }
const reasonLeave = ref<string>("");
async function fetchCheck() { async function fetchCheck() {
await http await http
.post(config.API.leaveCheck(), { .post(config.API.leaveCheck(), {
@ -159,6 +161,8 @@ async function fetchCheck() {
const data = res.data.result; const data = res.data.result;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataTrain.leaveTotalDay = data.totalDate; formDataTrain.leaveTotalDay = data.totalDate;
reasonLeave.value = data.reason ? data.reason : "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -369,7 +373,7 @@ onMounted(async () => {
> >
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -139,6 +139,8 @@ async function onClickDownloadFile(id: string, fileName: string) {
}); });
} }
const reasonLeave = ref<string>("");
/** /**
* check าลาไดไหม จาก api * check าลาไดไหม จาก api
* @param formData * @param formData
@ -155,6 +157,8 @@ async function fetchCheck() {
const data = res.data.result; const data = res.data.result;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataWorkInternational.leaveTotal = data.totalDate; formDataWorkInternational.leaveTotal = data.totalDate;
reasonLeave.value = data.reason ? data.reason : "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -339,7 +343,7 @@ onMounted(() => {
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -176,6 +176,8 @@ function onValidate() {
} }
} }
const reasonLeave = ref<string>("");
/** /**
* check าลาไดไหม จาก api * check าลาไดไหม จาก api
* @param formData * @param formData
@ -192,6 +194,7 @@ async function fetchCheck() {
const data = res.data.result; const data = res.data.result;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataFollowSpouse.leaveTotalDay = data.totalDate; formDataFollowSpouse.leaveTotalDay = data.totalDate;
reasonLeave.value = data.reason ? data.reason : "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -449,7 +452,7 @@ onMounted(async () => {
> >
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>

View file

@ -98,11 +98,13 @@ const fileUploadDoc = async (files: any) => {
}); });
}; };
const reasonLeave = ref<string>("");
const isLeave = ref<boolean>(true);
/** /**
* check าลาไดไหม จาก api * check าลาไดไหม จาก api
* @param formData * @param formData
*/ */
const isLeave = ref<boolean>(true);
async function FetchCheck() { async function FetchCheck() {
showLoader(); showLoader();
await http await http
@ -115,6 +117,8 @@ async function FetchCheck() {
const data = res.data.result; const data = res.data.result;
isLeave.value = data.isLeave; isLeave.value = data.isLeave;
formDataRehabilitation.leaveTotal = data.totalDate; formDataRehabilitation.leaveTotal = data.totalDate;
reasonLeave.value = data.reason ? data.reason : "จำนวนวันลาเกินที่กำหนด";
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -306,7 +310,7 @@ onMounted(() => {
<template v-slot:hint> <template v-slot:hint>
<span style="color: red"> <span style="color: red">
{{ !isLeave ? "จำนวนวันลาเกินที่กำหนด" : "" }} {{ !isLeave ? reasonLeave : "" }}
</span> </span>
</template> </template>
</q-input> </q-input>