@php $alertCount = $workload['alerts']; @endphp {{ $workload['cards'] }} card{{ $workload['cards'] === 1 ? '' : 's' }} on the board @can('observations.view') Observation charts @if ($alertCount) {{ $alertCount }} @endif @endcan
@if ($term !== '' || $selectedWard) Reset @endif
@if ($byWard->isEmpty()) @if ($term !== '' || $selectedWard) Nothing matches that filter. Every admitted patient with an open kardex card would appear here. @else Nobody is currently admitted — the board fills as patients come in through admissions. @endif @else @foreach ($byWard as $wardName => $group)

{{ $wardName }}

{{ $group->count() }} patient{{ $group->count() === 1 ? '' : 's' }} · acuity {{ $group->sum(fn ($a) => $a->nursingKardex?->acuity_level ?? 0) }}
@foreach ($group as $admission) @php $kardexCard = $admission->nursingKardex; $acuity = $kardexCard?->acuity_level; $acuityPalette = [ 'green' => 'bg-emerald-50 text-emerald-700 ring-emerald-200', 'blue' => 'bg-blue-50 text-blue-700 ring-blue-200', 'amber' => 'bg-amber-50 text-amber-800 ring-amber-200', 'orange' => 'bg-orange-50 text-orange-700 ring-orange-200', 'red' => 'bg-red-50 text-red-700 ring-red-200', 'gray' => 'bg-slate-100 text-slate-600 ring-slate-200', ][$kardexCard?->acuity_color ?? 'gray']; @endphp

{{ $admission->patient?->full_name }}

{{ $admission->patient?->medical_record_number }} · {{ $admission->admission_no }}

{{ $acuity ?? '–' }}

@if ($admission->bed) Bed {{ $admission->bed->bed_number }} @if ($admission->room) · Room {{ $admission->room->room_number }} @endif @else Awaiting a bed @endif · Dr {{ $admission->attendingDoctor?->name ?? '—' }}

@if ($admission->is_icu) ICU @endif @if ($kardexCard) @else Card not opened @endif @if ($admission->has_ews_alert) EWS @endif
@if ($kardexCard?->assignedNurse) Nurse {{ $kardexCard->assignedNurse->name }} @else No nurse assigned @endif @if ($admission->last_observed_at) Obs {{ \Illuminate\Support\Carbon::parse($admission->last_observed_at)->diffForHumans(short: true) }} @else No observations yet @endif
@endforeach
@endforeach @endif