fix adding remark error

This commit is contained in:
edmondlang
2024-08-02 01:18:56 +08:00
parent 8d45a30dc7
commit 049d3cc098
2 changed files with 21 additions and 24 deletions
@@ -13,7 +13,7 @@
<h2 v-if="currentQuestion.text">{{ currentQuestion.text }}</h2>
<!-- <p>currentQuestionId - {{ currentQuestionId }}</p> -->
<!-- <p>currentOrder - {{ currentOrder }}</p> -->
<!-- <p>currentOrder - {{ currentOrder? currentOrder.id : 'null' }}</p> -->
<div v-if="currentQuestionId === '1688'">
<h1>Login Information</h1>
@@ -461,8 +461,8 @@ export default {
"answers": [
{ "text": "Sensitive Goods", "next": "Sensitive Goods" },
{ "text": "Others", "next": "PO Others" },
{ "text": "Stop Working", "next": "stop_working" },
{ "text": "Next PO", "next": "approve_po" }
// { "text": "Stop Working", "next": "stop_working" },
// { "text": "Next PO", "next": "approve_po" }
]
},
"issue_submit": {
@@ -537,30 +537,29 @@ export default {
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,
'remark': 'PO Others',
'user_id': this.$store.getters.getUserId,
}, false, false);
this.callApi(this.route('api.admin_work_flow.create_po_issue_remark'), 'post', 'section', {
'booking_id': this.currentOrder.id,
'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';
this.callApi(this.route('api.admin_work_flow.create_po_issue_remark'), 'post', 'section', {
'booking_id': this.currentOrder.id,
'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') {
if (['login_issue', '1688_issue_order', '1688_order_issue'].includes(this.currentQuestionId)) {
if (nextQuestionId === 'refund_request') {
this.callApi(this.route('api.admin_work_flow.create_issue_remark'), 'post', 'section', {
'booking_id': this.currentOrder.booking_id,
'remark': nextQuestionId,
'user_id': this.$store.getters.getUserId,
}, false, false);
nextQuestionId = 'refund_request';
} else if(nextQuestionId === '1688_issue_others') {
// this.callApi(this.route('api.admin_work_flow.create_issue_remark'), 'post', 'section', {
@@ -604,7 +603,7 @@ export default {
'user_id': this.$store.getters.getUserId,
'session_id': this.sessionId,
};
this.callApi(this.route('api.admin_work_flow.add_workflow_timestamp'), 'post', 'section', logBody, false, false);
// this.callApi(this.route('api.admin_work_flow.add_workflow_timestamp'), 'post', 'section', logBody, false, false);
this.stepTime = 0;
},
goBack() {
@@ -643,10 +642,8 @@ export default {
this.isLoading = false;
}
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
if ([this.route("api.admin_work_flow.fetch_oldest_order"), this.route("api.admin_work_flow.fetch_pending_approve_po"), this.route("api.admin_work_flow.fetch_pending_fill_po")].includes(url)) {
this.currentOrder = apiResponse.data.data
}
})
+3 -3
View File
@@ -169,16 +169,16 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
Route::post('/create_po_issue_remark', function (Request $request) {
$validator = Validator::make($request->all(), [
'marking' => 'required|exists:bookings,marking', // Validate if marking exists in the bookings table
'booking_id' => 'required',
'remark' => 'required',
'user_id' => 'required|exists:users,id', // Validate if user_id exists in the users table
'user_id' => 'required',
]);
if ($validator->fails()) {
return response()->json(['message' => $validator->messages()->first()], 400); // Return validation error
}
$booking = Booking::where('marking', $request->marking)->first();
$booking = Booking::find($request->booking_id);
if (!$booking) {
return response()->json(['message' => 'Booking not found'], 404);