{{-- Residency tab Hostel: vacancy request → approval → availability → confirmation · admission · stay · exit / transfer Halfway: application (form upload) → accept / decline · admission · stay (incl. breach of house rules) · exit / transfer Borstal: vacancy request → approval → institution feedback → confirmation --}} @php $isHalfway = $residency === 'halfway_house'; $isBorstal = $residency === 'borstal'; $vStatus = config('probation_workflow.vacancy_statuses'); $canApprove = auth()->user()->isSuperAdmin() || auth()->user()->isBranchAdmin(); $res = $isHalfway ? $case->halfwayResidency : ($isBorstal ? null : $case->hostelResidency); $vacancies = $isBorstal ? $case->borstalVacancies : $case->hostelVacancies; $badge = ['requested' => 'bg-warning text-dark', 'approved' => 'bg-info text-dark', 'available' => 'bg-success', 'not_available' => 'bg-danger', 'confirmed' => 'bg-primary', 'applied' => 'bg-warning text-dark', 'accepted' => 'bg-success', 'declined' => 'bg-danger']; $ymd = fn ($d) => $d ? \Carbon\Carbon::parse($d)->format('Y-m-d') : ''; @endphp
{{-- STEP 1: vacancy / application --}}
@if($isHalfway)
1 · Application for admission
@forelse($case->halfwayApplications as $ap)
{{ $ap->house_name ?? 'Halfway house' }} {{ ucfirst($ap->status) }} · {{ $ap->created_at->format('d M Y') }} @if($ap->application_form_path)· application form@endif @if($ap->decision_notes)
{{ $ap->decision_notes }}
@endif @if($ap->status === 'applied' && $canApprove)
@csrf
@endif
@empty

No application yet.

@endforelse
@csrf
@else
1 · {{ $isBorstal ? 'Borstal institution vacancy' : 'Application for a vacancy' }}
@forelse($vacancies as $v)
{{ $v->institution ?? $v->hostel_name ?? '—' }} {{ $vStatus[$v->status] ?? ucfirst($v->status) }} · requested {{ optional($v->requested_on)->format('d M Y') }} @if($v->confirmed_on) · confirmed {{ $v->confirmed_on->format('d M Y') }}@endif @if($v->feedback)
{{ $v->feedback }}
@endif @if($v->status !== 'confirmed')
@csrf
@endif
@empty

No vacancy request yet.

@endforelse
@csrf
@unless($isBorstal)
@endunless
@unless($isBorstal)The application / confirmation letters are in Reports (PACS formats).@endunless
@endif
@unless($isBorstal) {{-- STEP 2: admission --}}
2 · Admission
@if($res)
Admitted
{{ optional($res->admission_date)->format('d M Y') }}{{ $res->arrival_time ? ' at ' . substr($res->arrival_time, 0, 5) : '' }}
Full body screening
{{ $res->body_screened ? 'Done' : 'Not recorded' }}
Period
{{ optional($res->period_start ?? $res->admission_date)->format('d M Y') }} – {{ optional($res->period_end)->format('d M Y') ?? '—' }} @if($res->period_start && $res->period_end) ({{ \App\Support\SupervisionLedger::period($res->period_start, $res->period_end) }})@endif @if($res->extended_to)
Extended to {{ \Carbon\Carbon::parse($res->extended_to)->format('d M Y') }}@endif
Items issued
{{ $res->items_issued ?? '—' }}
Documents
@if($res->escort_document_path ?? null)escort documents @endif @if($res->admission_form_path)admission form@endif @if(!($res->escort_document_path ?? null) && !$res->admission_form_path)—@endif
Status
{{ ucfirst($res->status) }}
@else
@csrf
@if($isHalfway)@else@endif
@unless($isHalfway)
@endunless
@unless($isHalfway)
@endunless
Then update PR 2 under Supervision.
@endif
@if($res) {{-- STEP 3: stay --}}
3 · Stay
@csrf
oriented ? 'checked' : '' }}>
@if($isHalfway)
Breach of house rules
@endif
Supervision notes, intensity, plans and interventions are under Supervision / Interventions.
{{-- STEP 4: exit --}}
4 · Exit
@if($res->exit_date)

Exited {{ \Carbon\Carbon::parse($res->exit_date)->format('d M Y') }} · {{ ucfirst($res->status) }}

@if($res->items_returned)

Items returned: {{ $res->items_returned }}

@endif @else
@csrf
@if($isHalfway)
@else
@endif
@endif
@endif @endunless