From 1f07402c2a297c21f7d98e5111179e54b671b7cb Mon Sep 17 00:00:00 2001 From: Aqqil Azman Date: Mon, 29 Jul 2024 14:25:19 +0800 Subject: [PATCH] remark post attempt for pending PO approval --- .../AdminWorkFlowSectionComponent.vue | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/resources/assets/vue/components/general/sections/AdminWorkFlowSectionComponent.vue b/resources/assets/vue/components/general/sections/AdminWorkFlowSectionComponent.vue index ee00ee1f..677f87fc 100644 --- a/resources/assets/vue/components/general/sections/AdminWorkFlowSectionComponent.vue +++ b/resources/assets/vue/components/general/sections/AdminWorkFlowSectionComponent.vue @@ -237,7 +237,7 @@

What issues did you encounter? -

+
@@ -525,21 +525,22 @@ export default { endWork() { this.stopTimer(); console.log("work is ended"); }, selectAnswer(nextQuestionId, goBack = false) { if (nextQuestionId === 'refresh_page') return window.location.reload(); - if (this.currentQuestionId === 'issue_po') { - if (nextQuestionId === 'po_others') { - this.callApi(this.route('api.admin_work_flow.create_po_issue_remark'), 'post', 'section', { - 'marking': this.currentOrder.marking, - 'remark': 'PO Others', - 'user_id': this.$store.getters.getUserId, - }, false, false); - } else { - this.callApi(this.route('api.admin_work_flow.create_po_issue_remark'), 'post', 'section', { - 'marking': this.currentOrder.marking, - 'remark': nextQuestionId, - 'user_id': this.$store.getters.getUserId, - }, false, false); - nextQuestionId = 'issue_submit'; - } + if (this.currentQuestionId === 'issue_po') { + if (nextQuestionId === 'po_others') { + this.callApi(this.route('api.admin_work_flow.create_po_issue_remark'), 'post', 'section', { + 'marking': this.currentOrder, + 'remark': 'PO Others', + 'user_id': this.$store.getters.getUserId, + }, false, false); + + } else { + this.callApi(this.route('api.admin_work_flow.create_po_issue_remark'), 'post', 'section', { + 'marking': this.currentOrder, + 'remark': nextQuestionId, + 'user_id': this.$store.getters.getUserId, + }, false, false); + nextQuestionId = 'issue_submit'; + } } if (this.currentQuestionId === 'login_issue' || this.currentQuestionId === '1688_issue_order' || this.currentQuestionId === '1688_order_issue') { @@ -610,7 +611,10 @@ export default { callApi(url, method, section, parameters = null, showLoadingAnimation = true, storeResponseBody = true) { if (url == 'fetch_model_attributes') { url = this.route("api.admin_work_flow.fetch_model_attributes", this.currentOrder.booking_id) - } + } else if (url == 'fetch_pending_approve_po') { + url = this.route("api.admin_work_flow.fetch_pending_approve_po", this.currentOrder) + } + if (showLoadingAnimation) this.isLoading = true; this.$store.dispatch('crudRequest', { endpoint: url, method, parameters: parameters }) .then(response => response.json().then(data => ({ data, ok: response.ok, status: response.status }))) @@ -632,7 +636,10 @@ export default { if (url === this.route("api.admin_work_flow.fetch_oldest_order")) { this.currentOrder = apiResponse.data.data; + } else if (url === this.route("api.admin_work_flow.fetch_oldest_order")) { + this.currentOrder = apiResponse.data } + }) .catch(error => { // Handle network or other unexpected errors