{{-- ═══════════════════════════════════════════════════════════════════════ ENCOUNTER PATIENT HEADER Usage: @include('partials._encounter-patient-header', [ 'visit' => $visit, 'title' => 'Update Visit', 'readOnly' => $readOnly ?? false, 'showPatientActions' => true, ]) ═══════════════════════════════════════════════════════════════════════ --}} @php $_patient = $visit->patient ?? null; $_title = $title ?? 'Update Visit'; $_ro = $readOnly ?? false; $_totalVisits = 0; if ($_patient) { $_totalVisits = \App\Models\Visit::where('patient_id', $_patient->id)->count(); } $_lastVisit = null; if ($_patient) { $_lastVisit = \App\Models\Visit::where('patient_id', $_patient->id) ->where('id', '!=', $visit->id ?? 0) ->orderByDesc('check_in_at') ->first(); } $_openBalance = $_patient?->outstanding_balance ?? 0; $_allergies = $_patient->allergies ?? []; @endphp

{{ $_title }}

{{ $_patient->full_name ?? '' }}
Patient # {{ $_patient->mrn ?? '-' }}
Age {{ $_patient->age ?? '-' }} {{ is_numeric($_patient->age ?? null) ? 'yrs' : '' }}
@if($_patient && $_patient->gender)
Sex {{ ucfirst($_patient->gender) }}
@endif @if(!empty($showPatientActions) && $showPatientActions) Patient Info / Appointments → @endif
Total Visits {{ $_totalVisits }}
Last Visit {{ $_lastVisit?->check_in_at?->format('d M Y') ?? '—' }}
Open Balance KES {{ number_format($_openBalance) }}
@if(!empty($_allergies) && is_array($_allergies) && count($_allergies))
⚠ Allergies: {{ implode(', ', $_allergies) }}
@endif @if($_ro)
{{ $visit->check_out_at ? 'Closed ' . $visit->check_out_at->format('d M Y H:i') : 'This visit is closed.' }} · View-only mode.
@endif