Add hero sections to Patients, Appointments, Queue, and admin index pages.
Deploy Ladill Care / deploy (push) Successful in 37s

Introduce shared x-care.page-hero with summary stats so key list views
match the Ladill app hero pattern used across Frontdesk and Link.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-05 22:57:54 +00:00
co-authored by Cursor
parent 527244948c
commit 0b6cad75a6
15 changed files with 512 additions and 304 deletions
@@ -38,11 +38,26 @@ class AppointmentController extends Controller
$practitioners = $this->activePractitioners($request, $organization->id);
$owner = $this->ownerRef($request);
$appointmentQuery = Appointment::owned($owner)
->where('organization_id', $organization->id)
->when($branchScope, fn ($q) => $q->where('branch_id', $branchScope));
$heroStats = [
'today' => (clone $appointmentQuery)->whereDate('scheduled_at', today())->count(),
'scheduled' => (clone $appointmentQuery)->where('status', Appointment::STATUS_SCHEDULED)->count(),
'waiting' => (clone $appointmentQuery)->whereIn('status', [
Appointment::STATUS_CHECKED_IN,
Appointment::STATUS_WAITING,
])->count(),
];
return view('care.appointments.index', [
'organization' => $organization,
'appointments' => $appointments,
'practitioners' => $practitioners,
'statuses' => config('care.appointment_statuses'),
'heroStats' => $heroStats,
]);
}
@@ -26,7 +26,13 @@ class BranchController extends Controller
->orderBy('name')
->get();
return view('care.admin.branches.index', compact('branches', 'organization'));
$heroStats = [
'total' => $branches->count(),
'active' => $branches->where('is_active', true)->count(),
'departments' => $branches->sum('departments_count'),
];
return view('care.admin.branches.index', compact('branches', 'organization', 'heroStats'));
}
public function create(Request $request): View
@@ -27,10 +27,17 @@ class DepartmentController extends Controller
->orderBy('name')
->get();
$heroStats = [
'total' => $departments->count(),
'active' => $departments->where('is_active', true)->count(),
'branches' => $departments->pluck('branch_id')->unique()->count(),
];
return view('care.admin.departments.index', [
'departments' => $departments,
'organization' => $organization,
'types' => config('care.department_types'),
'heroStats' => $heroStats,
]);
}
@@ -35,6 +35,16 @@ class DrugController extends Controller
$lowStock = $this->pharmacy->lowStock($this->ownerRef($request), $organization->id);
$expired = $this->pharmacy->expiredBatches($this->ownerRef($request), $organization->id);
$drugQuery = Drug::owned($this->ownerRef($request))
->where('organization_id', $organization->id)
->when($branchScope, fn ($q) => $q->where('branch_id', $branchScope));
$heroStats = [
'total' => (clone $drugQuery)->count(),
'low_stock' => $lowStock->count(),
'expired' => $expired->count(),
];
return view('care.pharmacy.drugs.index', [
'organization' => $organization,
'drugs' => $drugs,
@@ -42,6 +52,7 @@ class DrugController extends Controller
'expired' => $expired,
'canManage' => app(\App\Services\Care\CarePermissions::class)
->can($this->member($request), 'pharmacy.manage'),
'heroStats' => $heroStats,
]);
}
@@ -27,10 +27,19 @@ class MemberController extends Controller
->orderBy('created_at')
->get();
$clinicalRoles = ['doctor', 'nurse', 'lab_technician', 'pharmacist'];
$heroStats = [
'total' => $members->count(),
'clinical' => $members->whereIn('role', $clinicalRoles)->count(),
'branches' => $members->whereNotNull('branch_id')->pluck('branch_id')->unique()->count(),
];
return view('care.admin.members.index', [
'members' => $members,
'organization' => $organization,
'roles' => config('care.roles'),
'heroStats' => $heroStats,
]);
}
@@ -33,7 +33,18 @@ class PatientController extends Controller
$branchScope,
);
return view('care.patients.index', compact('patients', 'organization'));
$owner = $this->ownerRef($request);
$patientQuery = Patient::owned($owner)
->where('organization_id', $organization->id)
->when($branchScope, fn ($q) => $q->where('branch_id', $branchScope));
$heroStats = [
'total' => (clone $patientQuery)->count(),
'new_this_month' => (clone $patientQuery)->where('created_at', '>=', now()->startOfMonth())->count(),
'with_visits' => (clone $patientQuery)->whereHas('appointments')->count(),
];
return view('care.patients.index', compact('patients', 'organization', 'heroStats'));
}
public function create(Request $request): View
@@ -57,6 +57,16 @@ class QueueController extends Controller
$canConsult = app(\App\Services\Care\CarePermissions::class)
->can($this->member($request), 'consultations.manage');
$heroStats = [
'waiting' => $queue->count(),
'in_consultation' => $inConsultation->count(),
'today' => Appointment::owned($this->ownerRef($request))
->where('organization_id', $organization->id)
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
->whereDate('scheduled_at', today())
->count(),
];
return view('care.queue.index', [
'organization' => $organization,
'branches' => $branches,
@@ -71,6 +81,7 @@ class QueueController extends Controller
'inConsultation' => $inConsultation,
'canManageQueue' => $canManageQueue,
'canConsult' => $canConsult,
'heroStats' => $heroStats,
]);
}