Files
ladill-care/resources/views/care/prescriptions/queue.blade.php
T
isaaccladandCursor 015a4cc7fe
Deploy Ladill Care / deploy (push) Successful in 1m45s
Wire Care lists into Ladill Queue workflows instead of reception panels.
When Queue integration is on, role pages issue tickets into their own
department queues and drive Call next → Serve → Complete on the native
lists. Integration off leaves existing UI unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 16:27:48 +00:00

88 lines
5.8 KiB
PHP

<x-app-layout title="Pharmacy queue">
<h1 class="text-xl font-semibold text-slate-900">Pharmacy queue</h1>
<p class="mt-1 text-sm text-slate-500">Active prescriptions awaiting dispensing</p>
<div class="mt-4">
@include('care.partials.queue-ops', [
'queueIntegration' => $queueIntegration ?? null,
'queueCallNextRoute' => 'care.prescriptions.call-next',
'queueCallNextParams' => [],
'branchId' => $branchId ?? null,
])
</div>
<div class="mt-4 space-y-3">
@forelse ($queue as $rx)
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<div class="flex items-start justify-between gap-4">
<div class="min-w-0 flex-1">
<p class="font-medium text-slate-900">
@if (! empty($queueIntegration['enabled']) && $rx->queue_ticket_number)
@include('care.partials.queue-ticket', [
'ticketNumber' => $rx->queue_ticket_number,
'ticketStatus' => $rx->queue_ticket_status,
])
@endif
{{ $rx->patient->fullName() }}
</p>
<p class="text-xs text-slate-500">{{ $rx->patient->patient_number }} · {{ $rx->visit->branch?->name }}</p>
<ul class="mt-2 space-y-1 text-sm text-slate-700">
@foreach ($rx->items as $item)
<li>{{ $item->is_procedure ? 'Procedure' : 'Med' }}: {{ $item->name }} {{ $item->dosage }} {{ $item->frequency }}</li>
@endforeach
</ul>
@if ($canDispense)
<div class="mt-3 flex flex-wrap gap-2">
@if (! empty($queueIntegration['enabled']) && $rx->queue_ticket_uuid && ($rx->queue_ticket_status ?? '') !== 'serving')
<form method="POST" action="{{ route('care.prescriptions.serve', $rx) }}">
@csrf
<button type="submit" class="rounded-lg bg-sky-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-sky-700">Serve</button>
</form>
@endif
</div>
<form method="POST" action="{{ route('care.prescriptions.dispense', $rx) }}" class="mt-4 border-t border-slate-100 pt-4">
@csrf
@php $allocIndex = 0; @endphp
@foreach ($rx->items as $item)
@if (! $item->is_procedure)
<div class="mt-2 grid gap-2 sm:grid-cols-[1fr_auto_auto] sm:items-end">
<div>
<label class="text-xs text-slate-500">Stock for {{ $item->name }}</label>
<select name="allocations[{{ $allocIndex }}][drug_batch_id]" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
<option value="">Skip stock deduction</option>
@foreach ($drugs as $drug)
@foreach ($drug->batches as $batch)
<option value="{{ $batch->id }}">{{ $drug->name }} · {{ $batch->batch_number }} ({{ $batch->quantity_on_hand }} {{ $drug->unit }})</option>
@endforeach
@endforeach
</select>
</div>
<input type="hidden" name="allocations[{{ $allocIndex }}][prescription_item_id]" value="{{ $item->id }}">
<div>
<label class="text-xs text-slate-500">Qty</label>
<input type="number" name="allocations[{{ $allocIndex }}][quantity]" value="1" min="1" class="mt-1 w-20 rounded-lg border-slate-300 text-sm">
</div>
@php $allocIndex++; @endphp
</div>
@endif
@endforeach
<div class="mt-3 flex gap-2">
<button type="submit" class="rounded-lg bg-emerald-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-emerald-700">
{{ ! empty($queueIntegration['enabled']) ? 'Complete & dispense' : 'Dispense' }}
</button>
<a href="{{ route('care.prescriptions.show', $rx) }}" class="text-sm text-sky-600">View details</a>
</div>
</form>
@endif
</div>
@unless ($canDispense)
<a href="{{ route('care.prescriptions.show', $rx) }}" class="text-sm text-sky-600">View</a>
@endunless
</div>
</div>
@empty
<p class="rounded-2xl border border-dashed border-slate-200 bg-white p-8 text-center text-sm text-slate-500">No prescriptions in queue.</p>
@endforelse
</div>
</x-app-layout>