{{-- resources/views/probation/cases/_assessments.blade.php Assessments tab — RNR (latest Risk Needs Assessment – Adults tool, PR 2) and PK-RAVET captured item by item; CAGE-AID / MSE / SNO keep the short form. Tool definitions: config/probation_assessments.php --}} @php $rnr = config('probation_assessments.RNR'); $pk = config('probation_assessments.PKRAVET'); $lvl = ['Low' => 'Low', 'Medium' => 'Medium', 'High' => 'High']; // Prefill: the most recent saved RNR / PK-RAVET for this case $lastRnr = $case->assessments->where('tool', 'RNR')->sortByDesc('id')->first(); $lastPk = $case->assessments->where('tool', 'PKRAVET')->sortByDesc('id')->first(); $lr = optional($lastRnr)->responses ?? []; $lp = optional($lastPk)->responses ?? []; $yn = fn ($v) => $v === 'Y'; @endphp
Risk & Needs Assessments
@forelse($case->assessments->sortByDesc('assessed_on') as $a) @php $r = $a->responses ?? []; @endphp
{{ $a->tool }} — {{ $a->category }}
{{ optional($a->assessed_on)->format('d M Y') }} @if($a->static_risk_level) · Static: {{ $a->static_risk_level }}@endif @if($a->dynamic_risk_level) · Dynamic: {{ $a->dynamic_risk_level }}@endif @if($a->needs_identified) · {{ $a->needs_identified }}@endif
@if($a->criminogenic_factors)
{{ $a->tool === 'PKRAVET' ? 'Risk management' : 'Risk areas' }}: {{ $a->criminogenic_factors }}
@endif
{{ $a->risk_level ?? '—' }} @if($r)
details@endif
@if($r)
@if($a->tool === 'RNR')
Static risk: {{ $r['static_yes'] ?? 0 }} Yes answer(s) → {{ $a->static_risk_level }} @if(!empty($r['static_comments']))
{{ $r['static_comments'] }}@endif
@foreach($rnr['dynamic'] as $dk => $dd) @php $f = $r['domain_flags'][$dk] ?? 'none'; @endphp @endforeach
Dynamic domainIndicationSummaryComments
{{ $dd['title'] }} {{ ['none' => 'No risk', 'may' => 'May indicate risk', 'risk' => 'Risk'][$f] ?? $f }} {{ $r['summary'][$dk] ?? '—' }} {{ $r['domain_comments'][$dk] ?? '' }}
@elseif($a->tool === 'PKRAVET')
Purpose: {{ collect($r['purposes'] ?? [])->map(fn ($p) => $pk['purposes'][$p] ?? $p)->implode(', ') ?: '—' }} @if(!empty($r['purpose_other'])) ({{ $r['purpose_other'] }})@endif
@foreach($pk['sections'] as $sk => $sd) @php $sec = $r['sections'][$sk] ?? []; @endphp
{{ $sd['title'] }} — level: {{ $pk['ratings'][$sec['level'] ?? ''] ?? '—' }} @php $hi = collect($sec['items'] ?? [])->filter(fn ($v) => in_array($v, ['medium', 'high'])); @endphp @if($hi->count())
    @foreach($hi as $i => $v)
  • {{ $sd['items'][$i] ?? '' }} — {{ $pk['ratings'][$v] }}
  • @endforeach
@endif @if(!empty($sec['protective']))
Protective: {{ $sec['protective'] }}
@endif @if(!empty($sec['comments']))
PO's comments: {{ $sec['comments'] }}
@endif
@endforeach
Risk of self harm: {{ ucfirst($r['self_harm'] ?? '—') }} · Risk for staff: {{ ucfirst($r['risk_to_staff'] ?? '—') }} @if(!empty($r['other_intervention']))
Other intervention: {{ $r['other_intervention'] }}@endif
@endif @if($a->comments)
PO's comment: {{ $a->comments }}
@endif
@endif
@empty

No assessment yet.

@endforelse
{{-- ================= RNR ================= --}}
@if($lastRnr)
Answers loaded from the RNR assessment of {{ optional($lastRnr->assessed_on)->format('d M Y') }}. Change what is different — saving keeps the earlier one in the history above.
@endif
@csrf
{{ $rnr['static']['title'] }} (Static risk)
@foreach($rnr['static']['items'] as $k => $t) @php $y = $yn($lr['static'][$k] ?? 'N'); @endphp @endforeach
ItemYN
{{ $t }}
{{ $rnr['static']['rule'] }}
Dynamic Risk
@foreach($rnr['dynamic'] as $dk => $dd)

@foreach($dd['items'] as $n => $it) @php $y = $yn($lr['dynamic'][$dk][$it['key']] ?? 'N'); @endphp @endforeach
{{ $n + 1 }}. {{ $it['text'] }}
{{ $dd['rule'] }}
@endforeach
{{-- ---------- Assessment — entered by the officer (no automatic classification) ---------- --}}
Assessment
@foreach($rnr['dynamic'] as $dk => $dd) @php $saved = $lr['summary'][$dk] ?? null; @endphp @endforeach
Dynamic risk areaRisk (Y/N)
{{ $dd['title'] }}
Classify the risk using the guidance printed under each section of the tool.
refer_specialist ? 'checked' : '' }}>
{{-- ================= PK-RAVET ================= --}}
@if($lastPk)
Answers loaded from the PK-RAVET assessment of {{ optional($lastPk->assessed_on)->format('d M Y') }}.
@endif @php $pPurposes = $lp['purposes'] ?? []; $pPlan = $lp['risk_management'] ?? []; @endphp
@csrf
Purpose of the assessment
@foreach($pk['purposes'] as $v => $l)
@endforeach
@foreach($pk['sections'] as $sk => $sd) @php $sec = $lp['sections'][$sk] ?? []; @endphp
{{ $sd['title'] }}
@foreach($pk['ratings'] as $rv => $rl)@endforeach @foreach($sd['items'] as $i => $text) @php $cur = $sec['items'][$i] ?? 'na'; @endphp @foreach($pk['ratings'] as $rv => $rl) @endforeach @endforeach @foreach($pk['ratings'] as $rv => $rl) @endforeach
Item{{ $rl }}
{{ $i + 1 }}. {{ $text }}
{{ $sd['level'] }}
@endforeach
Set by the officer.
Risk management
@foreach($pk['risk_management'] as $v => $l)
@endforeach
Are there signs for the risk for self harm?
Are there signs for the risk for staff?
{{-- ================= short tools ================= --}}
@csrf