Allow explicit multi-branch practitioner assignment for telemedicine.
Deploy Ladill Care / deploy (push) Successful in 1m29s
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:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user