From 04ce57065474de56b93cc8f438e98f42a5af077a Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Wed, 27 Sep 2023 11:30:37 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20=20Dialog=20=E0=B8=94=E0=B8=B3=E0=B9=80=E0=B8=99=E0=B8=B4?= =?UTF-8?q?=E0=B8=99=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=AA=E0=B8=B3=E0=B9=80?= =?UTF-8?q?=E0=B8=A3=E0=B9=87=E0=B8=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../04_registry/components/Profile.vue | 121 ++++++++++++++---- 1 file changed, 99 insertions(+), 22 deletions(-) diff --git a/src/modules/04_registry/components/Profile.vue b/src/modules/04_registry/components/Profile.vue index 034d853d8..947e418fc 100644 --- a/src/modules/04_registry/components/Profile.vue +++ b/src/modules/04_registry/components/Profile.vue @@ -1021,27 +1021,60 @@ const closeKp7Short = () => { dialogShort.value = false; }; -const helpPost = () => { +const helpPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.placemenHelpGov, formData); + showLoader(); + await http + .post(config.API.placemenHelpGov, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; const repatriationPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.placemenRepatriation, formData); + showLoader(); + await http + .post(config.API.placemenRepatriation, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; const appointPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.placemenAppointment, formData); + showLoader(); + await http + .post(config.API.placemenAppointment, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; @@ -1054,34 +1087,78 @@ const appointPost = async () => { // }; const outPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.retirementOut, formData); + showLoader(); + await http + .post(config.API.retirementOut, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; const dischargePost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.retirementDischarge, formData); + showLoader(); + await http + .post(config.API.retirementDischarge, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; const expulsionPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.retirementExpulsion, formData); + showLoader(); + await http + .post(config.API.retirementExpulsion, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; const otherPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.placemenOther, formData); + showLoader(); + await http + .post(config.API.placemenOther, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); };