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:
@@ -193,6 +193,30 @@ class PrescriptionController extends Controller
|
||||
->with('success', 'Prescription created.');
|
||||
}
|
||||
|
||||
if ($request->input('return_to') === 'specialty') {
|
||||
$module = (string) $request->input('specialty_module', '');
|
||||
$visitId = (int) $request->input('specialty_visit_id', 0);
|
||||
$modules = app(\App\Services\Care\SpecialtyModuleService::class);
|
||||
$visit = $consultation->visit_id
|
||||
? \App\Models\Visit::query()->find($consultation->visit_id)
|
||||
: null;
|
||||
|
||||
if (
|
||||
$module !== ''
|
||||
&& $modules->definition($module)
|
||||
&& $visit
|
||||
&& (int) $visit->id === $visitId
|
||||
&& (int) $visit->id === (int) $consultation->visit_id
|
||||
) {
|
||||
return redirect()
|
||||
->route('care.specialty.workspace', [
|
||||
'module' => $module,
|
||||
'visit' => $visit,
|
||||
])
|
||||
->with('success', 'Prescription created.');
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('care.prescriptions.show', array_filter([
|
||||
'prescription' => $prescription,
|
||||
...$return->query($consultation),
|
||||
|
||||
@@ -829,6 +829,8 @@ class SpecialtyModuleController extends Controller
|
||||
&& $canManageSpecialty
|
||||
&& $permissions->can($member, 'blood_bank.manage'));
|
||||
$canStartConsultation = $canConsult;
|
||||
// Same ability as GP consultation chart — not consultations.manage alone.
|
||||
$canPrescribe = $permissions->can($member, 'prescriptions.manage') && $canManageSpecialty;
|
||||
$canCallNext = $canManageSpecialty;
|
||||
$canManageClinical = $canManageSpecialty;
|
||||
$canManageVitals = $canManageSpecialty && (
|
||||
@@ -1176,6 +1178,7 @@ class SpecialtyModuleController extends Controller
|
||||
'canConsult' => $canConsult,
|
||||
'canAdvanceStage' => $canAdvanceStage,
|
||||
'canStartConsultation' => $canStartConsultation,
|
||||
'canPrescribe' => $canPrescribe,
|
||||
'canCallNext' => $canCallNext,
|
||||
'canManageClinical' => $canManageClinical,
|
||||
'canManageVitals' => $canManageVitals,
|
||||
|
||||
Reference in New Issue
Block a user