{{-- Eye clinic on the main dashboard: each block only with its permission (App\Services\EyeClinicStats, dashboard-eye-*). --}} @if (!empty($eye)) @php $has = fn ($s) => in_array($s, $eye['sections']); $u = auth()->user(); $links = [ 'recalls' => $u->can('patient-eye_recall-view') ? route('patient_management.patient.eye_recall.worklist') : null, 'surgery' => $u->can('patient-eye_surgical-view') ? route('patient_management.patient.eye_surgical.worklist') : null, 'optical' => $u->can('appointment-eye_prescription-view') ? route('patient_management.appointment.eye_prescription.list') : null, ]; // [section, label, value, colour, icon, link] $tiles = []; if ($has('exams')) { $tiles[] = ['Eye exams today', $eye['exams_today'], 'primary', 'fa-eye', null]; $tiles[] = ['IOP readings today', $eye['iop_today'], 'info', 'fa-gauge-high', null]; } if ($has('recalls')) { $tiles[] = ['Recalls pending', $eye['recalls_pending'], 'warning', 'fa-calendar-check', $links['recalls']]; $tiles[] = ['Recalls missed', $eye['recalls_missed'], 'danger', 'fa-triangle-exclamation', $links['recalls']]; } if ($has('surgery')) { $tiles[] = ['Surgeries planned', $eye['surgeries_planned'], 'primary', 'fa-scissors', $links['surgery']]; } if ($has('optical')) { $tiles[] = ['Spectacle orders to confirm', $eye['orders_pending'], 'secondary', 'fa-cart-shopping', $links['optical']]; $tiles[] = ['Confirmed spectacle revenue', '$ ' . number_format($eye['confirmed_revenue'], 2), 'success', 'fa-sack-dollar', $links['optical']]; } if ($has('tests')) { $tiles[] = ['Diagnostic tests recorded', $eye['diagnostic_tests_count'], 'info', 'fa-vial-circle-check', null]; $tiles[] = ['Contact lens fittings', $eye['contact_lens_count'], 'primary', 'fa-glasses', null]; } $fmtDate = fn ($d) => $d ? \Carbon\Carbon::parse($d)->format('d M, Y') : '—'; @endphp
Eye clinic
@foreach ($tiles as [$label, $value, $color, $icon, $link])
{{ $label }}

{{ $value }}

@endforeach
@if ($has('recalls') || $has('surgery'))
@if ($has('recalls'))
Upcoming & overdue recalls
@if ($links['recalls'])Recall worklist@endif
@forelse ($eye['upcoming_recalls'] as $r) @empty @endforelse
PatientReasonDueStatus
{{ $r->Patient?->name }} ({{ $r->Patient?->patient_id }}) {{ ucwords(str_replace('_', ' ', $r->reason)) }} {{ $fmtDate($r->due_date) }} {{ ucfirst($r->status) }}
No upcoming or overdue recalls
@endif @if ($has('surgery'))
Planned surgeries
@if ($links['surgery'])Surgical list@endif
@forelse ($eye['upcoming_surgeries'] as $sp) @empty @endforelse
PatientEyeProcedureScheduled
{{ $sp->Patient?->name }} ({{ $sp->Patient?->patient_id }}) {{ $sp->eye }} {{ ucwords(str_replace('_', ' ', $sp->procedure_type)) }} {{ $fmtDate($sp->scheduled_date) }}
No planned surgeries
@endif
@endif @endif