@extends('layouts.app') @section('title', 'Direct Encounters') @section('content') @php // Merge into one filterable collection so the per-status tabs work // from a single tbody (matches the OPD queue's pattern). $allRows = collect(); foreach ($atLab as $v) { $v->_stage = 'lab'; $allRows->push($v); } foreach ($atRadiology as $v) { $v->_stage = 'imaging'; $allRows->push($v); } foreach ($completed as $v) { $v->_stage = 'done'; $allRows->push($v); } @endphp @section('styles') @endsection {{-- Page Header --}}

Direct Encounters

Walk-in lab & imaging encounters · {{ now()->format('l, d M Y') }}

New Direct Lab New Direct Imaging
@if(session('success'))
{{ session('success') }}
@endif {{-- Carryover banner --}} @if(($stats['carryover'] ?? 0) > 0)
{{ $stats['carryover'] }} ongoing direct {{ $stats['carryover'] === 1 ? 'encounter was' : 'encounters were' }} opened on previous days. Complete or cancel them when appropriate.
@endif {{-- Stat strip --}}

At Lab

{{ $stats['at_lab'] }}

At Radiology

{{ $stats['at_radiology'] }}

Awaiting Payment

{{ $stats['awaiting_payment'] }}

Completed Today

{{ $stats['completed_today'] }}

{{-- Tab card --}}
@forelse($allRows as $v) @empty @endforelse
Visit # Patient Type Orders Payer Bill (KES) Check-in
{{ $v->visit_number }}

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

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

@if($v->visit_type === 'direct_lab') Direct Lab @else Direct Imaging @endif @php $orderCount = $v->visit_type === 'direct_lab' ? $v->labOrders->count() : $v->imagingRequests->count(); @endphp {{ $orderCount }} {{ $orderCount === 1 ? 'order' : 'orders' }} {{ $v->payment_mode }} @if($v->invoice) {{ number_format($v->invoice->total_amount) }} @if($v->invoice->balance > 0) · KES {{ number_format($v->invoice->balance) }} due @endif @else @endif {{ optional($v->check_in_at)->format('d M, H:i') }} View →
No direct encounters in scope.
@push('scripts') @endpush @endsection