Files
ladill-care/resources/views/care/specialty/dentistry/workspace-overview.blade.php
T
isaaccladandCursor 8a5330d3d2
Deploy Ladill Care / deploy (push) Successful in 1m3s
Gate specialty mutate CTAs on Care abilities, not only module manage.
Nurses can manage limited specialties but lack consultations.manage, so
hide Start/stage/chart edits that 403 while keeping queue/vitals/billing
aligned with what those routes actually authorize.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 18:45:00 +00:00

127 lines
6.1 KiB
PHP

@php
$plan = $dentalPlan;
$openItems = $plan?->items?->whereIn('status', ['proposed', 'accepted']) ?? collect();
$currentStage = $workspaceVisit->specialty_stage;
$canManage = $canConsult ?? false;
$stageFlow = [
'waiting' => ['next' => 'chair', 'label' => 'Seat at chair'],
'chair' => ['next' => 'procedure', 'label' => 'Start procedure'],
'procedure' => ['next' => 'recovery', 'label' => 'Move to recovery'],
'recovery' => ['next' => 'completed', 'label' => 'Complete visit'],
];
@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">Overview</h3>
<p class="mt-0.5 text-xs text-slate-500">Visit stage, summary, and open treatment work.</p>
</div>
<a href="{{ route('care.specialty.dentistry.reports') }}" class="text-sm font-medium text-indigo-600">Dentistry reports</a>
</div>
<div class="mt-4 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 stage</p>
<p class="mt-1 text-sm font-medium text-slate-900">
{{ $currentStage ? ucfirst(str_replace('_', ' ', $currentStage)) : 'Not set' }}
</p>
<div class="mt-3 flex flex-wrap gap-2">
@foreach (['waiting', 'chair', 'procedure', 'recovery', 'completed'] as $stageCode)
@if ($canManage)
<form method="POST" action="{{ route('care.specialty.dentistry.stage', $workspaceVisit) }}">
@csrf
<input type="hidden" name="stage" value="{{ $stageCode }}">
<button type="submit"
@class([
'rounded-lg px-2.5 py-1 text-xs font-semibold',
'bg-indigo-600 text-white' => $currentStage === $stageCode,
'border border-slate-200 bg-white text-slate-700 hover:bg-slate-50' => $currentStage !== $stageCode,
])>
{{ ucfirst($stageCode) }}
</button>
</form>
@else
<span
@class([
'rounded-lg px-2.5 py-1 text-xs font-semibold',
'bg-indigo-600 text-white' => $currentStage === $stageCode,
'border border-slate-200 bg-white text-slate-400' => $currentStage !== $stageCode,
])
@if ($currentStage !== $stageCode) aria-disabled="true" title="View-only access" @endif
>
{{ ucfirst($stageCode) }}
</span>
@endif
@endforeach
@if ($canManage && $currentStage && isset($stageFlow[$currentStage]))
<form method="POST" action="{{ route('care.specialty.dentistry.stage', $workspaceVisit) }}">
@csrf
<input type="hidden" name="stage" value="{{ $stageFlow[$currentStage]['next'] }}">
<button type="submit" class="rounded-lg bg-emerald-600 px-2.5 py-1 text-xs font-semibold text-white hover:bg-emerald-700">
{{ $stageFlow[$currentStage]['label'] }}
</button>
</form>
@endif
</div>
</div>
<dl class="mt-4 grid gap-3 text-sm sm:grid-cols-2">
<div>
<dt class="text-slate-500">Visit status</dt>
<dd class="font-medium text-slate-900">{{ ucfirst(str_replace('_', ' ', $workspaceVisit->status)) }}</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>
<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">Treatment plan</dt>
<dd class="font-medium text-slate-900">
@if ($plan)
{{ ucfirst(str_replace('_', ' ', $plan->status)) }}
· {{ $currency ?? 'GHS' }} {{ number_format($plan->estimate_minor / 100, 2) }}
@else
None open
@endif
</dd>
</div>
</dl>
@if ($openItems->isNotEmpty())
<div class="mt-4 border-t border-slate-100 pt-4">
<p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Unfinished plan items</p>
<ul class="mt-2 space-y-1 text-sm">
@foreach ($openItems->take(8) as $item)
<li class="flex justify-between gap-3">
<span>
{{ $item->label }}
@if ($item->tooth_code) <span class="text-slate-400">· {{ $item->tooth_code }}</span> @endif
</span>
<span class="tabular-nums text-slate-500">{{ number_format($item->estimate_minor / 100, 2) }}</span>
</li>
@endforeach
</ul>
</div>
@endif
@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>