From 84d61cbb6dd051495070939facf6a586f93504da Mon Sep 17 00:00:00 2001 From: waruneeta Date: Mon, 12 Feb 2024 10:47:34 +0700 Subject: [PATCH] no message --- src/components/DialogAddEmployee.vue | 89 +++++++++++++++++----------- 1 file changed, 53 insertions(+), 36 deletions(-) diff --git a/src/components/DialogAddEmployee.vue b/src/components/DialogAddEmployee.vue index 9b1188a70..b6dacb64a 100644 --- a/src/components/DialogAddEmployee.vue +++ b/src/components/DialogAddEmployee.vue @@ -21,6 +21,8 @@ const { dateToISO, dialogConfirm, success, + dateToPost, + dateToDisplay, } = useCounterMixin(); const $q = useQuasar(); @@ -33,13 +35,13 @@ const informaData = ref({ prefixId: null, firstname: null, lastname: null, - birthDate: null, + birthDate: "", genderId: null, bloodId: null, - nationality: null, - ethnicity: null, + nationality: "ไทย", + ethnicity: "ไทย", statusId: null, - religionId: null, + religionId: "ceaec498-71b4-4f82-b5a2-7d6ec988b753", tel: null, employeeType: null, employeeClass: null, @@ -170,26 +172,26 @@ const calculateMaxDate = () => { // เช็คเรื่องการเกษียณ const calRetire = async (birth: Date) => { const body = { - birthDate: dateToISO(birth), + birthDate: dateToPost(birth), }; - if (dateToISO(dateBefore.value) != dateToISO(birth)) { - showLoader(); + if (dateToISO(dateBefore.value) > dateToPost(birth)) { + // showLoader(); await http .post(config.API.profileCalRetire, body) .then((res: any) => { const data = res.data.result; informaData.value.age = data.age; - informaData.value.birthDate = birth; + // informaData.value.birthDate = birth; changeRetireText(data.retireDate); dateBefore.value = birth; }) - .catch((e: any) => { - messageError($q, e); - informaData.value.birthDate = null; - informaData.value.age = ""; - }) + // .catch((e: any) => { + // messageError($q, e); + // informaData.value.birthDate = null; + // informaData.value.age = ""; + // }) .finally(() => { - hideLoader(); + // hideLoader(); }); } }; @@ -242,20 +244,24 @@ const addData = async () => { if (informaData.value.employeeClass != undefined) formData.append("employeeClass", informaData.value.employeeClass); - showLoader(); - await http - .post(config.API.createProfileOfficer(), formData) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - modal.value = false; - await changeBirth(informaData.value.birthDate ?? new Date()); - hideLoader(); - }); + console.log("informaData===>", informaData.value); + // showLoader(); + // await http + // .post(config.API.createProfileOfficer(), formData) + // .then((res) => { + // success($q, "บันทึกข้อมูลสำเร็จ"); + // }) + // .catch((e) => { + // messageError($q, e); + // }) + // .finally(async () => { + // modal.value = false; + // await changeBirth( + // new Date(dateToPost(new Date(informaData.value.birthDate))) ?? + // new Date() + // ); + // hideLoader(); + // }); }; /*** get รายการข้อมูลเกี่ยวกับบุคคล (dropdown list) */ @@ -321,6 +327,7 @@ const fetchPerson = async () => { }); }; +