{{-- Shared Waiting | In care board (GP Queue + specialty Queue homes). Expected vars: - $queue, $inConsultation (collections of Appointment) - $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 consultation") - $lockToPractitioner, $canSwitchBranch, $branches, $practitioners, $practitionerId (filter bar) - $showFilters (default true) --}} @php $canConsult = $canConsult ?? false; $showFilters = $showFilters ?? true; $inCareLabel = $inCareLabel ?? 'In consultation'; $startRouteName = $startRouteName ?? 'care.queue.start'; $openInCareUrl = $openInCareUrl ?? function ($appointment) { return $appointment->consultation ? route('care.consultations.show', $appointment->consultation) : null; }; $queueCallNextRoute = $queueCallNextRoute ?? null; $queueCallNextParams = $queueCallNextParams ?? []; @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 Showing patients 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, ]) @endif

Waiting ({{ $queue->count() }})

@forelse ($queue as $appointment)
($appointment->queue_ticket_status ?? null) === 'called', 'border-emerald-200 bg-emerald-50' => ($appointment->queue_ticket_status ?? null) === 'serving', 'border-slate-100 bg-slate-50' => ! in_array($appointment->queue_ticket_status ?? null, ['called', 'serving'], true), ])>
@if (! empty($queueIntegration['enabled']) && $appointment->queue_ticket_number) @include('care.partials.queue-ticket', [ 'ticketNumber' => $appointment->queue_ticket_number, 'ticketStatus' => $appointment->queue_ticket_status, 'destination' => $appointment->queue_destination, 'staffDisplayName' => $appointment->queue_staff_display_name, ]) @elseif (! empty($queueIntegration['enabled']) && ($appointment->queue_routing_status ?? '') === 'unresolved') Unassigned @elseif ($appointment->queue_position) {{ $appointment->queue_position }} @endif

{{ $appointment->patient?->fullName() ?? 'Patient' }}

{{ $appointment->patient?->patient_number ?? '—' }} · {{ $appointment->reason ?? '—' }}

@if (! empty($queueIntegration['enabled']) && $appointment->queue_ticket_uuid && in_array($appointment->queue_ticket_status ?? '', ['called', 'serving'], true) && $canConsult)
@csrf
@endif @if ($canConsult)
@csrf
@endif
@empty

No patients waiting.

@endforelse

{{ $inCareLabel }} ({{ $inConsultation->count() }})

@forelse ($inConsultation as $appointment)
@if (! empty($queueIntegration['enabled']) && $appointment->queue_ticket_number) @include('care.partials.queue-ticket', [ 'ticketNumber' => $appointment->queue_ticket_number, 'ticketStatus' => $appointment->queue_ticket_status, 'showAssignment' => false, ]) @endif

{{ $appointment->patient?->fullName() ?? 'Patient' }}

{{ $appointment->practitioner?->name ?? 'Unassigned' }}

@if (! empty($queueIntegration['enabled']) && $appointment->queue_ticket_uuid && in_array($appointment->queue_ticket_status ?? '', ['called', 'serving'], true) && $canConsult)
@csrf
@endif @php $openUrl = $openInCareUrl($appointment); @endphp @if ($openUrl) Open @endif
@empty

No active encounters.

@endforelse