@extends('layouts.app') @section('title', 'Completed ANC Visits') @section('content') @include('partials._encounter-styles') {{-- Scoped table-header restyle + simplifications (May 14 2026): • Stats cards strip removed — the table itself + the date-range filter cover the same information without the visual weight. • Section-head "1 Completed Visits — 10 visit(s)" row removed — the page title at the top already labels the content, and the pagination "Showing X of Y" line confirms the count. The numbered prefix only made sense when there were multiple sections on the page. • Table thead made grey (was CR-purple via the shared enc-table partial); scoped to .anc-completed-page so no other page that uses enc-table is affected. --}}
{{-- ═══ HEADER ═══ Same pattern as visits/opd.blade.php and visits/completed.blade.php (added 25 May 2026): title + subheading on the left, back/return button on the top right. Uses the standard Tailwind classes instead of the bespoke .enc-page styling so the three "lifetime" list pages (OPD live, OPD completed, ANC completed) look identical at the header level. --}}

Completed ANC Visits

Lifetime Visits

Back to Active Queue
{{-- Stats cards strip removed May 14 2026 — see header comment. --}} {{-- ═══ FILTERS ═══ --}}
{{-- 25 May 2026: "Search" and "Date Range" labels above the inputs were removed. Placeholder text + the calendar icon on each date picker already convey what each field is for, and the labels added a header row that the other visits-list pages don't have. --}}
to
@if(request()->hasAny(['search','date_from','date_to']))
Clear
@endif
{{-- ═══ VISITS TABLE ═══ --}}
{{-- Section header row ("1 Completed Visits — 10 visit(s)") removed May 14 2026. Page title above + pagination footer already convey what this is and how many. --}}
{{-- Column set: Date · Patient · Age/Sex · Phone · Bill Total · Payer · Next Appointment · Actions. Department and Clinician were dropped on 25 May 2026 — completed ANC visits all sit in Maternity by definition, so the Department column was repeating the same value on every row, and the Clinician was already visible on the encounter page itself. --}} @forelse($visits as $v) @php // Next appointment is stored on the AncVisit record // that's linked to this Visit. The relation is // eager-loaded in the controller so this doesn't // hit the database per-row. Falls back to the // patient's active ANC registration's next_visit_date // if the AncVisit row didn't carry one (older data). $nextAppt = $v->ancVisit?->next_visit_date; if (! $nextAppt) { $activeReg = \App\Models\AncRegistration::where('patient_id', $v->patient_id) ->where('status', 'active')->first(); $nextAppt = $activeReg?->next_visit_date; } @endphp @empty @endforelse
Date Patient Age / Sex Phone Bill Total Payer Next Appointment Actions
{{ $v->check_out_at?->format('d M Y') ?? $v->check_in_at?->format('d M Y') ?? '—' }}

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

{{ $v->patient->age ?? '' }} / {{ ucfirst(substr($v->patient->gender ?? '', 0, 1)) }} {{ $v->patient->phone ?? '—' }} @if($v->invoice) KES {{ number_format($v->invoice?->total_amount ?? 0) }} @if(($v->invoice?->balance ?? 0) > 0)
Bal: {{ number_format($v->invoice?->balance) }}@endif @else - @endif
{{ $v->payer_label }} @if($nextAppt) {{-- Highlight if the next appointment is in the past — the patient is overdue and reception should follow up. --}} @php $isOverdue = $nextAppt < \Carbon\Carbon::today(); @endphp {{ $nextAppt->format('d M Y') }} @if($isOverdue)
Overdue@endif @else @endif
Profile

No completed ANC visits match your filters.

@if(request()->hasAny(['search','date_from','date_to'])) Clear filters → @endif
@if($visits->hasPages())
{{ $visits->links() }}
@endif
{{-- /.enc-page --}} @endsection