Allow explicit multi-branch practitioner assignment for telemedicine.
Deploy Ladill Care / deploy (push) Successful in 1m29s

Replace optional “All branches” with required branch checkboxes; doctors may switch only among assigned sites, never org-wide by default.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 08:50:03 +00:00
co-authored by Cursor
parent d643687335
commit 899b08179e
17 changed files with 478 additions and 103 deletions
+9 -3
View File
@@ -144,13 +144,19 @@ class SpecialtyModuleService
$practitioners = Practitioner::owned((string) $organization->owner_ref)
->where('organization_id', $organization->id)
->where('is_active', true)
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
->where(function ($query) use ($member) {
$query->where('member_id', $member->id)
->orWhere('user_ref', $member->user_ref);
})
->with('department')
->get();
->with(['department', 'branches'])
->get()
->filter(function (Practitioner $practitioner) use ($branchId) {
if (! $branchId) {
return true;
}
return in_array((int) $branchId, $practitioner->assignedBranchIds(), true);
});
foreach ($practitioners as $practitioner) {
if ($provisionedIds !== [] && in_array((int) $practitioner->department_id, $provisionedIds, true)) {