From 55a1582dcc03574fe95c69d4e1b663740e97abf5 Mon Sep 17 00:00:00 2001 From: marsellavaleria19 Date: Wed, 9 Oct 2024 13:35:29 +0700 Subject: [PATCH 1/8] refactor : update function name for redirect to hotline jabar --- mixins/popup-aduan-masuk.js | 205 +++++++++++++++++++++++++++--------- 1 file changed, 155 insertions(+), 50 deletions(-) diff --git a/mixins/popup-aduan-masuk.js b/mixins/popup-aduan-masuk.js index f9a7bcf1..590c145f 100644 --- a/mixins/popup-aduan-masuk.js +++ b/mixins/popup-aduan-masuk.js @@ -5,6 +5,7 @@ export default { return { isShowPopupConfirmationVerification: false, isShowPopupConfirmationFailedVerification: false, + isShowPopupConfirmationRedirectHotlineJabar: false, isShowPopupInformation: false, isShowPopupInputIdSpan: false, isShowPopupProcessComplaint: false, @@ -24,6 +25,7 @@ export default { fill: '', name: '', }, + dataComplaint: {}, complaintNote: '', isLoading: false, typeDialog: '', @@ -69,18 +71,50 @@ export default { }) this.isShowPopupConfirmationVerification = true }, - showPopupConfirmationFailedComplaintHandle(dataComplaint) { + showPopupConfirmationComplaint(dataComplaint, typeDialog) { this.idApi = dataComplaint.id - this.typeDialog = 'failedComplaint' + this.dataComplaint = dataComplaint + if (typeDialog === 'failedComplaint') { + this.typeDialog = 'failedComplaint' + this.setDataDialog({ + ...this.setDataDialogConfirmation( + 'Konfirmasi Gagal Diverifikasi', + 'No.Aduan', + dataComplaint.complaint_id, + 'Konfirmasi' + ), + labelTextArea: 'Catatan Aduan Gagal Diverifikasi', + placeholder: 'Detail Aduan tidak lengkap : contoh (foto tidak jelas)', + }) + } + if (typeDialog === 'redirectHotlineComplaint') { + this.typeDialog = 'redirectHotlineComplaint' + this.setDataDialog({ + ...this.setDataDialogConfirmation( + 'Konfirmasi Dialihkan ke Hotline Jabar', + 'No.Aduan', + dataComplaint.complaint_id, + 'Konfirmasi' + ), + labelTextArea: 'Alasan dialihkan ke Hotline Jabar', + placeholder: 'Contoh: Aduan terkait kegawat daruratan', + }) + } + this.dataDialog.name = this.typeDialog + this.$store.commit('modals/OPEN', this.typeDialog) + }, + showPopupConfirmationRedirectHotline(dataComplaint) { + this.idApi = dataComplaint.id + this.typeDialog = 'redirectHotlineComplaint' this.setDataDialog({ ...this.setDataDialogConfirmation( - 'Konfirmasi Gagal Diverifikasi', + 'Konfirmasi Dialihkan ke Hotline Jabar', 'No.Aduan', dataComplaint.complaint_id, 'Konfirmasi' ), - labelTextArea: 'Catatan Aduan Gagal Diverifikasi', - placeholder: 'Detail Aduan tidak lengkap : contoh (foto tidak jelas)', + labelTextArea: 'Alasan dialihkan ke Hotline Jabar', + placeholder: 'Contoh: Aduan terkait kegawat daruratan', }) this.isShowPopupConfirmationFailedVerification = true }, @@ -195,48 +229,101 @@ export default { }, submitPopupComplaintHandle(item) { let dataDialogInformation = {} - const paramRequest = {} - if (this.typeDialog === 'verificationComplaint') { - this.isShowPopupConfirmationVerification = false - dataDialogInformation = { - ...this.setDataDialogInformation( - 'Verifikasi Aduan', - item.subDescription - ), - success: this.setSucessFailedInformationHandle( - 'Aduan berhasil diverifikasi', - true - ), - failed: this.setSucessFailedInformationHandle( - 'Aduan gagal diverifikasi', - false - ), - } - paramRequest.complaint_status_id = 'verified' - } else { - this.isShowPopupConfirmationFailedVerification = false - dataDialogInformation = { - ...this.setDataDialogInformation( - 'Aduan Gagal Diverifikasi', - item.subDescription - ), - success: this.setSucessFailedInformationHandle( - 'Konfirmasi Aduan Gagal Diverifikasi berhasil dilakukan', - true - ), - failed: this.setSucessFailedInformationHandle( - 'Konfirmasi Aduan Gagal Diverifikasi gagal dilakukan', - false - ), - } - paramRequest.complaint_status_id = 'failed' + let paramRequest = { complaint_status_note: item?.note } + let pathApi = 'change-status' + switch (this.typeDialog) { + case "'verificationComplaint": + this.isShowPopupConfirmationVerification = false + dataDialogInformation = { + ...this.setDataDialogInformation( + 'Verifikasi Aduan', + item.subDescription + ), + success: this.setSucessFailedInformationHandle( + 'Aduan berhasil diverifikasi', + true + ), + failed: this.setSucessFailedInformationHandle( + 'Aduan gagal diverifikasi', + false + ), + } + paramRequest.complaint_status_id = 'verified' + break + case 'failedComplaint': + this.$store.commit('modals/CLOSEALL') + dataDialogInformation = { + ...this.setDataDialogInformation( + 'Aduan Gagal Diverifikasi', + item.subDescription + ), + success: this.setSucessFailedInformationHandle( + 'Konfirmasi Aduan Gagal Diverifikasi berhasil dilakukan', + true + ), + failed: this.setSucessFailedInformationHandle( + 'Konfirmasi Aduan Gagal Diverifikasi gagal dilakukan', + false + ), + } + paramRequest.complaint_status_id = 'failed' + break + case 'redirectHotlineComplaint': + this.$store.commit('modals/CLOSEALL') + dataDialogInformation = { + ...this.setDataDialogInformation( + 'Aduan Dialihkan ke Hotline Jabar', + item.subDescription + ), + success: this.setSucessFailedInformationHandle( + 'Aduan berhasil dialihkan ke Hotline Jabar', + true + ), + failed: this.setSucessFailedInformationHandle( + 'Aduan gagal dialihkan ke Hotline Jabar', + false + ), + } + paramRequest = { directed_to_hotline_jabar_note: item?.note } + pathApi = 'redirected-to-hotline-jabar' } + // if (this.typeDialog === 'verificationComplaint') { + // this.isShowPopupConfirmationVerification = false + // dataDialogInformation = { + // ...this.setDataDialogInformation( + // 'Verifikasi Aduan', + // item.subDescription + // ), + // success: this.setSucessFailedInformationHandle( + // 'Aduan berhasil diverifikasi', + // true + // ), + // failed: this.setSucessFailedInformationHandle( + // 'Aduan gagal diverifikasi', + // false + // ), + // } + // paramRequest.complaint_status_id = 'verified' + // } else { + // this.isShowPopupConfirmationFailedVerification = false + // dataDialogInformation = { + // ...this.setDataDialogInformation( + // 'Aduan Gagal Diverifikasi', + // item.subDescription + // ), + // success: this.setSucessFailedInformationHandle( + // 'Konfirmasi Aduan Gagal Diverifikasi berhasil dilakukan', + // true + // ), + // failed: this.setSucessFailedInformationHandle( + // 'Konfirmasi Aduan Gagal Diverifikasi gagal dilakukan', + // false + // ), + // } + // paramRequest.complaint_status_id = 'failed' + // } - this.integrationPopupHandle( - dataDialogInformation, - { ...paramRequest, complaint_status_note: item?.note }, - 'change-status' - ) + this.integrationPopupHandle(dataDialogInformation, paramRequest, pathApi) }, submitInputIdSpanHandle(item) { @@ -353,11 +440,20 @@ export default { this.dataDialog.title = paramDialog.title this.dataDialog.subDescription = paramDialog.subDescription this.isLoading = true + const urlApi = `${ENDPOINT_ADUAN}/${this.idApi}/${pathApi}` + try { - await this.$axios.patch(`${ENDPOINT_ADUAN}/${this.idApi}/${pathApi}`, { - ...paramsInputRequest, - user_id: this.$auth?.user?.identifier, - }) + if (this.typeDialog === 'redirectHotlineComplaint') { + await this.$mockApi.patch(urlApi, { + ...paramsInputRequest, + user_id: this.$auth?.user?.identifier, + }) + } else { + await this.$axios.patch(urlApi, { + ...paramsInputRequest, + user_id: this.$auth?.user?.identifier, + }) + } this.setDataDialog({ ...paramDialog.success }) this.setIconPopup({ name: 'check-mark-circle', fill: '#069550' }) } catch { @@ -373,7 +469,16 @@ export default { case 'verificationComplaint': return this.submitPopupComplaintHandle(this.dataDialog) case 'failedComplaint': - return this.submitPopupComplaintHandle(this.dataDialog) + // return this.submitPopupComplaintHandle(this.dataDialog) + return this.showPopupConfirmationComplaint( + this.dataComplaint, + 'failedComplaint' + ) + case 'redirectHotlineComplaint': + return this.showPopupConfirmationComplaint( + this.dataComplaint, + 'redirectHotlineComplaint' + ) case 'addIdSpan': { return this.submitInputIdSpanHandle(this.dataDialog) } From 273f126871e0c085307bd2600bd90e6abf51b0ff Mon Sep 17 00:00:00 2001 From: marsellavaleria19 Date: Wed, 9 Oct 2024 13:36:18 +0700 Subject: [PATCH 2/8] feat : add function for show popup confirmation failed & redirect to hotline jabar --- components/Aduan/index.vue | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/components/Aduan/index.vue b/components/Aduan/index.vue index a1b41370..5602c03c 100644 --- a/components/Aduan/index.vue +++ b/components/Aduan/index.vue @@ -157,7 +157,15 @@ @verify=" showPopupConfirmationVerificationComplaintHandle(item) " - @failed="showPopupConfirmationFailedComplaintHandle(item)" + @failed=" + showPopupConfirmationComplaint(item, 'failedComplaint') + " + @redirect-hotline-jabar=" + showPopupConfirmationComplaint( + item, + 'redirectHotlineComplaint' + ) + " @add-span="showPopupInputIdSpanHandle(item)" @process-complaint="showPopupProcessComplaintHandle(item)" @change-authority="showPopupChangeAuthority(item)" @@ -189,6 +197,12 @@ @close="closePopupHandle()" @submit="submitPopupComplaintHandle" /> + Date: Wed, 9 Oct 2024 13:36:41 +0700 Subject: [PATCH 3/8] fix : fixing label name for cancel button --- components/Base/Dialog/FooterNew/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Base/Dialog/FooterNew/index.vue b/components/Base/Dialog/FooterNew/index.vue index 31c117a7..be05e980 100644 --- a/components/Base/Dialog/FooterNew/index.vue +++ b/components/Base/Dialog/FooterNew/index.vue @@ -4,7 +4,7 @@
Date: Wed, 9 Oct 2024 13:41:15 +0700 Subject: [PATCH 4/8] feat : add some changes for disable button on dialog input text area --- components/Dialog/InputTextArea/index.vue | 118 ++++++++++++---------- 1 file changed, 63 insertions(+), 55 deletions(-) diff --git a/components/Dialog/InputTextArea/index.vue b/components/Dialog/InputTextArea/index.vue index 9c2b9b46..018bd0ab 100644 --- a/components/Dialog/InputTextArea/index.vue +++ b/components/Dialog/InputTextArea/index.vue @@ -1,36 +1,50 @@