From 82eac261f47f2835e5bc6473241b9e34a824f60f Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 20 Jan 2026 10:29:25 +0700 Subject: [PATCH] fix:send_Date --- .../components/DialogResingn.vue | 53 ++++----- .../components/DialogTransfer.vue | 101 ++++++++++++++---- 2 files changed, 109 insertions(+), 45 deletions(-) diff --git a/src/modules/04_registryPerson/components/DialogResingn.vue b/src/modules/04_registryPerson/components/DialogResingn.vue index d9bd78997..c4e072197 100644 --- a/src/modules/04_registryPerson/components/DialogResingn.vue +++ b/src/modules/04_registryPerson/components/DialogResingn.vue @@ -24,6 +24,7 @@ const { dateToISO, pathRegistryEmp, success, + dialogConfirm, } = useCounterMixin(); //props @@ -64,32 +65,34 @@ const reasonOp = ref([ }, ]); -async function onSubmit() { - try { - showLoader(); - const formData = new FormData(); - formData.append("ProfileId", profileId.value); - formData.append("Location", form.location); - formData.append( - "ActiveDate", - form.activeDate !== null ? dateToISO(form.activeDate) : "" - ); - formData.append("Reason", form.reason); - if (form.files) { - formData.append("file", form.files); - } - if (form.reason === "OTHER") { - formData.append("remark", form.remark); - } +function onSubmit() { + dialogConfirm($q, async () => { + try { + showLoader(); + const formData = new FormData(); + formData.append("ProfileId", profileId.value); + formData.append("Location", form.location); + formData.append( + "ActiveDate", + form.activeDate !== null ? dateToISO(form.activeDate) : "" + ); + formData.append("Reason", form.reason); + if (form.files) { + formData.append("file", form.files); + } + if (form.reason === "OTHER") { + formData.append("remark", form.remark); + } - await http.post(config.API.resignAdmin(empType.value), formData); - router.push({ name: isEmployee.value ? "resignEmployee" : "resign" }); - success($q, "บันทึกข้อมูลสำเร็จ"); - } catch (error) { - messageError($q, error); - } finally { - hideLoader(); - } + await http.post(config.API.resignAdmin(empType.value), formData); + router.push({ name: isEmployee.value ? "resignEmployee" : "resign" }); + success($q, "บันทึกข้อมูลสำเร็จ"); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } + }); } /** function ปิด popup*/ diff --git a/src/modules/04_registryPerson/components/DialogTransfer.vue b/src/modules/04_registryPerson/components/DialogTransfer.vue index 5d54e07c4..1f135fb73 100644 --- a/src/modules/04_registryPerson/components/DialogTransfer.vue +++ b/src/modules/04_registryPerson/components/DialogTransfer.vue @@ -15,7 +15,15 @@ import DialogHeader from "@/components/DialogHeader.vue"; const $q = useQuasar(); const router = useRouter(); const route = useRoute(); -const { showLoader, hideLoader, messageError, success } = useCounterMixin(); +const { + showLoader, + hideLoader, + messageError, + success, + date2Thai, + convertDateToAPI, + dialogConfirm, +} = useCounterMixin(); //props const modal = defineModel("modal", { required: true }); @@ -26,27 +34,34 @@ const form = reactive({ tranferOrg: "", noteReason: "", files: null as File | null, + date: null as Date | null, }); -async function onSubmit() { - try { - showLoader(); - const formData = new FormData(); - formData.append("ProfileId", profileId.value); - formData.append("Organization", form.tranferOrg); - formData.append("Reason", form.noteReason); - if (form.files) { - formData.append("file", form.files); - } +function onSubmit() { + dialogConfirm($q, async () => { + try { + showLoader(); + const formData = new FormData(); + formData.append("ProfileId", profileId.value); + formData.append("Organization", form.tranferOrg); + formData.append("Reason", form.noteReason); + formData.append( + "Date", + form.date !== null ? (convertDateToAPI(form.date) as string) : "" + ); + if (form.files) { + formData.append("file", form.files); + } - await http.post(config.API.transferAdmin, formData); - router.push({ name: "transfer" }); - success($q, "บันทึกข้อมูลสำเร็จ"); - } catch (error) { - messageError($q, error); - } finally { - hideLoader(); - } + await http.post(config.API.transferAdmin, formData); + router.push({ name: "transfer" }); + success($q, "บันทึกข้อมูลสำเร็จ"); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } + }); } /** function ปิด popup*/ @@ -55,6 +70,7 @@ function closeDialog() { form.tranferOrg = ""; form.noteReason = ""; form.files = null; + form.date = null; } @@ -67,7 +83,7 @@ function closeDialog() {
-
+
+
+ + + + + +
+