@forelse($doctorQueues ?? [] as $queue)
@php
$appt = $queue['appointment'] ?? [];
$patient = $queue['patient'] ?? ($appt['patient'] ?? []);
$name = $patient['full_name'] ?? 'Unknown Patient';
$treatment = $appt['reason'] ?? 'Dental Treatment';
$time = !empty($appt['appointment_time']) ? date('g:i A', strtotime($appt['appointment_time'])) : '-';
$queueNo = $queue['queue_number'] ?? '-';
$queueStatus = strtolower($queue['status'] ?? ($queue['current_status'] ?? 'waiting'));
$rowClass = $queueStatus === 'active' ? 'active-row' : '';
@endphp
{{ $queueNo }}
{{ $name }}
{{ $treatment }} · {{ $time }}
{{ $queueStatus === 'done' ? 'Completed' : ucfirst($queueStatus) }}
@if($queueStatus === 'active')
Record Treatment
@elseif($queueStatus === 'waiting')
@endif
@empty
No patients in queue for today.
@endforelse
Current Patient
@if($currentQueue && $currentPatientProfile && $currentAppointmentId)
@php
$initial = strtoupper(substr($currentPatientProfile['full_name'] ?? 'P', 0, 1));
@endphp
{{ $initial }}
{{ $currentPatientProfile['full_name'] ?? '-' }}
{{ $currentPatientProfile['upsi_id'] ?? '-' }} · {{ $currentQueueNo }}
{{ $currentAppointment['reason'] ?? 'Dental Treatment' }}
@else
No patient currently serving.
@endif