{{-- Shared patient-flow board (GP Queue + specialty Queue homes). Expected vars: - $queue, $inConsultation (collections of Appointment) - $done (optional — completed today) - $queueIntegration, $branchId - $canConsult (bool) - $queueCallNextRoute, $queueCallNextParams (optional — if set, Call next renders above board) - $startRouteName (default care.queue.start) — route(name, $appointment) - $openInCareUrl (callable Appointment $a): ?string — link for in-care Open - $inCareLabel (default "In care") - $lockToPractitioner, $canSwitchBranch, $branches, $practitioners, $practitionerId (filter bar) - $showFilters (default true) --}} @php $canConsult = $canConsult ?? false; $showFilters = $showFilters ?? true; $inCareLabel = $inCareLabel ?? 'In care'; $startRouteName = $startRouteName ?? 'care.queue.start'; $openInCareUrl = $openInCareUrl ?? function ($appointment) { return $appointment->consultation ? route('care.consultations.show', $appointment->consultation) : null; }; $queueCallNextRoute = $queueCallNextRoute ?? null; $queueCallNextParams = $queueCallNextParams ?? []; $done = $done ?? collect(); $calledStatuses = ['called', 'serving']; $waitingList = $queue->reject( fn ($a) => in_array($a->queue_ticket_status ?? '', $calledStatuses, true) )->values(); $calledList = $queue->filter( fn ($a) => in_array($a->queue_ticket_status ?? '', $calledStatuses, true) )->values(); $stages = [ [ 'key' => 'waiting', 'label' => 'Waiting', 'count' => $waitingList->count(), 'items' => $waitingList, 'empty' => 'No patients waiting.', 'accent' => 'text-slate-500', 'dot' => 'bg-slate-400', ], [ 'key' => 'called', 'label' => 'Called', 'count' => $calledList->count(), 'items' => $calledList, 'empty' => 'No one called yet.', 'accent' => 'text-indigo-600', 'dot' => 'bg-indigo-500', ], [ 'key' => 'in_care', 'label' => $inCareLabel, 'count' => $inConsultation->count(), 'items' => $inConsultation, 'empty' => 'No active encounters.', 'accent' => 'text-emerald-700', 'dot' => 'bg-emerald-500', ], [ 'key' => 'done', 'label' => 'Done', 'count' => $done->count(), 'items' => $done, 'empty' => 'None completed today.', 'accent' => 'text-slate-400', 'dot' => 'bg-slate-300', ], ]; @endphp @if ($showFilters)
@if ($lockToPractitioner ?? false) @if (($canSwitchBranch ?? false) && isset($branches) && $branches->count() > 1) @elseif (isset($branches) && $branches->isNotEmpty()) {{ $branches->first()->name }} @elseif (! empty($branchLabel)) {{ $branchLabel }} @endif Assigned to you @elseif ($canSwitchBranch ?? false) @else @if (isset($branches) && $branches->isNotEmpty()) {{ $branches->first()->name }} @elseif (! empty($branchLabel)) {{ $branchLabel }} @endif @if (isset($practitioners)) @endif @endif
@endif
@if ($queueCallNextRoute)
@include('care.partials.queue-ops', [ 'queueIntegration' => $queueIntegration ?? null, 'queueCallNextRoute' => $queueCallNextRoute, 'queueCallNextParams' => $queueCallNextParams, 'branchId' => $branchId ?? null, 'variant' => 'bar', ]) @if (empty($queueIntegration['enabled']))

Start patients from the waiting column when they arrive at your desk.

@endif
@endif
@foreach ($stages as $index => $stage)
$index < count($stages) - 1, ])>

{{ $stage['label'] }}

{{ $stage['count'] }}
@forelse ($stage['items'] as $appointment) @include('care.partials.queue-board-card', [ 'appointment' => $appointment, 'stage' => $stage['key'], 'canConsult' => $canConsult, 'queueIntegration' => $queueIntegration ?? null, 'startRouteName' => $startRouteName, 'openInCareUrl' => $openInCareUrl, ]) @empty

{{ $stage['empty'] }}

@endforelse
@endforeach