Restrict specialty modules to doctors assigned to that specialty.
Deploy Ladill Care / deploy (push) Successful in 1m10s
Deploy Ladill Care / deploy (push) Successful in 1m10s
Nav and pages require a linked practitioner desk in the module department; demo seeds specialty doctors and stops overwriting their assigned waiters. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -132,6 +132,7 @@ class DemoTenantSeeder
|
||||
$practitioners,
|
||||
$patients,
|
||||
$ownerRef,
|
||||
$plan,
|
||||
);
|
||||
}
|
||||
$this->assignAllDemoWaiters($organization, $ownerRef, $branches, $practitioners);
|
||||
@@ -286,6 +287,9 @@ class DemoTenantSeeder
|
||||
->owned($ownerRef)
|
||||
->where('organization_id', $organization->id)
|
||||
->whereIn('status', [Appointment::STATUS_WAITING, Appointment::STATUS_CHECKED_IN])
|
||||
->where(function ($q) {
|
||||
$q->whereNull('practitioner_id')->orWhere('practitioner_id', 0);
|
||||
})
|
||||
->get();
|
||||
|
||||
foreach ($waiters as $index => $appointment) {
|
||||
@@ -772,6 +776,7 @@ class DemoTenantSeeder
|
||||
array $practitioners,
|
||||
array $patients,
|
||||
string $ownerRef,
|
||||
string $plan = 'pro',
|
||||
): int {
|
||||
if ($branches === [] || $patients === [] || $practitioners === []) {
|
||||
return 0;
|
||||
@@ -789,6 +794,9 @@ class DemoTenantSeeder
|
||||
$catalog = config('care.specialty_modules', []);
|
||||
/** @var array<int, int> $nextPositionByBranch */
|
||||
$nextPositionByBranch = [];
|
||||
/** @var array<string, Member|null> $moduleMembers */
|
||||
$moduleMembers = [];
|
||||
|
||||
foreach ($catalog as $key => $definition) {
|
||||
$type = (string) ($definition['department_type'] ?? '');
|
||||
if ($type === '') {
|
||||
@@ -796,6 +804,11 @@ class DemoTenantSeeder
|
||||
}
|
||||
|
||||
$moduleReasons = $reasons[$key] ?? ['Specialty visit'];
|
||||
$staffEmail = sprintf('demo-%s-%s@ladill.com', $plan, $key);
|
||||
$moduleMembers[$key] = Member::query()
|
||||
->where('organization_id', $organization->id)
|
||||
->where('user_ref', $staffEmail)
|
||||
->first();
|
||||
|
||||
foreach ($branches as $branchIndex => $branch) {
|
||||
$department = Department::owned($ownerRef)
|
||||
@@ -807,17 +820,22 @@ class DemoTenantSeeder
|
||||
continue;
|
||||
}
|
||||
|
||||
$member = $moduleMembers[$key];
|
||||
$staff = $member ? \App\Support\DemoWorld::staffByEmail($staffEmail) : null;
|
||||
$stableRef = sprintf('demo-specialty-%s-%s', $key, $branch->id);
|
||||
$practitioner = Practitioner::withTrashed()->updateOrCreate(
|
||||
[
|
||||
'organization_id' => $organization->id,
|
||||
'user_ref' => sprintf('demo-specialty-%s-%s', $key, $branch->id),
|
||||
'user_ref' => $stableRef,
|
||||
],
|
||||
[
|
||||
'owner_ref' => $ownerRef,
|
||||
'branch_id' => $branch->id,
|
||||
'department_id' => $department->id,
|
||||
'member_id' => null,
|
||||
'name' => ($definition['label'] ?? ucfirst($key)).' Clinic',
|
||||
'member_id' => $member?->id,
|
||||
'name' => is_array($staff)
|
||||
? (string) $staff['name']
|
||||
: (($definition['label'] ?? ucfirst($key)).' Clinic'),
|
||||
'specialty' => (string) ($definition['label'] ?? $key),
|
||||
'room' => ($definition['label'] ?? 'Specialty').' Bay',
|
||||
'is_active' => true,
|
||||
|
||||
Reference in New Issue
Block a user