{{-- PHASE 5: EFFECTIVENESS & CLOSURE --}}
@php $closure = $deviation->closure; @endphp
Closed on {{ $closure->closure_date?->format('M j, Y') }}
— status: {{ $closure->final_status }}
5
Effectiveness Check & Closure
Record Closed
@else
{{-- Prerequisites checklist --}}
@if($closure->closure_notes)
Justification {!! nl2br(e($closure->closure_justification)) !!}
@endif
Notes {!! nl2br(e($closure->closure_notes)) !!} Approved By {{ $closure->approver?->name ?? '—' }} Closure Prerequisites
@php
$prereqs = [
'All actions completed' =>
$deviation->actions()->whereNotIn('status', ['COMPLETED','VERIFIED'])->count() === 0,
'CAPA linked' =>
$deviation->capaLinkages()->where('is_active', true)->count() > 0,
'Root cause verified' =>
$deviation->investigations->flatMap->rootCauses->whereNotNull('confirmed_by')->isNotEmpty(),
'Impact assessment complete' =>
$deviation->impact && $deviation->impact->items->isNotEmpty(),
];
@endphp
@foreach($prereqs as $label => $met)
@if(collect($prereqs)->every(fn($v) => $v))