Admin Workflow

This commit is contained in:
Dillon Ngo
2024-12-04 12:57:19 +08:00
parent 4df4822595
commit 76ba403593
2 changed files with 19 additions and 19 deletions
@@ -366,7 +366,7 @@
<!-- Debug box -->
<div class="debug-box" v-if="question">
<div id="debug-meta">
ID: {{question.question_number}} <br>
{{question.question_number}}<span v-if="externalApiResponse && externalApiResponse.data && externalApiResponse.data.booking">, Booking Id: {{externalApiResponse.data.booking.id}}</span><br>
</div>
</div>
</div>
@@ -650,7 +650,7 @@
position: fixed;
bottom: 0px;
left: 0px;
width: 200px;
width: 400px;
background-color: rgba(0, 0, 0, 0.8);
color: white;
font-size: 10px;
+17 -17
View File
@@ -14,7 +14,7 @@ use Illuminate\Support\Facades\Route;
Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namespace' => 'AdminWorkFlow'], function () {
// Generalized JSON response function
function jsonResponse($data = null, $message = null, $status = 200)
function jsonResp($data = null, $message = null, $status = 200)
{
$response = ['message' => $message];
@@ -56,18 +56,18 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
->first();
if(!$booking){
return jsonResponse(null, 'No booking found', 404);
return jsonResp(null, 'No booking found', 404);
}
markedProcessing($booking, '1688_admin_workflow_processing');
return $booking ? jsonResponse([
return $booking ? jsonResp([
'passwords' => $booking->bank->holder_name ?? null,
'account_no' => $booking->bank->account_no ?? null,
'pin' => $booking->bank->bank_branch ?? null,
'holder_name' => $booking->bank->holder_name ?? null,
'booking' => $booking
]) : jsonResponse(null, 'No booking found', 404);
]) : jsonResp(null, 'No booking found', 404);
})->name('fetch_oldest_order');
@@ -94,17 +94,17 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
->first();
if(!$booking){
return jsonResponse(null, 'No booking found', 404);
return jsonResp(null, 'No booking found', 404);
}
markedProcessing($booking, 'approve_po_admin_workflow_processing');
$result = new BookingResource($booking);
return jsonResponse([
return jsonResp([
'booking' => $result,
]);
// return $booking ? jsonResponse(new BookingResource($booking)) : jsonResponse(null, 'No booking found', 404);
// return $booking ? jsonResp(new BookingResource($booking)) : jsonResp(null, 'No booking found', 404);
})->name('fetch_pending_approve_po');
@@ -132,17 +132,17 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
->first();
if(!$booking){
return jsonResponse(null, 'No booking found', 404);
return jsonResp(null, 'No booking found', 404);
}
markedProcessing($booking, 'fill_po_admin_workflow_processing');
$result = new BookingResource($booking);
return jsonResponse([
return jsonResp([
'booking' => $result,
]);
// return $booking ? jsonResponse(new BookingResource($booking)) : jsonResponse(null, 'No booking found', 404);
// return $booking ? jsonResp(new BookingResource($booking)) : jsonResp(null, 'No booking found', 404);
})->name('fetch_pending_fill_po');
@@ -151,7 +151,7 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
$booking = Booking::find($bookingId);
if (!$booking) {
return jsonResponse(null, 'No booking found', 404);
return jsonResp(null, 'No booking found', 404);
}
$attributes = $booking->modelAttributes()
@@ -159,7 +159,7 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
->get(['id', 'value'])
->map(fn ($attr) => $attr->only(['id', 'value']));
return jsonResponse([
return jsonResp([
'booking' => $booking,
'booking_attributes' => $attributes,
]);
@@ -181,7 +181,7 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
// $workflowTimestamp = WorkflowTimestamp::create($validator->validated());
// return jsonResponse($workflowTimestamp, 'Workflow timestamp created successfully', 201);
// return jsonResp($workflowTimestamp, 'Workflow timestamp created successfully', 201);
// })->name('add_workflow_timestamp');
@@ -199,7 +199,7 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
// $booking = Booking::find($request->booking_id);
// if (!$booking) {
// return jsonResponse(null, 'Booking not found', 404);
// return jsonResp(null, 'Booking not found', 404);
// }
// $remark = new Remark([
@@ -211,7 +211,7 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
// $remark->save();
// return jsonResponse($remark, 'Remark created successfully', 201);
// return jsonResp($remark, 'Remark created successfully', 201);
// })->name('create_1688_login_issue_remark');
// Route::post('/create_issue_remark', function (Request $request) {
@@ -229,7 +229,7 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
// if (!$booking) {
// return jsonResponse(null, 'Booking not found', 404);
// return jsonResp(null, 'Booking not found', 404);
// }
// $remark = new Remark([
@@ -241,7 +241,7 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
// $remark->save();
// return jsonResponse($remark, 'Remark created successfully', 201);
// return jsonResp($remark, 'Remark created successfully', 201);
// })->name('create_issue_remark');
// Route::post('/create_po_issue_remark', function (Request $request) {