feat: Move Trello card to Packing when inspection is passed
- Create InspectionPassed event - Create MoveCardToPackingOnInspectionPassed listener - Register event listener in EventServiceProvider - Dispatch event when markInspectionPassed() is called Now when an order passes inspection on the ops page, the Trello card automatically moves from Inspection to Packing list.
This commit is contained in:
@@ -119,7 +119,7 @@ class OpsController extends Controller
|
||||
], 409);
|
||||
}
|
||||
|
||||
// Update status and emit event
|
||||
// Update status
|
||||
$order->update(['status' => 'packing']);
|
||||
|
||||
Log::info('Inspection passed via QR', [
|
||||
@@ -127,8 +127,8 @@ class OpsController extends Controller
|
||||
'marked_by' => auth()->user()->name,
|
||||
]);
|
||||
|
||||
// Emit event for listeners to handle Slack/Trello updates
|
||||
// TODO: Create InspectionPassed event
|
||||
// Emit event to trigger Slack/Trello updates
|
||||
\App\Events\InspectionPassed::dispatch($order);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
|
||||
@@ -106,15 +106,25 @@ class TrelloWebhookController extends Controller
|
||||
|
||||
// Handle list-specific actions
|
||||
match ($listName) {
|
||||
'Prep' => $order->update(['status' => 'prep']),
|
||||
'Printing' => $order->update(['status' => 'printing']),
|
||||
'Inspection' => $order->update(['status' => 'inspection']),
|
||||
'Packing' => $order->update(['status' => 'packing']),
|
||||
'Ready to Ship' => $this->handleReadyToShipIntent($order, $cardId),
|
||||
'Awaiting Collection' => $this->handleAwaitingCollectionIntent($order, $cardId),
|
||||
'In Transit' => Log::info('Card in transit', ['order_uuid' => $order->uuid]),
|
||||
'Done' => Log::info('Card completed', ['order_uuid' => $order->uuid]),
|
||||
'In Transit' => $order->update(['status' => 'in_transit']),
|
||||
'Done' => $order->update(['status' => 'completed']),
|
||||
default => Log::debug('Card moved to list', [
|
||||
'order_uuid' => $order->uuid,
|
||||
'list' => $listName,
|
||||
]),
|
||||
};
|
||||
|
||||
Log::info('Order status updated from Trello', [
|
||||
'order_uuid' => $order->uuid,
|
||||
'list' => $listName,
|
||||
'status' => $order->status,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user