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:
@@ -120,15 +120,15 @@ class OpsController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function markInspectionPassed(Request $request, Order $order)
|
public function markInspectionPassed(Request $request, Order $order)
|
||||||
{
|
{
|
||||||
if ($order->status !== 'inspection') {
|
if (! in_array($order->status, ['inspection', 'printing'])) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'error' => 'Order is not in inspection state',
|
'error' => 'Order is not in inspection or printing state',
|
||||||
'current_status' => $order->status,
|
'current_status' => $order->status,
|
||||||
], 409);
|
], 409);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update status
|
// Update status to awaiting_collection (move to inspected list in Trello)
|
||||||
$order->update(['status' => 'packing']);
|
$order->update(['status' => 'awaiting_collection']);
|
||||||
|
|
||||||
Log::info('Inspection passed via QR', [
|
Log::info('Inspection passed via QR', [
|
||||||
'order_uuid' => $order->uuid,
|
'order_uuid' => $order->uuid,
|
||||||
@@ -156,9 +156,9 @@ class OpsController extends Controller
|
|||||||
'issue_description' => ['required', 'string', 'max:500'],
|
'issue_description' => ['required', 'string', 'max:500'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($order->status !== 'inspection') {
|
if (! in_array($order->status, ['inspection', 'printing'])) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'error' => 'Order is not in inspection state',
|
'error' => 'Order is not in inspection or printing state',
|
||||||
'current_status' => $order->status,
|
'current_status' => $order->status,
|
||||||
], 409);
|
], 409);
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ class OpsController extends Controller
|
|||||||
private function getAvailableActions(Order $order): array
|
private function getAvailableActions(Order $order): array
|
||||||
{
|
{
|
||||||
return match ($order->status) {
|
return match ($order->status) {
|
||||||
'inspection' => [
|
'inspection', 'printing' => [
|
||||||
'markInspectionPassed' => true,
|
'markInspectionPassed' => true,
|
||||||
'flagInspectionIssue' => true,
|
'flagInspectionIssue' => true,
|
||||||
],
|
],
|
||||||
@@ -354,3 +354,4 @@ class OpsController extends Controller
|
|||||||
], 500);
|
], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -31,9 +31,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- State-Specific Actions -->
|
<!-- State-Specific Actions -->
|
||||||
@if($order->status === 'inspection')
|
@if($order->status === 'inspection' || $order->status === 'printing')
|
||||||
@include('ops.actions.inspection')
|
@include('ops.actions.inspection')
|
||||||
@elseif($order->status === 'packing' || $order->status === 'printing')
|
@elseif($order->status === 'packing')
|
||||||
@include('ops.actions.packing')
|
@include('ops.actions.packing')
|
||||||
@elseif(in_array($order->status, ['ready_to_ship', 'awaiting_collection', 'in_transit']))
|
@elseif(in_array($order->status, ['ready_to_ship', 'awaiting_collection', 'in_transit']))
|
||||||
@include('ops.actions.read-only')
|
@include('ops.actions.read-only')
|
||||||
|
|||||||
Reference in New Issue
Block a user