@php $doctorName = $doctor['full_name'] ?? 'Doctor'; $displayDoctorName = str_starts_with($doctorName, 'Dr.') ? $doctorName : 'Dr. ' . $doctorName; $roomName = $room['room_name'] ?? 'Dental Room 1'; $currentQueue = $currentQueue ?? null; $currentAppointment = $currentQueue['appointment'] ?? null; $currentPatientProfile = $currentQueue['patient'] ?? null; $currentQueueNo = $currentQueue['queue_number'] ?? '-'; $currentPatientName = $currentPatientProfile['full_name'] ?? 'No patient currently serving'; $currentAppointmentId = $currentAppointment['id'] ?? null; $nextQueueNo = $nextQueue['queue_number'] ?? '-'; $nextPatientName = $nextQueue['patient']['full_name'] ?? '-'; $todayPatients = $todayPatients ?? 0; $completedToday = $completedToday ?? 0; $inQueue = $waitingCount ?? 0; $followUpsPending = $followUpsPending ?? 0; @endphp Doctor Dashboard

Doctor Dashboard

{{ now()->format('D, d M Y') }}
🔔
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif
WELCOME BACK 👋

{{ $displayDoctorName }}

Dental Officer · {{ $roomName }}

Currently Serving

{{ $currentQueueNo }}

{{ $roomName }} · {{ $currentPatientName }}

Next Queue: {{ $nextQueueNo }} {{ $nextPatientName !== '-' ? '· '.$nextPatientName : '' }}

Today's Patient Queue — {{ $roomName }}

Call Next →
@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')
@csrf
@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