@extends('layouts.app') @section('title', 'ANC Visit · ' . ($visit->visit_number ?? '')) @section('content') @include('partials._encounter-styles') {{-- Read-only ANC Visit view. Issue #3 (May 3 2026): Completed ANC Visits used to link to maternity.anc.show, which calls ensureAncBackingVisit() and silently spawns a new in-flight encounter. Wrong behavior for "View Visit" buttons. This page replaces it for historical viewing — no state mutation, no draft creation, just a clean read-only render of one completed ANC encounter. Controller: MaternityController::ancVisitView --}} @php $patient = $visit->patient; $hasAncVisit = $ancVisit !== null; $diagArr = optional($visit->consultation)->diagnosis; $diagDisplay = is_array($diagArr) ? implode(', ', array_filter($diagArr)) : (string) ($diagArr ?? ''); @endphp
{{-- ═══ HEADER + BACK LINK ═══ --}}
← Back to Completed Visits · {{ $visit->visit_number }}
{{-- ═══ READ-ONLY BANNER ═══ --}}

Read-only view of a completed ANC visit

No edits possible from this page. To start a new visit, use the active ANC queue.

{{-- ═══ PATIENT HEADER CARD ═══ --}}

{{ $patient->full_name ?? '—' }} {{ $patient->mrn ?? '' }}

{{ ucfirst($patient->gender ?? '—') }} · {{ $patient->age ?? '—' }} yrs · {{ $patient->phone ?? '—' }}

Visit Date

{{ $visit->check_in_at?->format('d M Y, H:i') ?? $visit->created_at->format('d M Y, H:i') }}

Clinician

{{ optional($visit->clinician)->name ?? '—' }}

Completed

{{ $visit->check_out_at?->format('d M Y, H:i') ?? '—' }}

{{ ucfirst($visit->status) }}
{{-- ═══ ANC OBSTETRIC SUMMARY ═══ --}} @if($hasAncVisit)

Obstetric Summary

@if($ancVisit->risk_level === 'high') HIGH RISK @elseif($ancVisit->risk_level === 'moderate') MODERATE RISK @elseif($ancVisit->risk_level === 'low') LOW RISK @endif

Gestational Age

{{ $ancVisit->gestational_age_weeks ?? '—' }} weeks

Blood Pressure

{{ $ancVisit->bp_display ?? $ancVisit->blood_pressure ?? '—' }}

Weight

{{ $ancVisit->weight ?? '—' }} kg

Fetal Heart Rate

{{ $ancVisit->fetal_heart_rate ?? '—' }}

Hemoglobin

{{ $ancVisit->hemoglobin ?? '—' }}

Next Visit

{{ $ancVisit->next_visit_date?->format('d M Y') ?? '—' }}

@if($ancVisit->complaints || $ancVisit->assessment || $ancVisit->plan)
@if($ancVisit->complaints)
Complaints
{{ $ancVisit->complaints }}
@endif @if($ancVisit->assessment)
Assessment
{{ $ancVisit->assessment }}
@endif @if($ancVisit->plan)
Plan
{{ $ancVisit->plan }}
@endif
@endif @if(is_array($ancVisit->danger_signs) && count($ancVisit->danger_signs))

⚠ Danger signs recorded

{{ implode(', ', $ancVisit->danger_signs) }}

@endif @php $given = array_filter([ 'IFAS' => $ancVisit->ifas_issued, 'TT' => $ancVisit->tt_given, 'IPTp-SP' => $ancVisit->iptp_given, 'Deworming' => $ancVisit->deworming_given, 'ITN' => $ancVisit->itn_issued, ]); @endphp @if(count($given))

Items Given / Administered

@foreach(array_keys($given) as $g) {{ $g }} @endforeach
@endif @if($ancVisit->referred)

REFERRED

@if($ancVisit->referral_reason)

{{ $ancVisit->referral_reason }}

@endif
@endif @if($ancVisit->health_education_given)
Health Education Given
{{ $ancVisit->health_education_given }}
@endif
@endif {{-- ═══ CONSULTATION (if recorded) ═══ --}} @if($visit->consultation)

Consultation

@if($visit->consultation->presenting_complaints)
Chief Complaint
{{ $visit->consultation->presenting_complaints }}
@endif @if($visit->consultation->history_of_presenting_illness)
Clinical Notes / History
{{ $visit->consultation->history_of_presenting_illness }}
@endif
@if($visit->consultation->examination_findings)
Examination Findings
{{ $visit->consultation->examination_findings }}
@endif @if($visit->consultation->treatment_plan)
Treatment Plan
{{ $visit->consultation->treatment_plan }}
@endif
@if($diagDisplay !== '')
Diagnosis
{{ $diagDisplay }}
@endif
@endif {{-- ═══ LAB ORDERS ═══ --}} @if($visit->labOrders->count())

Laboratory Tests

{{ $visit->labOrders->count() }} order(s)
@foreach($visit->labOrders as $o) @endforeach
Test Status Result
{{ $o->test_name ?? '—' }} {{ ucfirst(str_replace('_', ' ', $o->status)) }} @if($o->result && $o->result->status === 'validated') Validated @elseif($o->result) Pending validation @else No result on file @endif
@endif {{-- ═══ IMAGING REQUESTS ═══ --}} @if($visit->imagingRequests->count())

Imaging

{{ $visit->imagingRequests->count() }} request(s)
@foreach($visit->imagingRequests as $ir) @endforeach
Imaging Type Indication Status
{{ $ir->imaging_type }} {{ $ir->clinical_indication ?? '—' }} {{ ucfirst($ir->status) }}
@endif {{-- ═══ PRESCRIPTIONS ═══ --}} @if($visit->prescriptions->count())

Prescriptions

{{ $visit->prescriptions->count() }} item(s)
@foreach($visit->prescriptions as $rx) @endforeach
Drug Dosage Frequency Duration Status
{{ $rx->drug_name ?? optional($rx->drugItem)->name ?? '—' }} {{ $rx->dosage ?? '—' }} {{ $rx->frequency ?? '—' }} {{ $rx->duration ?? '—' }} {{ ucfirst($rx->status ?? '—') }}
@endif {{-- ═══ INVOICE ═══ --}} @if($visit->invoice)

Invoice

{{ $visit->invoice->invoice_number }}

Total

KES {{ number_format($visit->invoice->total_amount ?? 0) }}

Paid

KES {{ number_format($visit->invoice->amount_paid ?? 0) }}

Balance

KES {{ number_format($visit->invoice->balance ?? 0) }}

Payment Mode

{{ $visit->payment_mode ?? '—' }}

@endif {{-- ═══ FOOTER LINKS ═══ --}}
Patient Profile Back to Completed Visits
{{-- /.enc-page --}} @endsection