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
This commit is contained in:
twotalesanimation
2026-01-03 16:30:57 +02:00
parent 2a10f9af38
commit abf5ced6d7
2 changed files with 10 additions and 9 deletions
+8 -7
View File
@@ -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);
}
}
}