@extends('layouts.app') @section('title', 'Completed Visits') @section('content') @include('partials._queue-routing-helper') {{-- May 24 2026 rewrite: The Completed page now mirrors the OPD landing page column-for- column so reception sees a consistent table layout when they toggle between the two views. The only structural difference is: 1. First column is "Date Completed" (check_out_at) instead of "Date" (check_in_at). Same column, different meaning per the user's spec. 2. An Actions column on the right exposes the Reopen button (admin-only) that doesn't exist on the live OPD view. Type / MRN / Age-Sex / Phone columns were dropped to bring the layout in line with the OPD landing. MRN was also dropped from the OPD landing on the same day — see the note in opd.blade.php for the trade-off. --}} {{-- ── Page header ────────────────────────────────────────────────── Title + subtitle on the left, Return to Today's Visits button on the top right. Mirrors the header on visits/opd.blade.php so the two pages have parity when reception toggles between them. --}}

Completed Visits

Lifetime Visits

Return to Today's Visits
{{-- Header row: filter form + visit count --}}
@if(request('type'))@endif
to
@if(request()->hasAny(['search','date_from','date_to','clinician','type'])) Clear @endif
{{-- The Return to Today's Visits button moved up to the page header (25 May 2026) — only the visit count remains here on the right side of the filter bar. --}}
{{ $visits->total() }} visit(s)
{{-- Unified columns across the four visits-list pages (25 May 2026): Date · Patient · Age/Sex · Phone · Department · Bill Total · Payer · Clinician. The Actions column is only on this completed page because it carries the admin-only Reopen button. --}} @if(auth()->user()->hasAnyRole('Super Admin', 'Hospital Admin')) @endif @forelse($visits as $v) {{-- Row click opens the completed encounter (read-only view). Reopen sits inside a so the row-click handler ignores clicks on it. --}} @if(auth()->user()->hasAnyRole('Super Admin', 'Hospital Admin')) @endif @empty @endforelse
Date Patient Age / Sex Phone Department Bill Total Payer ClinicianActions
{{ $v->check_out_at ? $v->check_out_at->format('Y-m-d') : '-' }}

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

{{ $v->patient->age ?? '' }} / {{ ucfirst(substr($v->patient->gender ?? '', 0, 1)) }} {{ $v->patient->phone ?? '' }} {{ $v->department->name ?? '-' }} @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 }} {{ $v->clinician->name ?? '-' }} {{-- Reopen is admin-only. The wrapper means the row-click handler ignores clicks here. --}} @csrf
No completed visits found for this period.
@if($visits->hasPages())
{{ $visits->links() }}
@endif

Completed visits are read-only. Reopen requires admin permission.

@endsection