{{-- resources/views/probation/cases/_supervision_ledger.blade.php Central Supervision Ledger entry for this case. The row preview is exactly how the case appears in the ledger; the form captures the columns the case does not already hold (all others come from the Case Ledger fields above, Supervision and Completion). --}} @php $ledgerKey = \App\Support\SupervisionLedger::forCaseType($case->case_type); @endphp @if($ledgerKey && $ledgerKey !== 'referrals') @php $row = \App\Support\SupervisionLedger::row($case, $ledgerKey); $columns = \App\Support\SupervisionLedger::columns($ledgerKey); $flat = []; foreach ($columns as [$label, $spec]) { if (is_array($spec)) { foreach ($spec as [$sl, $sk]) $flat[] = [$label . ' – ' . $sl, $sk]; } else { $flat[] = [$label, $spec]; } } $first = $case->supervisionOrders->sortBy('start_date')->first(); $latest = $case->supervisionOrders->sortByDesc('id')->first(); $ymd = fn ($d) => $d ? \Carbon\Carbon::parse($d)->format('Y-m-d') : ''; $h = $case->hostelResidency; $title = \App\Support\SupervisionLedger::LEDGERS[$ledgerKey][1]; @endphp
{{ $title }} @php $ledgerRoute = ['probation_orders' => 'probation-orders', 'cso' => 'community-service', 'aftercare' => 'aftercare', 'hostels' => 'hostels'][$ledgerKey]; @endphp Open ledger
{{-- how this case reads in the ledger --}}
@foreach(array_chunk($flat, 4) as $chunk) @foreach($chunk as [$lbl, $k]) @php $val = in_array($k, ['sat', 'unsat', 'abs'], true) ? ($row[$k] ? '✓' : '') : ($row[$k] ?? ''); @endphp @endforeach @endforeach
{{ $lbl }} {{ $val === '' || $val === null ? 'N/A' : $val }}
N/A = not applicable / not yet entered. Fill it from the form below, the Case Ledger fields above, or the Completion tab.
@csrf @if($ledgerKey === 'hostels')
@else @if($ledgerKey === 'aftercare')
@endif
@if($ledgerKey !== 'aftercare')
@endif
@endif
Nature of completion (Satisfactory / Unsatisfactory / Absconded) comes from the Completion tab.
@endif