@extends('layouts.app') @section('title', 'Borstal Institutions') @section('content')
{{-- Page guide: what this screen is for --}}
Borstal Institution Management. Manage Borstal institutions: register facilities with capacity and category, track vacancies, allocate residents with escorting officers and next-station time-limits, raise accommodation/emergency alerts, and discharge.

Borstal Institution Management

{{ $records->total() }} allocation(s) · {{ $institutions->count() }} institution(s)
Residents appear here automatically once admitted through Reception Documentation with category Borstal — nothing to allocate manually. Assign an institution below for anyone still unassigned.
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- Hardware readiness (req 14.1 g) --}}
Hardware: CCTV {!! $hardware['cctv'] ? 'connected' : 'pending' !!}  ·  Access control {!! $hardware['access_control'] ? 'connected' : 'pending' !!} Software workflow is live; device monitoring activates automatically once readers are connected.
{{-- Institutions + vacancy (req 14.1 a, c, d) --}}
@forelse($institutions as $inst)
{{ $inst->name }}
{{ $inst->status }}
{{ $inst->category }} · {{ $inst->location ?? '—' }}
@php $pct = $inst->capacity > 0 ? round($inst->occupied / $inst->capacity * 100) : 0; @endphp
{{ $pct }}%
Occupied {{ $inst->occupied }} / {{ $inst->capacity }} · {{ $inst->vacancy }} vacant
CCTV Access
@empty
No Borstal institutions registered yet.
@endforelse
{{-- Allocations --}}
Current Allocations
@forelse($records as $r) @empty @endforelse
ResidentInstitutionBlock Escorting officerNext stationStatus Actions
{{ optional($r->prisoner)->name ?? '—' }}
{{ optional($r->prisoner)->prisoner_number }}
@if ($r->institution) {{ $r->institution->name }} @else Unassigned @endif {{ $r->accommodation_block ?? '—' }} {{ $r->escorting_officer ?? '—' }} {{ $r->next_station ?? '—' }} @if($r->station_overdue)overdue@endif {{ $r->status }} @if($r->status !== 'Discharged') @if (!$r->borstal_institution_id) @can('prison.borstal.action') @endcan @endif @can('prison.borstal.action')
@csrf
@endcan @can('prison.borstal.action')
@csrf
@endcan @else {{ optional($r->discharge_date)->format('d M Y') }} @endif
No allocations yet.
{{ $records->withQueryString()->links() }}
{{-- Register-institution modal (req 14.1 c) --}} @endsection