diff --git a/app/Http/Controllers/Care/ConsultationController.php b/app/Http/Controllers/Care/ConsultationController.php index ee75cdc..d32f8fc 100644 --- a/app/Http/Controllers/Care/ConsultationController.php +++ b/app/Http/Controllers/Care/ConsultationController.php @@ -216,6 +216,7 @@ class ConsultationController extends Controller 'pathwayInstruments' => $pathwayInstruments ?? collect(), 'queueIntegration' => $queueIntegration, 'queueBranchId' => $queueBranchId, + 'medicationRoutes' => config('care.medication_routes'), ]); } diff --git a/app/Http/Controllers/Care/PrescriptionController.php b/app/Http/Controllers/Care/PrescriptionController.php index 4f59d5d..98036f9 100644 --- a/app/Http/Controllers/Care/PrescriptionController.php +++ b/app/Http/Controllers/Care/PrescriptionController.php @@ -187,6 +187,12 @@ class PrescriptionController extends Controller $return = app(ConsultationReturnContext::class); $return->remember($consultation); + if ($request->input('return_to') === 'consultation') { + return redirect() + ->route('care.consultations.show', $consultation) + ->with('success', 'Prescription created.'); + } + return redirect()->route('care.prescriptions.show', array_filter([ 'prescription' => $prescription, ...$return->query($consultation), diff --git a/resources/views/care/consultations/partials/actions-menu.blade.php b/resources/views/care/consultations/partials/actions-menu.blade.php index bac418d..dd6fbbb 100644 --- a/resources/views/care/consultations/partials/actions-menu.blade.php +++ b/resources/views/care/consultations/partials/actions-menu.blade.php @@ -34,9 +34,13 @@ @endif @if ($canPrescribe) - + @endif @if ($canRequestInvestigations && $investigationTypes->isNotEmpty() && ! $isCompleted) diff --git a/resources/views/care/consultations/show.blade.php b/resources/views/care/consultations/show.blade.php index 0e24190..bf55321 100644 --- a/resources/views/care/consultations/show.blade.php +++ b/resources/views/care/consultations/show.blade.php @@ -486,4 +486,20 @@ @endif + + @if ($canPrescribe) + +
+

New prescription

+

{{ $consultation->patient->fullName() }} ({{ $consultation->patient->patient_number }})

+
+ @include('care.prescriptions.partials.form', [ + 'consultation' => $consultation, + 'routes' => $medicationRoutes ?? config('care.medication_routes'), + 'compact' => true, + ]) +
+
+
+ @endif diff --git a/resources/views/care/prescriptions/create.blade.php b/resources/views/care/prescriptions/create.blade.php index 30df35f..ac656dc 100644 --- a/resources/views/care/prescriptions/create.blade.php +++ b/resources/views/care/prescriptions/create.blade.php @@ -4,43 +4,9 @@

New prescription

{{ $consultation->patient->fullName() }} ({{ $consultation->patient->patient_number }})

-
- @csrf -
-
-

Medications & procedures

- -
- -
-
- - - - -
-
- - Cancel -
-
+ @include('care.prescriptions.partials.form', [ + 'consultation' => $consultation, + 'routes' => $routes, + 'compact' => false, + ]) diff --git a/resources/views/care/prescriptions/partials/form.blade.php b/resources/views/care/prescriptions/partials/form.blade.php new file mode 100644 index 0000000..9fbab6b --- /dev/null +++ b/resources/views/care/prescriptions/partials/form.blade.php @@ -0,0 +1,72 @@ +{{-- Shared prescription line-item form body (create page + consultation modal). --}} +@php + $routes = $routes ?? config('care.medication_routes', []); + $compact = $compact ?? false; +@endphp +
+ @csrf +
$compact, + 'rounded-2xl border border-slate-200 bg-white p-6' => ! $compact, + ])> +
+

$compact, + 'text-sm font-semibold uppercase text-slate-500' => ! $compact, + ])>Medications & procedures

+ +
+ +
+
$compact, + 'rounded-2xl border border-slate-200 bg-white p-6' => ! $compact, + ])> + + + + + @if ($compact) + + @endif +
+
$compact, 'flex gap-3' => ! $compact])> + @if ($compact) + + + @else + + Cancel + @endif +
+