@php $user = auth()->user(); $bedlessOptions = $bedlessAdmissions ->mapWithKeys(fn ($a) => [ $a->id => ($a->patient?->full_name ?? 'Unknown patient').' · '.$a->patient?->medical_record_number.' · '.$a->admission_no, ]) ->all(); $tileTint = [ 'available' => 'border-emerald-200 bg-emerald-50/50', 'occupied' => 'border-slate-200 bg-white', 'reserved' => 'border-indigo-200 bg-indigo-50/50', 'cleaning' => 'border-amber-200 bg-amber-50/50', 'maintenance' => 'border-orange-200 bg-orange-50/50', 'blocked' => 'border-red-200 bg-red-50/50', ]; $statTone = [ 'available' => 'green', 'occupied' => 'blue', 'reserved' => 'indigo', 'cleaning' => 'amber', 'maintenance' => 'red', 'blocked' => 'slate', ]; $statIcon = [ 'available' => 'check', 'occupied' => 'bed', 'reserved' => 'clock', 'cleaning' => 'refresh', 'maintenance' => 'cog', 'blocked' => 'lock', ]; @endphp @can('admissions.view') Ward board @endcan @can('admissions.create') Admit patient @endcan
@foreach (['available', 'occupied', 'reserved', 'cleaning', 'maintenance', 'blocked'] as $state) @endforeach
@if ($bedlessAdmissions->isNotEmpty())
@foreach ($bedlessAdmissions as $admission) @endforeach
Patient Admission Ward they came to Waiting since
{{ $admission->patient?->full_name ?? 'Unknown patient' }} {{ $admission->patient?->medical_record_number }} @if ($admission->patient?->isRestricted()) @endif {{ $admission->admission_no }}
{{ $admission->ward?->name ?? '—' }} {{ $admission->admission_date?->format('d M Y H:i') }}
@endif
@if (request()->filled('ward')) Clear @endif
@forelse ($wards as $ward) @php $wardBeds = $ward->rooms->flatMap(fn ($room) => $room->beds); $wardTotal = $wardBeds->count(); $wardOccupied = $wardBeds->where('status', 'occupied')->count(); $wardFree = $wardBeds->where('status', 'available')->count(); $pct = $wardTotal > 0 ? (int) round($wardOccupied * 100 / $wardTotal) : 0; @endphp @if ($ward->is_critical_care) Critical care @endif @if ($ward->gender_restriction !== 'none') @endif
Occupancy {{ $pct }}% · {{ $wardFree }} free
@forelse ($ward->rooms as $room)

Room {{ $room->room_number }}

@if ($room->is_isolation) Isolation @endif @if ($room->has_attached_bathroom) Ensuite @endif {{ $room->beds->count() }} of {{ $room->capacity }} beds placed
@if ($room->beds->isEmpty())

No beds placed in this room yet.

@else
@foreach ($room->beds as $bed) @php $patient = $bed->currentAdmission?->patient; $patientVisible = $patient && $patient->isVisibleTo($user); @endphp
{{ $bed->bed_number }}
@unless ($bed->is_active) Inactive @endunless
{{ money($bed->charge_per_day) }}/day @if ($bed->has_oxygen_point) O₂ @endif @if ($bed->has_suction) Suct @endif @if ($bed->has_ventilator) Vent @endif @if ($bed->has_monitor) Mon @endif
@if ($bed->currentAdmission) @if ($patientVisible)
@can('admissions.view') {{ $patient->full_name }} @else {{ $patient->full_name }} @endcan {{ $patient->medical_record_number }}
@else
Restricted patient
@endif @elseif ($bed->last_cleaned_at)

Cleaned {{ $bed->last_cleaned_at->diffForHumans() }}

@endif @if ($bed->currentAdmission === null && $bed->is_active) @if ($canManage)
@csrf @method('PATCH')
@endif @if ($canAssign && $bed->status === 'available' && $bedlessAdmissions->isNotEmpty())
@csrf @method('PATCH') @if ($ward->gender_restriction !== 'none')

{{ $ward->name }} takes {{ $ward->gender_restriction }} patients only.

@endif
@endif @endif
@endforeach
@endif
@empty Rooms and beds are laid out by a system administrator under Hospital setup. @endforelse
@empty Wards, rooms and beds are laid out by a system administrator under Hospital setup. @endforelse