Add service-point routing so call-next cannot steal assigned tickets.
Deploy Ladill Queue / deploy (push) Successful in 2m17s
Deploy Ladill Queue / deploy (push) Successful in 2m17s
Counters gain destination/staff metadata; tickets can be pre-assigned to a service point with assigned_only queues for healthcare while shared_pool preserves generic bank/government behavior. Display and announcements expose ticket, staff, and destination clearly for Care and public boards. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,6 +11,12 @@ class TicketPresenter
|
||||
*/
|
||||
public static function toArray(Ticket $ticket, bool $includeQr = true): array
|
||||
{
|
||||
$ticket->loadMissing(['serviceQueue', 'counter', 'assignedCounter']);
|
||||
|
||||
$serving = $ticket->counter;
|
||||
$assigned = $ticket->assignedCounter;
|
||||
$point = $serving ?? $assigned;
|
||||
|
||||
return [
|
||||
'uuid' => $ticket->uuid,
|
||||
'ticket_number' => $ticket->ticket_number,
|
||||
@@ -28,13 +34,46 @@ class TicketPresenter
|
||||
'name' => $ticket->serviceQueue->name,
|
||||
'prefix' => $ticket->serviceQueue->prefix,
|
||||
'color' => $ticket->serviceQueue->color,
|
||||
'routing_mode' => $ticket->serviceQueue->routingMode(),
|
||||
] : null,
|
||||
'counter' => $ticket->counter ? [
|
||||
'uuid' => $ticket->counter->uuid,
|
||||
'name' => $ticket->counter->name,
|
||||
] : null,
|
||||
'counter' => $serving ? self::serializePoint($serving) : null,
|
||||
'assigned_counter' => $assigned ? self::serializePoint($assigned) : null,
|
||||
'destination' => $point?->displayDestination(),
|
||||
'staff_display_name' => $point?->staff_display_name,
|
||||
'announcement_text' => self::announcementText($ticket, $point),
|
||||
'track_url' => $includeQr ? route('qms.mobile.show', $ticket->qr_token) : null,
|
||||
'barcode' => $ticket->barcode,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function serializePoint(\App\Models\Counter $counter): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $counter->uuid,
|
||||
'name' => $counter->name,
|
||||
'destination' => $counter->displayDestination(),
|
||||
'staff_ref' => $counter->staff_ref,
|
||||
'staff_display_name' => $counter->staff_display_name,
|
||||
'code' => $counter->code,
|
||||
];
|
||||
}
|
||||
|
||||
public static function announcementText(Ticket $ticket, ?\App\Models\Counter $point): ?string
|
||||
{
|
||||
if (! $point) {
|
||||
return $ticket->ticket_number;
|
||||
}
|
||||
|
||||
$parts = array_values(array_filter([
|
||||
$ticket->ticket_number,
|
||||
$point->staff_display_name ?: null,
|
||||
$ticket->serviceQueue?->name,
|
||||
$point->displayDestination(),
|
||||
]));
|
||||
|
||||
return implode(', ', $parts);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user