Fix public display not showing queue stats and ticket data.
Deploy Ladill Queue / deploy (push) Successful in 43s

Server-render initial payload, poll with same-origin relative URLs, fall back to branch queues when none assigned, and improve contrast so stats remain visible if custom CSS is missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-29 22:51:29 +00:00
co-authored by Cursor
parent 2243ccf95a
commit 326769204d
5 changed files with 125 additions and 44 deletions
+32 -5
View File
@@ -27,10 +27,11 @@ class DisplayService
public function payload(DisplayScreen $screen): array
{
$screen->loadMissing(['branch', 'organization']);
$queueIds = $screen->service_queue_ids ?? [];
$queueIds = $this->resolveQueueIds($screen);
$queues = ServiceQueue::query()
->whereIn('id', $queueIds)
->where('is_active', true)
->orderBy('name')
->get();
$nowServing = Ticket::query()
@@ -44,7 +45,9 @@ class DisplayService
'ticket_number' => $t->ticket_number,
'queue_name' => $t->serviceQueue?->name,
'counter' => $t->counter?->name,
]);
])
->values()
->all();
$waiting = Ticket::query()
->whereIn('service_queue_id', $queueIds)
@@ -72,13 +75,37 @@ class DisplayService
'queues' => $queues->map(fn (ServiceQueue $q) => [
'name' => $q->name,
'prefix' => $q->prefix,
'is_paused' => $q->is_paused,
]),
'is_paused' => (bool) $q->is_paused,
])->values()->all(),
'announcements' => app(VoiceAnnouncementService::class)->pendingForBranch(
(int) $screen->branch_id,
array_map('intval', $screen->service_queue_ids ?? []),
$queueIds,
),
'updated_at' => now()->toIso8601String(),
];
}
/**
* @return list<int>
*/
protected function resolveQueueIds(DisplayScreen $screen): array
{
$ids = array_values(array_unique(array_filter(array_map(
fn ($id) => (int) $id,
$screen->service_queue_ids ?? [],
))));
if ($ids !== []) {
return $ids;
}
return ServiceQueue::query()
->where('organization_id', $screen->organization_id)
->when($screen->branch_id, fn ($query) => $query->where('branch_id', $screen->branch_id))
->where('is_active', true)
->orderBy('name')
->pluck('id')
->map(fn ($id) => (int) $id)
->all();
}
}