Persist admin branch filter across Patient, Pharmacy, Lab, and Bills queues.
Deploy Ladill Care / deploy (push) Successful in 57s
Deploy Ladill Care / deploy (push) Successful in 57s
Admins pick a working branch once; session keeps Pharmacy Call Next and lists scoped to that site so ticket numbers no longer collide across branches. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Models\Bill;
|
||||
use App\Models\Consultation;
|
||||
use App\Models\Visit;
|
||||
use App\Services\Care\BillService;
|
||||
use App\Services\Care\BranchContext;
|
||||
use App\Services\Care\CareQueueBridge;
|
||||
use App\Services\Care\CareQueueContexts;
|
||||
use App\Services\Care\ConsultationReturnContext;
|
||||
@@ -26,6 +27,7 @@ class BillController extends Controller
|
||||
protected BillService $bills,
|
||||
protected MerchantGatewayService $gateway,
|
||||
protected CareQueueBridge $queueBridge,
|
||||
protected BranchContext $branchContext,
|
||||
) {}
|
||||
|
||||
public function index(Request $request): View
|
||||
@@ -33,26 +35,23 @@ class BillController extends Controller
|
||||
$this->authorizeAbility($request, 'bills.view');
|
||||
$organization = $this->organization($request);
|
||||
$member = $this->member($request);
|
||||
$branchScope = app(OrganizationResolver::class)->branchScope($member);
|
||||
$branches = $this->branchContext->branches($request, $organization, $member);
|
||||
$branchId = $this->branchContext->resolve($request, $organization, $member);
|
||||
|
||||
$bills = $this->bills->list(
|
||||
$this->ownerRef($request),
|
||||
$organization->id,
|
||||
$request->only(['status', 'patient_id']),
|
||||
$branchScope,
|
||||
$branchId > 0 ? $branchId : null,
|
||||
);
|
||||
|
||||
$branchId = (int) ($branchScope ?: \App\Models\Branch::owned($this->ownerRef($request))
|
||||
->where('organization_id', $organization->id)
|
||||
->where('is_active', true)
|
||||
->orderBy('name')
|
||||
->value('id'));
|
||||
|
||||
return view('care.bills.index', [
|
||||
'organization' => $organization,
|
||||
'bills' => $bills,
|
||||
'statuses' => config('care.bill_statuses'),
|
||||
'branches' => $branches,
|
||||
'branchId' => $branchId,
|
||||
'canSwitchBranch' => $this->branchContext->canSwitch($member),
|
||||
'queueIntegration' => $branchId
|
||||
? $this->queueBridge->listMeta($organization, CareQueueContexts::BILLING, $branchId)
|
||||
: ['enabled' => false],
|
||||
@@ -66,8 +65,7 @@ class BillController extends Controller
|
||||
$this->authorizeAbility($request, 'bills.manage');
|
||||
$organization = $this->organization($request);
|
||||
$member = $this->member($request);
|
||||
$branchScope = app(OrganizationResolver::class)->branchScope($member);
|
||||
$branchId = (int) ($request->input('branch_id') ?: $branchScope);
|
||||
$branchId = $this->branchContext->resolve($request, $organization, $member);
|
||||
abort_unless($branchId > 0, 422);
|
||||
abort_unless($this->queueBridge->isEnabled($organization), 404);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user