Add hero sections to Visits, Hosts, Employees, Devices, Branches, and Team index pages.
Deploy Ladill Frontdesk / deploy (push) Successful in 1m3s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-05 20:45:30 +00:00
co-authored by Cursor
parent 66299ae166
commit f995606649
13 changed files with 439 additions and 235 deletions
@@ -24,7 +24,13 @@ class BranchController extends Controller
->orderBy('name')
->get();
return view('frontdesk.admin.branches.index', compact('branches', 'organization'));
$heroStats = [
'total' => $branches->count(),
'active' => $branches->where('is_active', true)->count(),
'buildings' => $branches->sum('buildings_count'),
];
return view('frontdesk.admin.branches.index', compact('branches', 'organization', 'heroStats'));
}
public function create(Request $request): View
@@ -27,10 +27,23 @@ class DeviceController extends Controller
->orderBy('name')
->paginate(25);
$statsQuery = Device::owned($this->ownerRef($request))
->where('organization_id', $organization->id);
$heroStats = [
'total' => (clone $statsQuery)->count(),
'online' => (clone $statsQuery)
->where('status', 'online')
->where('last_online_at', '>=', now()->subMinutes(10))
->count(),
'kiosks' => (clone $statsQuery)->where('type', 'kiosk')->count(),
];
return view('frontdesk.devices.index', [
'organization' => $organization,
'devices' => $devices,
'deviceTypes' => config('frontdesk.device_types'),
'heroStats' => $heroStats,
'canManage' => app(\App\Services\Frontdesk\FrontdeskPermissions::class)
->can($this->member($request), 'devices.manage'),
]);
@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use App\Http\Controllers\Frontdesk\Concerns\ScopesToAccount;
use App\Models\Branch;
use App\Models\Employee;
use App\Models\EmployeePresence;
use App\Models\EmployeePresenceEvent;
use App\Models\Host;
use App\Models\Member;
@@ -35,7 +36,17 @@ class EmployeeController extends Controller
$this->scopeToBranch($request, $employees);
$employees = $employees->paginate(25);
return view('frontdesk.employees.index', compact('employees', 'organization'));
$statsQuery = Employee::owned($this->ownerRef($request))
->where('organization_id', $organization->id);
$this->scopeToBranch($request, $statsQuery);
$heroStats = [
'total' => (clone $statsQuery)->count(),
'on_site' => (clone $statsQuery)->whereHas('presence', fn ($q) => $q->where('status', EmployeePresence::STATUS_ON_SITE))->count(),
'active' => (clone $statsQuery)->where('active', true)->count(),
];
return view('frontdesk.employees.index', compact('employees', 'organization', 'heroStats'));
}
public function create(Request $request): View
@@ -25,7 +25,17 @@ class HostController extends Controller
$this->scopeToBranch($request, $hosts);
$hosts = $hosts->orderBy('name')->paginate(25);
return view('frontdesk.hosts.index', compact('hosts', 'organization'));
$statsQuery = Host::owned($this->ownerRef($request))
->where('organization_id', $organization->id);
$this->scopeToBranch($request, $statsQuery);
$heroStats = [
'total' => (clone $statsQuery)->count(),
'available' => (clone $statsQuery)->where('is_available', true)->count(),
'departments' => (clone $statsQuery)->whereNotNull('department')->where('department', '!=', '')->distinct()->count('department'),
];
return view('frontdesk.hosts.index', compact('hosts', 'organization', 'heroStats'));
}
public function create(Request $request): View
@@ -26,10 +26,19 @@ class MemberController extends Controller
->orderBy('created_at')
->get();
$adminRoles = ['super_admin', 'org_admin', 'branch_admin'];
$heroStats = [
'total' => $members->count(),
'admins' => $members->whereIn('role', $adminRoles)->count(),
'branch_scoped' => $members->whereNotNull('branch_id')->count(),
];
return view('frontdesk.admin.members.index', [
'members' => $members,
'organization' => $organization,
'roles' => config('frontdesk.roles'),
'heroStats' => $heroStats,
]);
}
@@ -42,7 +42,17 @@ class VisitController extends Controller
->paginate(25)
->withQueryString();
return view('frontdesk.visits.index', compact('visits', 'organization'));
$statsQuery = Visit::owned($this->ownerRef($request))
->where('organization_id', $organization->id);
$this->scopeToBranch($request, $statsQuery);
$heroStats = [
'on_site' => (clone $statsQuery)->whereIn('status', Visit::ACTIVE_STATUSES)->count(),
'today' => (clone $statsQuery)->whereDate('checked_in_at', today())->count(),
'total' => (clone $statsQuery)->count(),
];
return view('frontdesk.visits.index', compact('visits', 'organization', 'heroStats'));
}
public function calendar(Request $request): View