Reuse the GP consultation prescribe modal, gate with prescriptions.manage, and return to the specialty workspace after create. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
{{-- Shared prescription line-item form body (create page + consultation modal). --}}
|
||||
{{-- Shared prescription line-item form body (create page + consultation / specialty modal). --}}
|
||||
@php
|
||||
$routes = $routes ?? config('care.medication_routes', []);
|
||||
$compact = $compact ?? false;
|
||||
$returnTo = $returnTo ?? ($compact ? 'consultation' : null);
|
||||
@endphp
|
||||
<form
|
||||
method="POST"
|
||||
@@ -50,8 +51,12 @@
|
||||
<textarea name="notes" rows="2" class="mt-1 w-full rounded-lg border-slate-300 text-sm"></textarea>
|
||||
<input type="hidden" name="activate" value="1">
|
||||
<input type="hidden" name="from_consultation" value="{{ $consultation->uuid }}">
|
||||
@if ($compact)
|
||||
<input type="hidden" name="return_to" value="consultation">
|
||||
@if ($returnTo)
|
||||
<input type="hidden" name="return_to" value="{{ $returnTo }}">
|
||||
@if ($returnTo === 'specialty' && ! empty($specialtyModule) && ! empty($specialtyVisit))
|
||||
<input type="hidden" name="specialty_module" value="{{ $specialtyModule }}">
|
||||
<input type="hidden" name="specialty_visit_id" value="{{ $specialtyVisit->id }}">
|
||||
@endif
|
||||
@endif
|
||||
</section>
|
||||
<div @class(['flex flex-col-reverse gap-2 sm:flex-row sm:justify-end' => $compact, 'flex gap-3' => ! $compact])>
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
$btnAccent = $btn.' border border-indigo-200 bg-indigo-50 text-indigo-900 hover:bg-indigo-100';
|
||||
$onWorkspace = ($section ?? '') === 'workspace';
|
||||
$appointment = $workspaceVisit?->appointment;
|
||||
$openConsultation = $appointment?->consultation;
|
||||
$openConsultation = $appointment?->consultation
|
||||
?? $workspaceVisit?->consultations?->firstWhere('status', '!=', \App\Models\Consultation::STATUS_COMPLETED);
|
||||
$ticketCalled = $appointment && $appointment->queue_ticket_status === 'called';
|
||||
$canCallNext = $canCallNext ?? ($canManageSpecialty ?? false);
|
||||
$canConsult = $canConsult ?? false;
|
||||
$canAdvanceStage = $canAdvanceStage ?? $canConsult;
|
||||
$canStartConsultationFlag = $canStartConsultation ?? $canConsult;
|
||||
$canPrescribe = $canPrescribe ?? false;
|
||||
$canBookAppointments = $canBookAppointments ?? false;
|
||||
$canViewPatients = $canViewPatients ?? true;
|
||||
$canViewAppointments = $canViewAppointments ?? true;
|
||||
@@ -102,6 +104,16 @@
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@if ($canPrescribe && $openConsultation && $openConsultation->status !== \App\Models\Consultation::STATUS_COMPLETED)
|
||||
<button
|
||||
type="button"
|
||||
class="{{ $btnSecondary }}"
|
||||
@click.stop="$dispatch('open-modal', {{ \Illuminate\Support\Js::from('prescribe-'.$openConsultation->id) }})"
|
||||
>
|
||||
{{ $actions['prescribe'] ?? 'Prescribe' }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@if ($consultationInProgress)
|
||||
<a href="{{ route('care.specialty.workspace', ['module' => $moduleKey, 'visit' => $workspaceVisit, 'tab' => $chartTab]) }}"
|
||||
class="{{ $btnSecondary }}">
|
||||
|
||||
@@ -80,7 +80,12 @@
|
||||
|
||||
@php
|
||||
$completeConsultation = ($canConsult ?? false)
|
||||
? $workspaceVisit?->appointment?->consultation
|
||||
? ($workspaceVisit?->appointment?->consultation
|
||||
?? $workspaceVisit?->consultations?->firstWhere('status', '!=', \App\Models\Consultation::STATUS_COMPLETED))
|
||||
: null;
|
||||
$prescribeConsultation = ($canPrescribe ?? false)
|
||||
? ($workspaceVisit?->appointment?->consultation
|
||||
?? $workspaceVisit?->consultations?->firstWhere('status', '!=', \App\Models\Consultation::STATUS_COMPLETED))
|
||||
: null;
|
||||
@endphp
|
||||
@if ($completeConsultation && $completeConsultation->status !== \App\Models\Consultation::STATUS_COMPLETED)
|
||||
@@ -93,6 +98,29 @@
|
||||
variant="primary"
|
||||
/>
|
||||
@endif
|
||||
@if ($prescribeConsultation && $prescribeConsultation->status !== \App\Models\Consultation::STATUS_COMPLETED)
|
||||
<x-modal :name="'prescribe-'.$prescribeConsultation->id" maxWidth="2xl">
|
||||
<div class="px-5 pb-6 pt-2 sm:px-6 sm:pb-6 sm:pt-4">
|
||||
<h2 class="pr-8 text-lg font-semibold text-slate-900">New prescription</h2>
|
||||
<p class="mt-1 text-sm text-slate-500">
|
||||
{{ ($workspaceVisit->patient ?? $prescribeConsultation->patient)?->fullName() }}
|
||||
@if (($workspaceVisit->patient ?? $prescribeConsultation->patient)?->patient_number)
|
||||
({{ ($workspaceVisit->patient ?? $prescribeConsultation->patient)->patient_number }})
|
||||
@endif
|
||||
</p>
|
||||
<div class="mt-4 max-h-[70vh] overflow-y-auto pr-1">
|
||||
@include('care.prescriptions.partials.form', [
|
||||
'consultation' => $prescribeConsultation,
|
||||
'routes' => config('care.medication_routes'),
|
||||
'compact' => true,
|
||||
'returnTo' => 'specialty',
|
||||
'specialtyModule' => $moduleKey,
|
||||
'specialtyVisit' => $workspaceVisit,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</x-modal>
|
||||
@endif
|
||||
@elseif ($section === 'history')
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div class="flex items-start gap-2.5">
|
||||
|
||||
Reference in New Issue
Block a user