Live Queue Status
Last updated: {{ now()->format('h:i A') }}
{{ $room['room_name'] ?? 'Room' }}
{{ $room['patient_category'] ?? 'Dental Queue' }}
@php $role = session('login_role'); $rolePath = $role === 'staff' ? 'staff' : 'student'; $portal = $role === 'staff' ? 'STAFF PORTAL' : 'STUDENT PORTAL'; $queuesByRoom = []; foreach ($rooms ?? [] as $room) { $queuesByRoom[$room['id']] = [ 'room' => $room, 'appointments' => [], ]; } foreach ($appointments ?? [] as $appt) { if (isset($queuesByRoom[$appt['room_id']])) { $queuesByRoom[$appt['room_id']]['appointments'][] = $appt; } } $myQueue = $myAppointment['queue_number'] ?? '-'; $myRoomId = $myAppointment['room_id'] ?? null; $nowServing = '-'; $waitingBefore = 0; $myRoomName = 'No appointment today'; if ($myRoomId && isset($queuesByRoom[$myRoomId])) { $roomQueue = $queuesByRoom[$myRoomId]['appointments']; $nowServing = $roomQueue[0]['queue_number'] ?? '-'; $myRoomName = $queuesByRoom[$myRoomId]['room']['room_name'] ?? 'Room assigned'; foreach ($roomQueue as $index => $appt) { if (($appt['id'] ?? '') === ($myAppointment['id'] ?? '')) { $waitingBefore = $index; break; } } } $estWait = $waitingBefore * 15; @endphp
Last updated: {{ now()->format('h:i A') }}
{{ $room['patient_category'] ?? 'Dental Queue' }}