@extends('layouts.master') @section('title', $title) @section('content')
{{-- Visit lists at a glance — click a card to pick visits from it (unpaid lists: financial users only). --}}
@foreach ($cards as $key => $card)
{{ $card['label'] }}

{{ number_format($card['count']) }}

@if ($list === $key) @endif
@endforeach
{{-- only the views this user may see (visit-record-medical / -financial) --}} @if (count($view_modes) === 1) @endif
@if (!isset($visit))
Pick a visit above, then Apply, to see everything about it here.
@else @php $p = $visit->Patient; $fmtDate = fn($d) => $d ? \Carbon\Carbon::parse($d)->format('d M, Y') : null; $money = fn($v) => '$ ' . number_format((float) $v, 2); $m = $medical ?? null; $f = $financial ?? null; $c = $m['consult'] ?? null; $sections = collect([ 'billing' => ['Financial summary', 'ti-cash', $f ? $f['items']->count() : 0], 'statement' => ['Bills', 'ti-file-invoice', $f ? $f['items']->count() : 0], 'consult' => ['Consultation', 'ti-stethoscope', $c ? 1 : 0], 'vitals' => ['Vital signs', 'ti-heartbeat', $m ? $m['vitals']->count() : 0], 'labs' => ['Laboratory & results', 'ti-microscope', $m ? $m['labs']->count() : 0], 'images' => ['Imaging', 'ti-photo', $m ? $m['images']->count() : 0], 'pres' => ['Prescriptions', 'ti-pill', $m ? $m['prescriptions']->count() : 0], 'services' => ['Services', 'ti-bell', $m ? $m['services']->count() : 0], 'operations' => ['Operations', 'ti-scissors', $m ? $m['operations']->count() : 0], ])->filter(fn($s) => $s[2] > 0); $head = fn($key) => '
' . e($sections[$key][0]) . '
' . $sections[$key][2] . ' ' . ($sections[$key][2] == 1 ? 'entry' : 'entries') . '
'; $kvt = function (array $pairs) { $pairs = array_filter($pairs, fn ($v) => $v !== null && trim((string) $v) !== ''); if (!$pairs) { return '
Nothing recorded.
'; } $cells = []; foreach ($pairs as $l => $v) { $cells[] = '' . e($l) . '' . e($v) . ''; } return '' . collect($cells)->chunk(2)->map(fn ($c) => '' . $c->implode('') . ($c->count() < 2 ? '' : '') . '')->implode('') . '
'; }; $pill = fn($status) => '' . e($status ?: 'Pending') . ''; @endphp
@if (!empty($canPay)) @endif @endif @if (isset($visit) && !empty($f)) {{-- the bill as an 80mm POS slip (Print bill → POS) --}} @include('partials.pos_bill', [ 'posTitle' => 'Visit bill', 'posInfo' => ['Visit No' => $visit->appointment_no ?: $visit->id, 'Date' => \Carbon\Carbon::parse($visit->date)->format('d M, Y'), 'Patient' => $visit->Patient?->name . ($visit->Patient?->patient_id ? ' (' . $visit->Patient->patient_id . ')' : ''), 'Doctor' => $visit->dr?->name], 'posLines' => $f['items']->filter(fn ($i) => $i['charge'] > 0.009)->map(fn ($i) => [$i['label'], $i['charge']])->values()->all(), 'posTotals' => $f['total'], ]) @endif @endsection @section('page_js') @endsection