{{-- Visit Lock Banner ───────────────── Renders a status banner at the top of a show page when the encounter is closed or temporarily unlocked. Renders nothing when the encounter is open (normal state). Usage: @include('partials._visit-lock-banner', [ 'entity' => $admission, // Visit | Admission | MaternityAdmission | AncRegistration 'type' => 'admission', // one of: visit, admission, maternity, anc ]) Variables exposed to the page after inclusion: $visitLockState → array from VisitLockService::stateFor() $isLocked → bool — use to hide edit controls on the page --}} @php $locks = app(\App\Services\VisitLockService::class); $visitLockState = $locks->stateFor($entity ?? null); $isLocked = $visitLockState['state'] === 'closed'; $isUnlocked = $visitLockState['state'] === 'unlocked'; $canUnlock = $locks->userCanUnlock(); $lockType = $type ?? 'visit'; $lockEntityId = $entity?->id ?? 0; @endphp @if($isLocked)

This encounter is {{ strtolower($visitLockState['label']) }} and is now read-only

@if($visitLockState['closed_at']) Closed on {{ \Carbon\Carbon::parse($visitLockState['closed_at'])->format('d M Y, H:i') }}. @endif No further changes to clinical notes, prescriptions, diagnoses, lab/imaging orders or billing are permitted until a Super Admin or Hospital Admin reactivates it.

@if($canUnlock)
@csrf
@endif
@endif @if($isUnlocked)

Encounter temporarily reactivated for editing

This {{ $visitLockState['closed_status'] }} encounter was reactivated @if($visitLockState['unlocked_at']) on {{ \Carbon\Carbon::parse($visitLockState['unlocked_at'])->format('d M Y, H:i') }}. @endif When the encounter is re-closed (discharge / complete), it will automatically lock again. All edits made while unlocked are audit-logged.

@if($canUnlock)
@csrf
@endif
@endif