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
@@ -5,6 +5,8 @@ namespace App\Http\Controllers\Care;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Care\Concerns\ScopesToAccount;
use App\Models\Drug;
use App\Services\Care\AdminOverviewService;
use App\Services\Care\CarePermissions;
use App\Services\Care\OrganizationResolver;
use App\Services\Care\PharmacyService;
use Illuminate\Http\RedirectResponse;
@@ -17,13 +19,29 @@ class DrugController extends Controller
public function __construct(
protected PharmacyService $pharmacy,
protected AdminOverviewService $adminOverview,
) {}
public function index(Request $request): View
{
$this->authorizeAbility($request, 'pharmacy.view');
$organization = $this->organization($request);
$branchScope = app(OrganizationResolver::class)->branchScope($this->member($request));
$member = $this->member($request);
$branchScope = app(OrganizationResolver::class)->branchScope($member);
$permissions = app(CarePermissions::class);
if ($permissions->isAdmin($member) && $request->query('view') !== 'list') {
return view('care.admin.analytics', [
'title' => 'Inventory',
'badge' => 'Analytics · Stock health',
'description' => 'Stock value, reorder risk, and expiry exposure across the pharmacy catalog.',
'adminOverview' => $this->adminOverview->inventory(
$organization,
$this->ownerRef($request),
$branchScope,
),
]);
}
$drugs = $this->pharmacy->listDrugs(
$this->ownerRef($request),
@@ -50,8 +68,7 @@ class DrugController extends Controller
'drugs' => $drugs,
'lowStock' => $lowStock,
'expired' => $expired,
'canManage' => app(\App\Services\Care\CarePermissions::class)
->can($this->member($request), 'pharmacy.manage'),
'canManage' => $permissions->can($member, 'pharmacy.manage'),
'heroStats' => $heroStats,
]);
}