Open the matching workspace tab after specialty stage advance.
Deploy Ladill Care / deploy (push) Successful in 45s
Deploy Ladill Care / deploy (push) Successful in 45s
Stage Move CTAs and pills previously always redirected to overview; map each stage to its tab via shell config so examination lands on exam, etc. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -71,6 +71,7 @@ class BloodBankWorkspaceController extends Controller
|
||||
Visit $visit,
|
||||
SpecialtyModuleService $modules,
|
||||
SpecialtyVisitStageService $stages,
|
||||
SpecialtyShellService $shell,
|
||||
): RedirectResponse {
|
||||
$this->authorizeBloodBankClinical($request);
|
||||
$this->assertBloodBankManage($request, $modules);
|
||||
@@ -94,7 +95,11 @@ class BloodBankWorkspaceController extends Controller
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('care.specialty.workspace', ['module' => 'blood_bank', 'visit' => $visit, 'tab' => 'overview'])
|
||||
->route('care.specialty.workspace', [
|
||||
'module' => 'blood_bank',
|
||||
'visit' => $visit,
|
||||
'tab' => $shell->workspaceTabForStage('blood_bank', $validated['stage']),
|
||||
])
|
||||
->with('success', 'Visit stage updated.');
|
||||
}
|
||||
|
||||
|
||||
@@ -536,6 +536,7 @@ class DentistryWorkspaceController extends Controller
|
||||
Visit $visit,
|
||||
SpecialtyModuleService $modules,
|
||||
SpecialtyVisitStageService $stages,
|
||||
SpecialtyShellService $shell,
|
||||
): RedirectResponse {
|
||||
$this->authorizeAbility($request, 'consultations.manage');
|
||||
$this->assertDentistryManage($request, $modules);
|
||||
@@ -559,7 +560,11 @@ class DentistryWorkspaceController extends Controller
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('care.specialty.workspace', ['module' => 'dentistry', 'visit' => $visit, 'tab' => 'overview'])
|
||||
->route('care.specialty.workspace', [
|
||||
'module' => 'dentistry',
|
||||
'visit' => $visit,
|
||||
'tab' => $shell->workspaceTabForStage('dentistry', $validated['stage']),
|
||||
])
|
||||
->with('success', 'Visit stage updated.');
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ class EmergencyWorkspaceController extends Controller
|
||||
Visit $visit,
|
||||
SpecialtyModuleService $modules,
|
||||
SpecialtyVisitStageService $stages,
|
||||
SpecialtyShellService $shell,
|
||||
): RedirectResponse {
|
||||
$this->authorizeAbility($request, 'consultations.manage');
|
||||
$this->assertEmergencyManage($request, $modules);
|
||||
@@ -67,7 +68,11 @@ class EmergencyWorkspaceController extends Controller
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('care.specialty.workspace', ['module' => 'emergency', 'visit' => $visit, 'tab' => 'overview'])
|
||||
->route('care.specialty.workspace', [
|
||||
'module' => 'emergency',
|
||||
'visit' => $visit,
|
||||
'tab' => $shell->workspaceTabForStage('emergency', $validated['stage']),
|
||||
])
|
||||
->with('success', 'Visit stage updated.');
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ class OphthalmologyWorkspaceController extends Controller
|
||||
Visit $visit,
|
||||
SpecialtyModuleService $modules,
|
||||
SpecialtyVisitStageService $stages,
|
||||
SpecialtyShellService $shell,
|
||||
): RedirectResponse {
|
||||
$this->authorizeAbility($request, 'consultations.manage');
|
||||
$this->assertOphthalmologyManage($request, $modules);
|
||||
@@ -66,7 +67,11 @@ class OphthalmologyWorkspaceController extends Controller
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('care.specialty.workspace', ['module' => 'ophthalmology', 'visit' => $visit, 'tab' => 'overview'])
|
||||
->route('care.specialty.workspace', [
|
||||
'module' => 'ophthalmology',
|
||||
'visit' => $visit,
|
||||
'tab' => $shell->workspaceTabForStage('ophthalmology', $validated['stage']),
|
||||
])
|
||||
->with('success', 'Visit stage updated.');
|
||||
}
|
||||
|
||||
|
||||
@@ -226,6 +226,30 @@ class SpecialtyShellService
|
||||
return $merged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Workspace tab to open after advancing/setting a visit specialty stage.
|
||||
* Uses module `stage_tabs` config, then same-named tab, then overview.
|
||||
*/
|
||||
public function workspaceTabForStage(string $moduleKey, string $stage): string
|
||||
{
|
||||
$stage = trim($stage);
|
||||
$tabs = $this->workspaceTabs($moduleKey);
|
||||
$map = $this->definition($moduleKey)['stage_tabs'] ?? [];
|
||||
|
||||
if (is_array($map) && isset($map[$stage]) && is_string($map[$stage]) && $map[$stage] !== '') {
|
||||
$candidate = $map[$stage];
|
||||
if (array_key_exists($candidate, $tabs)) {
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
|
||||
if ($stage !== '' && array_key_exists($stage, $tabs)) {
|
||||
return $stage;
|
||||
}
|
||||
|
||||
return array_key_exists('overview', $tabs) ? 'overview' : (array_key_first($tabs) ?: 'overview');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,12 @@ return [
|
||||
'billing' => 'Billing',
|
||||
'documents' => 'Documents',
|
||||
],
|
||||
// Maps visit specialty_stage → workspace ?tab= after Move / stage pill POST.
|
||||
'stage_tabs' => [
|
||||
'waiting' => 'overview',
|
||||
'in_care' => 'clinical_notes',
|
||||
'completed' => 'overview',
|
||||
],
|
||||
'actions' => [
|
||||
'call_next' => 'Call next',
|
||||
'start' => 'Start',
|
||||
@@ -73,6 +79,13 @@ return [
|
||||
'billing' => 'Billing',
|
||||
'documents' => 'Documents',
|
||||
],
|
||||
'stage_tabs' => [
|
||||
'arrival' => 'triage',
|
||||
'resus' => 'triage',
|
||||
'treatment' => 'clinical_notes',
|
||||
'observation' => 'observation',
|
||||
'disposition' => 'disposition',
|
||||
],
|
||||
],
|
||||
'blood_bank' => [
|
||||
'stages' => [
|
||||
@@ -99,6 +112,13 @@ return [
|
||||
'billing' => 'Billing',
|
||||
'documents' => 'Documents',
|
||||
],
|
||||
'stage_tabs' => [
|
||||
'request' => 'requests',
|
||||
'crossmatch' => 'requests',
|
||||
'issue' => 'issue',
|
||||
'transfusion' => 'transfusion',
|
||||
'completed' => 'overview',
|
||||
],
|
||||
],
|
||||
'dentistry' => [
|
||||
'stages' => [
|
||||
@@ -138,6 +158,13 @@ return [
|
||||
'billing' => 'Billing',
|
||||
'documents' => 'Documents',
|
||||
],
|
||||
'stage_tabs' => [
|
||||
'waiting' => 'overview',
|
||||
'chair' => 'odontogram',
|
||||
'procedure' => 'treat',
|
||||
'recovery' => 'notes',
|
||||
'completed' => 'overview',
|
||||
],
|
||||
],
|
||||
'ophthalmology' => [
|
||||
'stages' => [
|
||||
@@ -175,6 +202,16 @@ return [
|
||||
'billing' => 'Billing',
|
||||
'documents' => 'Documents',
|
||||
],
|
||||
'stage_tabs' => [
|
||||
'check_in' => 'overview',
|
||||
'history' => 'overview',
|
||||
'refraction' => 'refraction',
|
||||
'exam' => 'exam',
|
||||
'investigation' => 'investigations',
|
||||
'plan' => 'plan',
|
||||
'treatment' => 'treat',
|
||||
'completed' => 'overview',
|
||||
],
|
||||
],
|
||||
'physiotherapy' => [
|
||||
'stages' => [
|
||||
|
||||
@@ -196,7 +196,11 @@ class CareBloodBankSuiteTest extends TestCase
|
||||
->post(route('care.specialty.blood-bank.stage', $this->visit), [
|
||||
'stage' => 'crossmatch',
|
||||
])
|
||||
->assertRedirect();
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'blood_bank',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'requests',
|
||||
]));
|
||||
|
||||
$this->assertSame('crossmatch', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
|
||||
@@ -311,7 +311,11 @@ class CareDentistrySuiteTest extends TestCase
|
||||
->post(route('care.specialty.dentistry.stage', $this->visit), [
|
||||
'stage' => 'chair',
|
||||
])
|
||||
->assertRedirect();
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'dentistry',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'odontogram',
|
||||
]));
|
||||
|
||||
$this->assertSame('chair', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
|
||||
@@ -182,7 +182,11 @@ class CareEmergencySuiteTest extends TestCase
|
||||
->post(route('care.specialty.emergency.stage', $this->visit), [
|
||||
'stage' => 'treatment',
|
||||
])
|
||||
->assertRedirect();
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'emergency',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'clinical_notes',
|
||||
]));
|
||||
|
||||
$this->assertSame('treatment', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
|
||||
@@ -180,7 +180,11 @@ class CareOphthalmologySuiteTest extends TestCase
|
||||
->post(route('care.specialty.ophthalmology.stage', $this->visit), [
|
||||
'stage' => 'treatment',
|
||||
])
|
||||
->assertRedirect();
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'ophthalmology',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'treat',
|
||||
]));
|
||||
|
||||
$this->assertSame('treatment', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
|
||||
@@ -84,6 +84,12 @@ class CareSpecialtyShellTest extends TestCase
|
||||
$stages = $shell->stages('emergency');
|
||||
$this->assertSame('arrival', $stages[0]['code'] ?? null);
|
||||
$this->assertGreaterThanOrEqual(4, count($stages));
|
||||
$this->assertSame('triage', $shell->workspaceTabForStage('emergency', 'arrival'));
|
||||
$this->assertSame('exam', $shell->workspaceTabForStage('ophthalmology', 'exam'));
|
||||
$this->assertSame('investigations', $shell->workspaceTabForStage('ophthalmology', 'investigation'));
|
||||
$this->assertSame('treat', $shell->workspaceTabForStage('ophthalmology', 'treatment'));
|
||||
$this->assertSame('odontogram', $shell->workspaceTabForStage('dentistry', 'chair'));
|
||||
$this->assertSame('issue', $shell->workspaceTabForStage('blood_bank', 'issue'));
|
||||
}
|
||||
|
||||
public function test_specialty_shell_overview_and_sections_render(): void
|
||||
|
||||
Reference in New Issue
Block a user