Add full Ambulance and Child Welfare specialty clinical suites.
Deploy Ladill Care / deploy (push) Successful in 54s

EMS clinic workflow (dispatch → scene → transport → handover) plus completed CWC suite, with shell stages, clinical records, reports/print, demo seed, and suite tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-19 22:25:52 +00:00
co-authored by Cursor
parent 8c18ecc5c9
commit c0e5d8ef00
32 changed files with 2672 additions and 22 deletions
@@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ambulance summary · {{ $patient->fullName() }}</title>
<style>
body { font-family: system-ui, sans-serif; color: #0f172a; margin: 2rem; }
h1 { font-size: 1.25rem; margin: 0 0 .25rem; }
h2 { font-size: .95rem; margin: 1.25rem 0 .5rem; border-bottom: 1px solid #e2e8f0; padding-bottom: .25rem; }
.meta { color: #64748b; font-size: .875rem; }
dl { display: grid; grid-template-columns: 10rem 1fr; gap: .35rem .75rem; font-size: .875rem; }
dt { color: #64748b; }
dd { margin: 0; font-weight: 500; }
@media print { .no-print { display: none; } }
</style>
</head>
<body>
<p class="no-print"><a href="{{ route('care.specialty.workspace', ['module' => 'ambulance', 'visit' => $visit]) }}">Back</a></p>
<h1>{{ $patient->fullName() }}</h1>
<p class="meta">
{{ $patient->patient_number }}
· Visit #{{ $visit->id }}
· Stage {{ $visit->specialty_stage ?? '—' }}
· {{ $visit->checked_in_at?->format('d M Y H:i') ?? '—' }}
</p>
<h2>Dispatch</h2>
@if ($dispatch)
<dl>
<dt>Call nature</dt><dd>{{ $dispatch->payload['call_nature'] ?? '—' }}</dd>
<dt>Priority</dt><dd>{{ $dispatch->payload['priority'] ?? '—' }}</dd>
<dt>Location</dt><dd>{{ $dispatch->payload['location'] ?? '—' }}</dd>
<dt>Crew</dt><dd>{{ $dispatch->payload['crew'] ?? '—' }}</dd>
<dt>Vehicle</dt><dd>{{ $dispatch->payload['vehicle'] ?? '—' }}</dd>
<dt>Notes</dt><dd>{{ $dispatch->payload['dispatch_notes'] ?? '—' }}</dd>
</dl>
@else
<p class="meta">No dispatch recorded.</p>
@endif
<h2>Scene / triage</h2>
@if ($scene)
<dl>
<dt>Complaint</dt><dd>{{ $scene->payload['chief_complaint'] ?? '—' }}</dd>
<dt>Acuity</dt><dd>{{ $scene->payload['acuity'] ?? '—' }}</dd>
<dt>Findings</dt><dd>{{ $scene->payload['scene_findings'] ?? '—' }}</dd>
<dt>Vitals</dt><dd>{{ $scene->payload['vitals_summary'] ?? '—' }}</dd>
<dt>GCS</dt><dd>{{ $scene->payload['gcs'] ?? '—' }}</dd>
</dl>
@else
<p class="meta">No scene assessment recorded.</p>
@endif
<h2>En-route care</h2>
@if ($enRoute)
<dl>
<dt>Destination</dt><dd>{{ $enRoute->payload['destination'] ?? '—' }}</dd>
<dt>Interventions</dt><dd>{{ $enRoute->payload['interventions'] ?? '—' }}</dd>
<dt>Medications</dt><dd>{{ $enRoute->payload['medications'] ?? '—' }}</dd>
<dt>Response</dt><dd>{{ $enRoute->payload['response_to_treatment'] ?? '—' }}</dd>
</dl>
@else
<p class="meta">No en-route care recorded.</p>
@endif
<h2>Handover</h2>
@if ($handover)
<dl>
<dt>Facility</dt><dd>{{ $handover->payload['receiving_facility'] ?? '—' }}</dd>
<dt>Clinician</dt><dd>{{ $handover->payload['receiving_clinician'] ?? '—' }}</dd>
<dt>Summary</dt><dd>{{ $handover->payload['handover_summary'] ?? '—' }}</dd>
<dt>Outcome</dt><dd>{{ $handover->payload['outcome'] ?? '—' }}</dd>
<dt>Pathway</dt><dd>{{ $handover->payload['time_critical'] ?? '—' }}</dd>
</dl>
@else
<p class="meta">No handover recorded.</p>
@endif
<script>window.print();</script>
</body>
</html>
@@ -0,0 +1,88 @@
<x-app-layout title="Ambulance reports">
<div class="space-y-6">
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<h1 class="text-xl font-semibold text-slate-900">Ambulance reports</h1>
<p class="mt-1 text-sm text-slate-500">Arrivals, urgent open runs, call nature, handover outcomes, length of stay, and ambulance revenue.</p>
</div>
<a href="{{ route('care.specialty.show', 'ambulance') }}" class="text-sm font-medium text-indigo-600"> Specialty home</a>
</div>
<form method="GET" class="flex flex-wrap items-end gap-3 rounded-2xl border border-slate-200 bg-white p-4">
<div>
<label class="block text-xs font-medium text-slate-600">From</label>
<input type="date" name="from" value="{{ $report['from'] ?? '' }}" class="mt-1 rounded-xl border border-slate-200 px-3 py-2 text-sm">
</div>
<div>
<label class="block text-xs font-medium text-slate-600">To</label>
<input type="date" name="to" value="{{ $report['to'] ?? '' }}" class="mt-1 rounded-xl border border-slate-200 px-3 py-2 text-sm">
</div>
<button type="submit" class="rounded-xl bg-indigo-600 px-4 py-2 text-sm font-semibold text-white">Apply</button>
</form>
<div class="grid gap-4 sm:grid-cols-4">
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Arrivals today</p>
<p class="mt-2 text-2xl font-semibold tabular-nums text-slate-900">{{ number_format($report['arrivals_today']) }}</p>
</div>
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Completed today</p>
<p class="mt-2 text-2xl font-semibold tabular-nums text-slate-900">{{ number_format($report['completed_today']) }}</p>
</div>
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Urgent open</p>
<p class="mt-2 text-2xl font-semibold tabular-nums text-rose-700">{{ number_format($report['urgent_open']) }}</p>
</div>
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Avg LOS (range)</p>
<p class="mt-2 text-2xl font-semibold tabular-nums text-slate-900">
{{ $report['avg_los_minutes'] !== null ? $report['avg_los_minutes'].' min' : '—' }}
</p>
</div>
</div>
<div class="grid gap-4 lg:grid-cols-2">
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<h2 class="text-sm font-semibold text-slate-900">Call nature</h2>
<ul class="mt-3 space-y-2 text-sm">
@forelse ($report['call_nature_breakdown'] as $row)
<li class="flex justify-between gap-3">
<span>{{ $row['call_nature'] }}</span>
<span class="tabular-nums text-slate-600">{{ $row['total'] }}</span>
</li>
@empty
<li class="text-slate-500">No dispatches in range.</li>
@endforelse
</ul>
</section>
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<h2 class="text-sm font-semibold text-slate-900">Handover outcomes</h2>
<ul class="mt-3 space-y-2 text-sm">
@forelse ($report['outcome_breakdown'] as $row)
<li class="flex justify-between gap-3">
<span>{{ $row['outcome'] }}</span>
<span class="tabular-nums text-slate-600">{{ $row['total'] }}</span>
</li>
@empty
<li class="text-slate-500">No handovers in range.</li>
@endforelse
</ul>
</section>
</div>
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<h2 class="text-sm font-semibold text-slate-900">Ambulance service revenue</h2>
<ul class="mt-3 space-y-2 text-sm">
@forelse ($report['revenue_by_service'] as $row)
<li class="flex justify-between gap-3">
<span>{{ $row->description }} <span class="text-slate-400">×{{ $row->total }}</span></span>
<span class="tabular-nums">{{ $currency }} {{ number_format($row->amount_minor / 100, 2) }}</span>
</li>
@empty
<li class="text-slate-500">No billed ambulance services in range.</li>
@endforelse
</ul>
</section>
</div>
</x-app-layout>
@@ -0,0 +1,70 @@
@php
$record = $ambulanceHandover;
$payload = $record?->payload ?? [];
$canManage = $canManageClinical ?? $canConsult ?? false;
@endphp
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<div class="flex flex-wrap items-start justify-between gap-3">
<div>
<h3 class="text-sm font-semibold text-slate-900">Facility handover</h3>
<p class="mt-0.5 text-xs text-slate-500">Completed handovers can close the ambulance visit.</p>
</div>
<a href="{{ route('care.specialty.ambulance.print', $workspaceVisit) }}" target="_blank" class="text-sm font-medium text-indigo-600">Print summary</a>
</div>
@if ($canManage)
<form method="POST" action="{{ route('care.specialty.ambulance.handover', $workspaceVisit) }}" class="mt-4 space-y-4">
@csrf
<input type="hidden" name="tab" value="handover">
<div class="grid gap-3 sm:grid-cols-2">
@foreach ($clinicalFields ?? [] as $field)
@php
$name = $field['name'];
$value = old('payload.'.$name, $payload[$name] ?? '');
$type = $field['type'] ?? 'text';
@endphp
<div @class(['sm:col-span-2' => in_array($type, ['textarea'], true)])>
<label class="block text-xs font-medium text-slate-600">
{{ $field['label'] }}
@if (! empty($field['required'])) <span class="text-rose-600">*</span> @endif
</label>
@if ($type === 'textarea')
<textarea name="payload[{{ $name }}]" rows="{{ $field['rows'] ?? 3 }}" @required(! empty($field['required']))
class="mt-1 w-full rounded-xl border border-slate-200 px-3 py-2 text-sm">{{ $value }}</textarea>
@elseif ($type === 'select')
<select name="payload[{{ $name }}]" @required(! empty($field['required']))
class="mt-1 w-full rounded-xl border border-slate-200 px-3 py-2 text-sm">
<option value="">Select…</option>
@foreach ($field['options'] ?? [] as $option)
<option value="{{ $option }}" @selected((string) $value === (string) $option)>{{ $option }}</option>
@endforeach
</select>
@elseif ($type === 'boolean')
<label class="mt-2 inline-flex items-center gap-2 text-sm text-slate-700">
<input type="checkbox" name="payload[{{ $name }}]" value="1" @checked(old('payload.'.$name, ! empty($payload[$name])))>
Yes
</label>
@else
<input type="{{ $type === 'number' ? 'number' : 'text' }}" name="payload[{{ $name }}]" value="{{ $value }}"
@required(! empty($field['required']))
class="mt-1 w-full rounded-xl border border-slate-200 px-3 py-2 text-sm">
@endif
</div>
@endforeach
</div>
<button type="submit" class="btn-primary">Save handover</button>
</form>
@elseif ($record)
<dl class="mt-4 grid gap-3 text-sm sm:grid-cols-2">
@foreach ($clinicalFields ?? [] as $field)
<div>
<dt class="text-slate-500">{{ $field['label'] }}</dt>
<dd class="font-medium text-slate-900">{{ $payload[$field['name']] ?? '—' }}</dd>
</div>
@endforeach
</dl>
@else
<p class="mt-4 text-sm text-slate-500">No handover recorded yet.</p>
@endif
</section>
@@ -0,0 +1,72 @@
@php
$dispatch = $ambulanceDispatch?->payload ?? [];
$scene = $ambulanceScene?->payload ?? [];
$enRoute = $ambulanceEnRoute?->payload ?? [];
$handover = $ambulanceHandover?->payload ?? [];
@endphp
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<div class="flex flex-wrap items-start justify-between gap-3">
<div>
<h3 class="text-sm font-semibold text-slate-900">Ambulance overview</h3>
<p class="mt-0.5 text-xs text-slate-500">Dispatch, scene triage, en-route care, and facility handover for this run.</p>
</div>
<div class="flex flex-wrap gap-3 text-sm">
<a href="{{ route('care.specialty.ambulance.print', $workspaceVisit) }}" target="_blank" class="font-medium text-indigo-600">Print summary</a>
<a href="{{ route('care.specialty.ambulance.reports') }}" class="font-medium text-indigo-600">Ambulance reports</a>
</div>
</div>
<div class="mt-4 grid gap-3 sm:grid-cols-3">
<div class="rounded-xl border border-slate-100 bg-slate-50 px-3 py-3">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Call</p>
<p class="mt-1 text-sm font-semibold text-slate-900">{{ $dispatch['call_nature'] ?? '—' }}</p>
<p class="mt-1 text-xs text-slate-500">Priority {{ $dispatch['priority'] ?? '—' }}</p>
</div>
<div class="rounded-xl border border-slate-100 bg-slate-50 px-3 py-3">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Scene</p>
<p class="mt-1 text-sm font-semibold text-slate-900">{{ $scene['chief_complaint'] ?? '—' }}</p>
<p class="mt-1 text-xs text-slate-500">Acuity {{ $scene['acuity'] ?? '—' }}</p>
</div>
<div class="rounded-xl border border-slate-100 bg-slate-50 px-3 py-3">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Destination / handover</p>
<p class="mt-1 text-sm font-semibold text-slate-900">{{ $enRoute['destination'] ?? ($handover['receiving_facility'] ?? 'Not set') }}</p>
<p class="mt-1 text-xs text-slate-500">{{ $handover['outcome'] ?? '—' }}</p>
</div>
</div>
<dl class="mt-4 grid gap-3 text-sm sm:grid-cols-2">
<div>
<dt class="text-slate-500">Location</dt>
<dd class="font-medium text-slate-900">{{ $dispatch['location'] ?? '—' }}</dd>
</div>
<div>
<dt class="text-slate-500">En-route interventions</dt>
<dd class="font-medium text-slate-900">{{ \Illuminate\Support\Str::limit($enRoute['interventions'] ?? '—', 80) }}</dd>
</div>
<div>
<dt class="text-slate-500">Queue</dt>
<dd class="font-medium text-slate-900">
{{ $workspaceVisit->appointment?->queue_ticket_number ?? '—' }}
@if ($workspaceVisit->appointment?->queue_ticket_status)
<span class="text-slate-500">({{ $workspaceVisit->appointment->queue_ticket_status }})</span>
@endif
</dd>
</div>
<div>
<dt class="text-slate-500">Checked in</dt>
<dd class="font-medium text-slate-900">{{ $workspaceVisit->checked_in_at?->format('d M Y H:i') ?? '—' }}</dd>
</div>
</dl>
@if (! empty($clinicalAlerts))
<div class="mt-4 space-y-1.5 border-t border-slate-100 pt-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Alerts</p>
@foreach ($clinicalAlerts as $alert)
<p class="text-sm {{ ($alert['severity'] ?? '') === 'critical' ? 'text-rose-700' : 'text-amber-800' }}">
{{ $alert['message'] ?? '' }}
</p>
@endforeach
</div>
@endif
</section>
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Child Welfare summary · {{ $patient->fullName() }}</title>
<style>
body { font-family: system-ui, sans-serif; color: #0f172a; margin: 2rem; }
h1 { font-size: 1.25rem; margin: 0 0 .25rem; }
h2 { font-size: .95rem; margin: 1.25rem 0 .5rem; border-bottom: 1px solid #e2e8f0; padding-bottom: .25rem; }
.meta { color: #64748b; font-size: .875rem; }
dl { display: grid; grid-template-columns: 10rem 1fr; gap: .35rem .75rem; font-size: .875rem; }
dt { color: #64748b; }
dd { margin: 0; font-weight: 500; }
@media print { .no-print { display: none; } }
</style>
</head>
<body>
<p class="no-print"><a href="{{ route('care.specialty.workspace', ['module' => 'child_welfare', 'visit' => $visit]) }}">Back</a></p>
<h1>{{ $patient->fullName() }}</h1>
<p class="meta">
{{ $patient->patient_number }}
· Visit #{{ $visit->id }}
· Stage {{ $visit->specialty_stage ?? '—' }}
· {{ $visit->checked_in_at?->format('d M Y H:i') ?? '—' }}
</p>
<h2>Intake / history</h2>
@if ($intake)
<dl>
<dt>Visit reason</dt><dd>{{ $intake->payload['visit_reason'] ?? '—' }}</dd>
<dt>Caregiver</dt><dd>{{ $intake->payload['caregiver'] ?? '—' }}</dd>
<dt>History</dt><dd>{{ $intake->payload['history'] ?? '—' }}</dd>
<dt>Immunization</dt><dd>{{ $intake->payload['immunization_status'] ?? '—' }}</dd>
<dt>Feeding</dt><dd>{{ $intake->payload['feeding'] ?? '—' }}</dd>
<dt>Safeguarding</dt><dd>{{ $intake->payload['safeguarding_notes'] ?? '—' }}</dd>
</dl>
@else
<p class="meta">No intake recorded.</p>
@endif
<h2>Assessment</h2>
@if ($assessment)
<dl>
<dt>Age (months)</dt><dd>{{ $assessment->payload['age_months'] ?? '—' }}</dd>
<dt>Weight (kg)</dt><dd>{{ $assessment->payload['weight_kg'] ?? '—' }}</dd>
<dt>Growth status</dt><dd>{{ $assessment->payload['growth_status'] ?? '—' }}</dd>
<dt>Nutrition risk</dt><dd>{{ $assessment->payload['nutrition_risk'] ?? '—' }}</dd>
<dt>Safeguarding</dt><dd>{{ $assessment->payload['safeguarding_flag'] ?? '—' }}</dd>
<dt>Exam</dt><dd>{{ $assessment->payload['exam_findings'] ?? '—' }}</dd>
<dt>Summary</dt><dd>{{ $assessment->payload['assessment_summary'] ?? '—' }}</dd>
</dl>
@else
<p class="meta">No assessment recorded.</p>
@endif
<h2>Care plan</h2>
@if ($plan)
<dl>
<dt>Goals</dt><dd>{{ $plan->payload['goals'] ?? '—' }}</dd>
<dt>Interventions</dt><dd>{{ $plan->payload['interventions'] ?? '—' }}</dd>
<dt>Counseling</dt><dd>{{ $plan->payload['counseling'] ?? '—' }}</dd>
<dt>Follow-up</dt><dd>{{ $plan->payload['follow_up'] ?? '—' }}</dd>
</dl>
@else
<p class="meta">No care plan recorded.</p>
@endif
<h2>Intervention / follow-up</h2>
@if ($followup)
<dl>
<dt>Review type</dt><dd>{{ $followup->payload['review_type'] ?? '—' }}</dd>
<dt>Interventions</dt><dd>{{ $followup->payload['interventions_delivered'] ?? '—' }}</dd>
<dt>Outcome</dt><dd>{{ $followup->payload['outcome'] ?? '—' }}</dd>
<dt>Next visit</dt><dd>{{ $followup->payload['next_visit'] ?? '—' }}</dd>
</dl>
@else
<p class="meta">No follow-up recorded.</p>
@endif
<script>window.print();</script>
</body>
</html>
@@ -0,0 +1,88 @@
<x-app-layout title="Child Welfare reports">
<div class="space-y-6">
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<h1 class="text-xl font-semibold text-slate-900">Child Welfare reports</h1>
<p class="mt-1 text-sm text-slate-500">Arrivals, safeguarding flags, growth status, follow-up outcomes, length of stay, and CWC revenue.</p>
</div>
<a href="{{ route('care.specialty.show', 'child_welfare') }}" class="text-sm font-medium text-indigo-600"> Specialty home</a>
</div>
<form method="GET" class="flex flex-wrap items-end gap-3 rounded-2xl border border-slate-200 bg-white p-4">
<div>
<label class="block text-xs font-medium text-slate-600">From</label>
<input type="date" name="from" value="{{ $report['from'] ?? '' }}" class="mt-1 rounded-xl border border-slate-200 px-3 py-2 text-sm">
</div>
<div>
<label class="block text-xs font-medium text-slate-600">To</label>
<input type="date" name="to" value="{{ $report['to'] ?? '' }}" class="mt-1 rounded-xl border border-slate-200 px-3 py-2 text-sm">
</div>
<button type="submit" class="rounded-xl bg-indigo-600 px-4 py-2 text-sm font-semibold text-white">Apply</button>
</form>
<div class="grid gap-4 sm:grid-cols-4">
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Arrivals today</p>
<p class="mt-2 text-2xl font-semibold tabular-nums text-slate-900">{{ number_format($report['arrivals_today']) }}</p>
</div>
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Completed today</p>
<p class="mt-2 text-2xl font-semibold tabular-nums text-slate-900">{{ number_format($report['completed_today']) }}</p>
</div>
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Safeguarding open</p>
<p class="mt-2 text-2xl font-semibold tabular-nums text-rose-700">{{ number_format($report['safeguarding_open']) }}</p>
</div>
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Avg LOS (range)</p>
<p class="mt-2 text-2xl font-semibold tabular-nums text-slate-900">
{{ $report['avg_los_minutes'] !== null ? $report['avg_los_minutes'].' min' : '—' }}
</p>
</div>
</div>
<div class="grid gap-4 lg:grid-cols-2">
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<h2 class="text-sm font-semibold text-slate-900">Growth status</h2>
<ul class="mt-3 space-y-2 text-sm">
@forelse ($report['growth_breakdown'] as $row)
<li class="flex justify-between gap-3">
<span>{{ $row['status'] }}</span>
<span class="tabular-nums text-slate-600">{{ $row['total'] }}</span>
</li>
@empty
<li class="text-slate-500">No assessments in range.</li>
@endforelse
</ul>
</section>
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<h2 class="text-sm font-semibold text-slate-900">Follow-up outcomes</h2>
<ul class="mt-3 space-y-2 text-sm">
@forelse ($report['outcome_breakdown'] as $row)
<li class="flex justify-between gap-3">
<span>{{ $row['outcome'] }}</span>
<span class="tabular-nums text-slate-600">{{ $row['total'] }}</span>
</li>
@empty
<li class="text-slate-500">No follow-ups in range.</li>
@endforelse
</ul>
</section>
</div>
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<h2 class="text-sm font-semibold text-slate-900">Child Welfare service revenue</h2>
<ul class="mt-3 space-y-2 text-sm">
@forelse ($report['revenue_by_service'] as $row)
<li class="flex justify-between gap-3">
<span>{{ $row->description }} <span class="text-slate-400">×{{ $row->total }}</span></span>
<span class="tabular-nums">{{ $currency }} {{ number_format($row->amount_minor / 100, 2) }}</span>
</li>
@empty
<li class="text-slate-500">No billed child welfare services in range.</li>
@endforelse
</ul>
</section>
</div>
</x-app-layout>
@@ -0,0 +1,70 @@
@php
$record = $childWelfareFollowup;
$payload = $record?->payload ?? [];
$canManage = $canManageClinical ?? $canConsult ?? false;
@endphp
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<div class="flex flex-wrap items-start justify-between gap-3">
<div>
<h3 class="text-sm font-semibold text-slate-900">Intervention / follow-up</h3>
<p class="mt-0.5 text-xs text-slate-500">Completed outcomes can close the child welfare visit.</p>
</div>
<a href="{{ route('care.specialty.child-welfare.print', $workspaceVisit) }}" target="_blank" class="text-sm font-medium text-indigo-600">Print summary</a>
</div>
@if ($canManage)
<form method="POST" action="{{ route('care.specialty.child-welfare.followup', $workspaceVisit) }}" class="mt-4 space-y-4">
@csrf
<input type="hidden" name="tab" value="followup">
<div class="grid gap-3 sm:grid-cols-2">
@foreach ($clinicalFields ?? [] as $field)
@php
$name = $field['name'];
$value = old('payload.'.$name, $payload[$name] ?? '');
$type = $field['type'] ?? 'text';
@endphp
<div @class(['sm:col-span-2' => in_array($type, ['textarea'], true)])>
<label class="block text-xs font-medium text-slate-600">
{{ $field['label'] }}
@if (! empty($field['required'])) <span class="text-rose-600">*</span> @endif
</label>
@if ($type === 'textarea')
<textarea name="payload[{{ $name }}]" rows="{{ $field['rows'] ?? 3 }}" @required(! empty($field['required']))
class="mt-1 w-full rounded-xl border border-slate-200 px-3 py-2 text-sm">{{ $value }}</textarea>
@elseif ($type === 'select')
<select name="payload[{{ $name }}]" @required(! empty($field['required']))
class="mt-1 w-full rounded-xl border border-slate-200 px-3 py-2 text-sm">
<option value="">Select…</option>
@foreach ($field['options'] ?? [] as $option)
<option value="{{ $option }}" @selected((string) $value === (string) $option)>{{ $option }}</option>
@endforeach
</select>
@elseif ($type === 'boolean')
<label class="mt-2 inline-flex items-center gap-2 text-sm text-slate-700">
<input type="checkbox" name="payload[{{ $name }}]" value="1" @checked(old('payload.'.$name, ! empty($payload[$name])))>
Yes
</label>
@else
<input type="{{ $type === 'number' ? 'number' : 'text' }}" name="payload[{{ $name }}]" value="{{ $value }}"
@required(! empty($field['required']))
class="mt-1 w-full rounded-xl border border-slate-200 px-3 py-2 text-sm">
@endif
</div>
@endforeach
</div>
<button type="submit" class="btn-primary">Save follow-up</button>
</form>
@elseif ($record)
<dl class="mt-4 grid gap-3 text-sm sm:grid-cols-2">
@foreach ($clinicalFields ?? [] as $field)
<div>
<dt class="text-slate-500">{{ $field['label'] }}</dt>
<dd class="font-medium text-slate-900">{{ $payload[$field['name']] ?? '—' }}</dd>
</div>
@endforeach
</dl>
@else
<p class="mt-4 text-sm text-slate-500">No intervention / follow-up recorded yet.</p>
@endif
</section>
@@ -0,0 +1,78 @@
@php
$intake = $childWelfareIntake?->payload ?? [];
$assessment = $childWelfareAssessment?->payload ?? [];
$plan = $childWelfarePlan?->payload ?? [];
@endphp
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<div class="flex flex-wrap items-start justify-between gap-3">
<div>
<h3 class="text-sm font-semibold text-slate-900">Child Welfare overview</h3>
<p class="mt-0.5 text-xs text-slate-500">Intake, assessment, care plan, and follow-up for this CWC episode. Sensitive notes use the same clinical-record access controls as other specialty modules.</p>
</div>
<div class="flex flex-wrap gap-3 text-sm">
<a href="{{ route('care.specialty.child-welfare.print', $workspaceVisit) }}" target="_blank" class="font-medium text-indigo-600">Print summary</a>
<a href="{{ route('care.specialty.child-welfare.reports') }}" class="font-medium text-indigo-600">Child Welfare reports</a>
</div>
</div>
<div class="mt-4 grid gap-3 sm:grid-cols-3">
<div class="rounded-xl border border-slate-100 bg-slate-50 px-3 py-3">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Visit reason</p>
<p class="mt-1 text-sm font-semibold text-slate-900">{{ $intake['visit_reason'] ?? '—' }}</p>
<p class="mt-1 text-xs text-slate-500">{{ $intake['caregiver'] ?? '—' }}</p>
</div>
<div class="rounded-xl border border-slate-100 bg-slate-50 px-3 py-3">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Growth / assessment</p>
<p class="mt-1 text-sm font-semibold text-slate-900">{{ $assessment['growth_status'] ?? 'Not assessed' }}</p>
<p class="mt-1 text-xs text-slate-500">
@if (! empty($assessment['weight_kg']))
{{ $assessment['weight_kg'] }} kg
@if (! empty($assessment['age_months'])) · {{ $assessment['age_months'] }} mo @endif
@else
@endif
</p>
</div>
<div class="rounded-xl border border-slate-100 bg-slate-50 px-3 py-3">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Care plan</p>
<p class="mt-1 text-sm font-semibold text-slate-900">{{ \Illuminate\Support\Str::limit($plan['goals'] ?? 'Not set', 40) }}</p>
<p class="mt-1 text-xs text-slate-500">{{ $plan['follow_up'] ?? '—' }}</p>
</div>
</div>
<dl class="mt-4 grid gap-3 text-sm sm:grid-cols-2">
<div>
<dt class="text-slate-500">Interval history</dt>
<dd class="font-medium text-slate-900">{{ $intake['history'] ?? '—' }}</dd>
</div>
<div>
<dt class="text-slate-500">Assessment summary</dt>
<dd class="font-medium text-slate-900">{{ $assessment['assessment_summary'] ?? '—' }}</dd>
</div>
<div>
<dt class="text-slate-500">Queue</dt>
<dd class="font-medium text-slate-900">
{{ $workspaceVisit->appointment?->queue_ticket_number ?? '—' }}
@if ($workspaceVisit->appointment?->queue_ticket_status)
<span class="text-slate-500">({{ $workspaceVisit->appointment->queue_ticket_status }})</span>
@endif
</dd>
</div>
<div>
<dt class="text-slate-500">Checked in</dt>
<dd class="font-medium text-slate-900">{{ $workspaceVisit->checked_in_at?->format('d M Y H:i') ?? '—' }}</dd>
</div>
</dl>
@if (! empty($clinicalAlerts))
<div class="mt-4 space-y-1.5 border-t border-slate-100 pt-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Alerts</p>
@foreach ($clinicalAlerts as $alert)
<p class="text-sm {{ ($alert['severity'] ?? '') === 'critical' ? 'text-rose-700' : 'text-amber-800' }}">
{{ $alert['message'] ?? '' }}
</p>
@endforeach
</div>
@endif
</section>
@@ -56,6 +56,8 @@
'dermatology' => 'check_in',
'podiatry' => 'check_in',
'fertility' => 'check_in',
'child_welfare' => 'check_in',
'ambulance' => 'check_in',
default => collect($stages ?? [])->pluck('code')->first(),
};
$defaultStartLabel = match ($moduleKey) {
@@ -74,6 +76,8 @@
'dermatology' => 'Start check-in',
'podiatry' => 'Start check-in',
'fertility' => 'Start check-in',
'child_welfare' => 'Start check-in',
'ambulance' => 'Start check-in',
default => 'Start',
};
$currentStage = $workspaceVisit?->specialty_stage;
@@ -97,6 +97,10 @@
@include('care.specialty.podiatry.workspace-'.$activeTab)
@elseif ($moduleKey === 'fertility' && in_array($activeTab, ['overview', 'cycle'], true))
@include('care.specialty.fertility.workspace-'.$activeTab)
@elseif ($moduleKey === 'child_welfare' && in_array($activeTab, ['overview', 'followup'], true))
@include('care.specialty.child-welfare.workspace-'.$activeTab)
@elseif ($moduleKey === 'ambulance' && in_array($activeTab, ['overview', 'handover'], true))
@include('care.specialty.ambulance.workspace-'.$activeTab)
@elseif ($activeTab === 'billing')
<section class="rounded-2xl border border-slate-200 bg-white p-5">
<h3 class="text-sm font-semibold text-slate-900">
@@ -88,6 +88,12 @@
@if ($moduleKey === 'fertility')
<a href="{{ route('care.specialty.fertility.reports') }}" class="text-slate-600 hover:text-slate-900">Reports</a>
@endif
@if ($moduleKey === 'child_welfare')
<a href="{{ route('care.specialty.child-welfare.reports') }}" class="text-slate-600 hover:text-slate-900">Reports</a>
@endif
@if ($moduleKey === 'ambulance')
<a href="{{ route('care.specialty.ambulance.reports') }}" class="text-slate-600 hover:text-slate-900">Reports</a>
@endif
<a href="{{ route('care.specialty.history', $moduleKey) }}" class="text-slate-600 hover:text-slate-900">History</a>
@if ($canManageClinical ?? $canManageSpecialty ?? true)
<a href="{{ route('care.specialty.billing', $moduleKey) }}" class="text-slate-600 hover:text-slate-900">Billing</a>