{{-- PHASE 3: INVESTIGATION & ROOT CAUSE --}} @php $investigation = $deviation->investigations->last(); @endphp

3 Investigation Plan

@if($investigation) {{ $investigation->status }} @endif
@if($investigation) @if($investigation->actual_completion_date) @endif
Owner{{ $investigation->owner?->name ?? '—' }}
Methodology{{ $investigation->methodology }}
Start{{ $investigation->start_date?->format('M j, Y') }}
Due {{ $investigation->due_date?->format('M j, Y') }} @if($investigation->isOverdue()) OVERDUE @endif
Completed{{ $investigation->actual_completion_date->format('M j, Y') }}
Plan{!! nl2br(e($investigation->investigation_plan)) !!}
Conclusion{{ $investigation->conclusion ?? '—' }}
Root Cause Verified @if($investigation->root_cause_verified) ✓ Verified by {{ $investigation->verifier?->name }} on {{ $investigation->root_cause_verified_at?->format('M j, Y') }} @else Pending @endif
@if($investigation->status !== 'COMPLETED')
@endif @else
No investigation plan created. Required for Gate 3.
@endif
@if($investigation) {{-- Findings --}}
Findings
@if($investigation->findings->isEmpty())
No findings recorded yet.
@else @foreach($investigation->findings as $f) @endforeach
Type Description Evidence Root Cause? Actions
{{ str_replace('_', ' ', $f->finding_type) }} {{ Str::limit($f->finding_description, 100) }} {{ Str::limit($f->evidence_reference, 40) ?? '—' }} {!! $f->related_to_root_cause ? 'Yes' : 'No' !!}
@csrf @method('DELETE')
@endif
{{-- Root Causes --}}
Root Cause Analysis
@if($investigation->rootCauses->isEmpty())
No root causes recorded. Confirmed root cause required for Gate 3.
@else @foreach($investigation->rootCauses as $rc)
{{ $rc->root_cause_type }} @if($rc->is_systemic) SYSTEMIC @endif
{{ $rc->rca_methodology_used ?? '—' }} v{{ $rc->verification_version }}

{{ $rc->root_cause_description }}

@if($rc->fiveWhys->isNotEmpty())
5-Whys Chain:
    @foreach($rc->fiveWhys as $why)
  1. Q: {{ $why->question }}
    A: {{ $why->answer }}
  2. @endforeach
@endif
@if($rc->confirmed_by) ✓ Confirmed by {{ $rc->confirmer?->name }} on {{ $rc->confirmed_date?->format('M j, Y') }} @else
@csrf
@endif
@csrf @method('DELETE')
@endforeach @endif
@endif
{{-- Modals --}} @include('deviations.partials.modals.investigation-modals', ['deviation' => $deviation, 'investigation' => $investigation]) @include('deviations.partials.modals.root-cause-modal', ['investigation' => $investigation])