remark post attempt for pending PO approval

This commit is contained in:
Aqqil Azman
2024-07-29 14:25:19 +08:00
parent f94984d01e
commit 1f07402c2a
@@ -237,7 +237,7 @@
<div class="col">
<h2>
What issues did you encounter?
</h2>
</h2>
<div class="m-t-25">
<remark-comment-form-component></remark-comment-form-component>
</div>
@@ -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