From abf5ced6d7f0b444638f23ed052b4e1fe4d4cf38 Mon Sep 17 00:00:00 2001 From: twotalesanimation <80506065+twotalesanimation@users.noreply.github.com> Date: Sat, 3 Jan 2026 16:30:57 +0200 Subject: [PATCH] feat: show inspection actions on printing status and move to awaiting_collection on approval - Show inspection pass/fail buttons when order status is 'printing' in ops page - Updated getAvailableActions() to include 'printing' in inspection actions - Changed markInspectionPassed() to accept both 'inspection' and 'printing' statuses - Changed markInspectionPassed() to move order to 'awaiting_collection' instead of 'packing' - Updated flagInspectionIssue() to accept both 'inspection' and 'printing' statuses - Updated order-detail.blade.php conditional to show inspection actions for both 'inspection' and 'printing' statuses --- app/Http/Controllers/OpsController.php | 15 ++++++++------- resources/views/ops/order-detail.blade.php | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/OpsController.php b/app/Http/Controllers/OpsController.php index ea7570e..b8cfb5c 100644 --- a/app/Http/Controllers/OpsController.php +++ b/app/Http/Controllers/OpsController.php @@ -120,15 +120,15 @@ class OpsController extends Controller */ public function markInspectionPassed(Request $request, Order $order) { - if ($order->status !== 'inspection') { + if (! in_array($order->status, ['inspection', 'printing'])) { return response()->json([ - 'error' => 'Order is not in inspection state', + 'error' => 'Order is not in inspection or printing state', 'current_status' => $order->status, ], 409); } - // Update status - $order->update(['status' => 'packing']); + // Update status to awaiting_collection (move to inspected list in Trello) + $order->update(['status' => 'awaiting_collection']); Log::info('Inspection passed via QR', [ 'order_uuid' => $order->uuid, @@ -156,9 +156,9 @@ class OpsController extends Controller 'issue_description' => ['required', 'string', 'max:500'], ]); - if ($order->status !== 'inspection') { + if (! in_array($order->status, ['inspection', 'printing'])) { return response()->json([ - 'error' => 'Order is not in inspection state', + 'error' => 'Order is not in inspection or printing state', 'current_status' => $order->status, ], 409); } @@ -191,7 +191,7 @@ class OpsController extends Controller private function getAvailableActions(Order $order): array { return match ($order->status) { - 'inspection' => [ + 'inspection', 'printing' => [ 'markInspectionPassed' => true, 'flagInspectionIssue' => true, ], @@ -354,3 +354,4 @@ class OpsController extends Controller ], 500); } } +} \ No newline at end of file diff --git a/resources/views/ops/order-detail.blade.php b/resources/views/ops/order-detail.blade.php index 53b83fc..8929d00 100644 --- a/resources/views/ops/order-detail.blade.php +++ b/resources/views/ops/order-detail.blade.php @@ -31,9 +31,9 @@ - @if($order->status === 'inspection') + @if($order->status === 'inspection' || $order->status === 'printing') @include('ops.actions.inspection') - @elseif($order->status === 'packing' || $order->status === 'printing') + @elseif($order->status === 'packing') @include('ops.actions.packing') @elseif(in_array($order->status, ['ready_to_ship', 'awaiting_collection', 'in_transit'])) @include('ops.actions.read-only')