Lock doctors to a single branch — never a branch picker.
Deploy Ladill Care / deploy (push) Successful in 1m3s

Doctors were treated as multi-branch when Identity cleared branch_id; now they stay on their assigned/desk site, specialty desks are home-branch only, and the queue shows site name as text only.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 08:45:57 +00:00
co-authored by Cursor
parent bb4dbee81a
commit d643687335
10 changed files with 120 additions and 23 deletions
+9 -1
View File
@@ -142,7 +142,15 @@ class CareAppointmentTest extends TestCase
$this->assertNotNull($appointment->visit_id);
$this->assertDatabaseHas('care_visits', ['patient_id' => $this->patient->id]);
Member::where('user_ref', $this->user->public_id)->update(['role' => 'doctor']);
$member = Member::where('user_ref', $this->user->public_id)->firstOrFail();
$member->update([
'role' => 'doctor',
'branch_id' => $this->branch->id,
]);
$this->practitioner->update([
'member_id' => $member->id,
'user_ref' => $this->user->public_id,
]);
$this->actingAs($this->user)
->post(route('care.queue.start', $appointment))
@@ -142,13 +142,32 @@ class CareStaffTenantScopeTest extends TestCase
->get(route('care.queue.index'))
->assertOk()
->assertSee('Showing patients assigned to you')
->assertSee('East Legon Care')
->assertDontSee('All practitioners')
->assertDontSee('name="branch_id"', false)
->assertDontSee('<select', false)
->assertSee('Ama Mensah')
->assertSee('Toothache')
->assertDontSee('Kofi Boateng')
->assertDontSee('Fever');
// Even if Identity clears member.branch_id, doctors stay on their desk's branch — no picker.
$doctorMember->update(['branch_id' => null]);
Branch::create([
'owner_ref' => $owner->public_id,
'organization_id' => $organization->id,
'name' => 'West Hills Care',
'is_active' => true,
]);
$this->actingAs($doctor)
->get(route('care.queue.index'))
->assertOk()
->assertSee('East Legon Care')
->assertDontSee('West Hills Care')
->assertDontSee('name="branch_id"', false)
->assertDontSee('<select', false);
$this->actingAs($doctor)
->get(route('care.patients.index'))
->assertOk()