Filter now-serving to the latest called/serving ticket per destination so historical calls no longer crowd the public board, and scale ticket cards so numbers no longer clip destination text. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -34,19 +34,25 @@ class DisplayService
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
// One active ticket per destination (counter). Older called/serving
|
||||
// tickets at the same window must not crowd the public board.
|
||||
$nowServing = Ticket::query()
|
||||
->whereIn('service_queue_id', $queueIds)
|
||||
->whereIn('status', ['called', 'serving'])
|
||||
->with(['counter', 'serviceQueue'])
|
||||
->orderByDesc('called_at')
|
||||
->limit(12)
|
||||
->limit(48)
|
||||
->get()
|
||||
->unique(fn (Ticket $t) => $t->counter_id
|
||||
? 'counter:'.$t->counter_id
|
||||
: 'queue:'.$t->service_queue_id)
|
||||
->take(12)
|
||||
->values()
|
||||
->map(fn (Ticket $t) => [
|
||||
'ticket_number' => $t->ticket_number,
|
||||
'queue_name' => $t->serviceQueue?->name,
|
||||
'counter' => $t->counter?->name,
|
||||
])
|
||||
->values()
|
||||
->all();
|
||||
|
||||
$waiting = Ticket::query()
|
||||
|
||||
Reference in New Issue
Block a user