Make admin Patients, Appointments, Inventory, Billing, and Reports data-driven.
Deploy Ladill Care / deploy (push) Successful in 44s

Facility admins see analytics overviews instead of operational directories; floor roles keep list UIs, with optional ?view=list for admins who need records.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 13:38:55 +00:00
co-authored by Cursor
parent 612e021e85
commit 8e406dc93c
9 changed files with 757 additions and 9 deletions
+20 -3
View File
@@ -7,8 +7,10 @@ use App\Http\Controllers\Care\Concerns\ScopesToAccount;
use App\Models\Bill;
use App\Models\Consultation;
use App\Models\Visit;
use App\Services\Care\AdminOverviewService;
use App\Services\Care\BillService;
use App\Services\Care\BranchContext;
use App\Services\Care\CarePermissions;
use App\Services\Care\CareQueueBridge;
use App\Services\Care\CareQueueContexts;
use App\Services\Care\ConsultationReturnContext;
@@ -28,6 +30,7 @@ class BillController extends Controller
protected MerchantGatewayService $gateway,
protected CareQueueBridge $queueBridge,
protected BranchContext $branchContext,
protected AdminOverviewService $adminOverview,
) {}
public function index(Request $request): View
@@ -35,9 +38,23 @@ class BillController extends Controller
$this->authorizeAbility($request, 'bills.view');
$organization = $this->organization($request);
$member = $this->member($request);
$permissions = app(CarePermissions::class);
$branches = $this->branchContext->branches($request, $organization, $member);
$branchId = $this->branchContext->resolve($request, $organization, $member);
if ($permissions->isAdmin($member) && $request->query('view') !== 'list') {
return view('care.admin.analytics', [
'title' => 'Billing',
'badge' => 'Analytics · Revenue',
'description' => 'Collections, outstanding balances, and invoice throughput — not a cashier queue.',
'adminOverview' => $this->adminOverview->billing(
$organization,
$this->ownerRef($request),
$branchId > 0 ? $branchId : null,
),
]);
}
$bills = $this->bills->list(
$this->ownerRef($request),
$organization->id,
@@ -52,11 +69,11 @@ class BillController extends Controller
'branches' => $branches,
'branchId' => $branchId,
'canSwitchBranch' => $this->branchContext->canSwitch($member),
'queueIntegration' => $branchId
'queueIntegration' => $branchId && $permissions->handlesFloorCare($member)
? $this->queueBridge->listMeta($organization, CareQueueContexts::BILLING, $branchId)
: ['enabled' => false],
'canManageQueue' => app(\App\Services\Care\CarePermissions::class)
->can($member, 'service_queues.console'),
'canManageQueue' => $permissions->can($member, 'service_queues.console')
&& $permissions->handlesFloorCare($member),
]);
}