From 6f9dd969e0bed48b51ee3c3637f49ca85e25e35a Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Wed, 4 Dec 2024 13:55:01 +0800 Subject: [PATCH] Admin Workflow --- routes/admin_workflow.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/routes/admin_workflow.php b/routes/admin_workflow.php index e7105f0f..e2cadb45 100644 --- a/routes/admin_workflow.php +++ b/routes/admin_workflow.php @@ -11,9 +11,9 @@ use App\Models\KeyValuePair; use Carbon\Carbon; use Illuminate\Support\Facades\Route; -Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namespace' => 'AdminWorkFlow'], function () { +// Generalized JSON response function - // Generalized JSON response function +if (!function_exists('responseJson')) { function responseJson($data = null, $message = null, $status = 200) { $response = ['message' => $message]; @@ -24,7 +24,9 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp return response()->json($response, $status); } +} +if (!function_exists('markedProcessing')) { function markedProcessing($booking, $key){ $kvp = $booking->attributesKVP()->where('key', $key)->first(); @@ -33,6 +35,9 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp (App()->make(CreatesKeyValuePair::class))->execute($booking, $keyValuePairObject); } } +} + +Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namespace' => 'AdminWorkFlow'], function () { Route::get('/fetch-oldest-order', function () { @@ -108,7 +113,6 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp })->name('fetch_pending_approve_po'); - Route::get('/fetch-pending-fill-po', function () { $excludedBookingIds = KeyValuePair::where('owner_type', 'App\Models\Booking') ->where(function ($query) { @@ -146,7 +150,6 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp })->name('fetch_pending_fill_po'); - Route::get('{booking_id}/fetch-model-attributes', function ($bookingId) { $booking = Booking::find($bookingId);