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:
@@ -47,13 +47,19 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-slate-700">Branch (optional)</label>
|
||||
<select name="branch_id" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
|
||||
<option value="">All branches</option>
|
||||
<label class="block text-sm font-medium text-slate-700">
|
||||
<span x-text="role === 'doctor' ? 'Home branch' : 'Branch (optional)'"></span>
|
||||
</label>
|
||||
<select name="branch_id" class="mt-1 w-full rounded-lg border-slate-300 text-sm"
|
||||
:required="role === 'doctor'">
|
||||
<option value="" x-text="role === 'doctor' ? 'Select a branch…' : 'No branch lock'"></option>
|
||||
@foreach ($branches as $branch)
|
||||
<option value="{{ $branch->id }}" @selected(old('branch_id') == $branch->id)>{{ $branch->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<p class="mt-1 text-xs text-slate-500" x-show="role === 'doctor'" x-cloak>
|
||||
Required for doctors. Add more sites later under Practitioners (telemedicine).
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="rounded-xl border border-slate-100 bg-slate-50 p-4" x-show="role === 'doctor'" x-cloak>
|
||||
|
||||
@@ -14,15 +14,24 @@
|
||||
<label class="block text-sm font-medium">Specialty (optional)</label>
|
||||
<input type="text" name="specialty" value="{{ old('specialty') }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm" placeholder="General practice">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium">Branch (optional)</label>
|
||||
<select name="branch_id" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
|
||||
<option value="">All branches</option>
|
||||
@foreach ($branches as $branch)
|
||||
<option value="{{ $branch->id }}" @selected(old('branch_id') == $branch->id)>{{ $branch->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<fieldset>
|
||||
<legend class="block text-sm font-medium">Branches</legend>
|
||||
<p class="mt-1 text-xs text-slate-500">Select every site this clinician may serve (including telemedicine). Nothing is selected by default.</p>
|
||||
<div class="mt-2 space-y-2 rounded-lg border border-slate-200 p-3">
|
||||
@forelse ($branches as $branch)
|
||||
<label class="flex items-center gap-2 text-sm text-slate-700">
|
||||
<input type="checkbox" name="branch_ids[]" value="{{ $branch->id }}"
|
||||
@checked(collect(old('branch_ids', []))->contains($branch->id))
|
||||
class="rounded border-slate-300 text-sky-600">
|
||||
{{ $branch->name }}
|
||||
</label>
|
||||
@empty
|
||||
<p class="text-sm text-slate-500">Create a branch first under Settings → Branches.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
@error('branch_ids')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
|
||||
@error('branch_ids.*')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
|
||||
</fieldset>
|
||||
<div>
|
||||
<label class="block text-sm font-medium">Department (optional)</label>
|
||||
<select name="department_id" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
|
||||
|
||||
@@ -13,15 +13,27 @@
|
||||
<label class="block text-sm font-medium">Specialty (optional)</label>
|
||||
<input type="text" name="specialty" value="{{ old('specialty', $practitioner->specialty) }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium">Branch (optional)</label>
|
||||
<select name="branch_id" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
|
||||
<option value="">All branches</option>
|
||||
@foreach ($branches as $branch)
|
||||
<option value="{{ $branch->id }}" @selected(old('branch_id', $practitioner->branch_id) == $branch->id)>{{ $branch->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<fieldset>
|
||||
<legend class="block text-sm font-medium">Branches</legend>
|
||||
<p class="mt-1 text-xs text-slate-500">Select every site this clinician may serve (including telemedicine). Nothing is selected by default.</p>
|
||||
@php
|
||||
$selectedBranchIds = collect(old('branch_ids', $practitioner->assignedBranchIds()));
|
||||
@endphp
|
||||
<div class="mt-2 space-y-2 rounded-lg border border-slate-200 p-3">
|
||||
@forelse ($branches as $branch)
|
||||
<label class="flex items-center gap-2 text-sm text-slate-700">
|
||||
<input type="checkbox" name="branch_ids[]" value="{{ $branch->id }}"
|
||||
@checked($selectedBranchIds->contains($branch->id))
|
||||
class="rounded border-slate-300 text-sky-600">
|
||||
{{ $branch->name }}
|
||||
</label>
|
||||
@empty
|
||||
<p class="text-sm text-slate-500">Create a branch first under Settings → Branches.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
@error('branch_ids')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
|
||||
@error('branch_ids.*')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
|
||||
</fieldset>
|
||||
<div>
|
||||
<label class="block text-sm font-medium">Department (optional)</label>
|
||||
<select name="department_id" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
|
||||
|
||||
@@ -35,7 +35,16 @@
|
||||
<tr>
|
||||
<td class="px-4 py-3 font-medium">{{ $practitioner->name }}</td>
|
||||
<td class="px-4 py-3">{{ $practitioner->specialty ?: '—' }}</td>
|
||||
<td class="px-4 py-3">{{ $practitioner->branch?->name ?? 'All branches' }}</td>
|
||||
<td class="px-4 py-3">
|
||||
@php $branchNames = $practitioner->branches->pluck('name'); @endphp
|
||||
@if ($branchNames->isNotEmpty())
|
||||
{{ $branchNames->implode(', ') }}
|
||||
@elseif ($practitioner->branch)
|
||||
{{ $practitioner->branch->name }}
|
||||
@else
|
||||
<span class="text-amber-700">Unassigned</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3">{{ $practitioner->member?->user_ref ?? '—' }}</td>
|
||||
<td class="px-4 py-3">
|
||||
<span class="inline-flex rounded-full px-2 py-0.5 text-xs font-medium {{ $practitioner->is_active ? 'bg-emerald-50 text-emerald-700' : 'bg-slate-100 text-slate-600' }}">
|
||||
|
||||
@@ -18,13 +18,16 @@
|
||||
|
||||
<form method="GET" class="flex flex-wrap gap-3 rounded-2xl border border-slate-200 bg-white p-4">
|
||||
@if ($lockToPractitioner ?? false)
|
||||
<p class="text-sm text-slate-500">
|
||||
@if (isset($branches) && $branches->isNotEmpty())
|
||||
<span class="font-medium text-slate-700">{{ $branches->first()->name }}</span>
|
||||
<span class="text-slate-300"> · </span>
|
||||
@endif
|
||||
Showing patients assigned to you
|
||||
</p>
|
||||
@if (($canSwitchBranch ?? false) && isset($branches) && $branches->count() > 1)
|
||||
<select name="branch_id" class="rounded-lg border-slate-300 text-sm" onchange="this.form.submit()">
|
||||
@foreach ($branches as $branch)
|
||||
<option value="{{ $branch->id }}" @selected($branchId == $branch->id)>{{ $branch->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@elseif (isset($branches) && $branches->isNotEmpty())
|
||||
<span class="flex items-center text-sm font-medium text-slate-700">{{ $branches->first()->name }}</span>
|
||||
@endif
|
||||
<span class="flex items-center text-sm text-slate-500">Showing patients assigned to you</span>
|
||||
@elseif ($canSwitchBranch ?? false)
|
||||
<select name="branch_id" class="rounded-lg border-slate-300 text-sm" onchange="this.form.submit()">
|
||||
@foreach ($branches as $branch)
|
||||
|
||||
Reference in New Issue
Block a user