Lock doctors to their assigned patients and hide branch filters.
Deploy Ladill Care / deploy (push) Successful in 1m2s

Doctors no longer see branch/practitioner pickers; queue, appointments, patients, and dashboard only include visits on their linked desk.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 06:28:07 +00:00
co-authored by Cursor
parent 5264035705
commit dcbc62d1d3
11 changed files with 361 additions and 89 deletions
@@ -7,6 +7,7 @@ use App\Models\Department;
use App\Models\FacilityWorkflow;
use App\Models\Member;
use App\Models\Organization;
use App\Models\Practitioner;
use App\Models\User;
use App\Services\Care\Workflow\WorkflowTemplateInstaller;
use App\Services\Care\Workflow\WorkflowTemplateRegistry;
@@ -192,4 +193,30 @@ class OrganizationResolver
return $member->branch_id;
}
/**
* Practitioner IDs a doctor is locked to. Null = no practitioner lock (non-doctors).
* Empty array = doctor with no linked practitioner desk (see no clinical queue).
*
* @return list<int>|null
*/
public function practitionerScope(Organization $organization, ?Member $member): ?array
{
if ($member === null || $member->role !== 'doctor') {
return null;
}
return Practitioner::owned((string) $organization->owner_ref)
->where('organization_id', $organization->id)
->where('is_active', true)
->where(function ($query) use ($member) {
$query->where('member_id', $member->id)
->orWhere('user_ref', $member->user_ref);
})
->orderBy('id')
->pluck('id')
->map(fn ($id) => (int) $id)
->values()
->all();
}
}