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') ->orderBy('name')
->get(); ->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 public function create(Request $request): View
@@ -27,10 +27,23 @@ class DeviceController extends Controller
->orderBy('name') ->orderBy('name')
->paginate(25); ->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', [ return view('frontdesk.devices.index', [
'organization' => $organization, 'organization' => $organization,
'devices' => $devices, 'devices' => $devices,
'deviceTypes' => config('frontdesk.device_types'), 'deviceTypes' => config('frontdesk.device_types'),
'heroStats' => $heroStats,
'canManage' => app(\App\Services\Frontdesk\FrontdeskPermissions::class) 'canManage' => app(\App\Services\Frontdesk\FrontdeskPermissions::class)
->can($this->member($request), 'devices.manage'), ->can($this->member($request), 'devices.manage'),
]); ]);
@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use App\Http\Controllers\Frontdesk\Concerns\ScopesToAccount; use App\Http\Controllers\Frontdesk\Concerns\ScopesToAccount;
use App\Models\Branch; use App\Models\Branch;
use App\Models\Employee; use App\Models\Employee;
use App\Models\EmployeePresence;
use App\Models\EmployeePresenceEvent; use App\Models\EmployeePresenceEvent;
use App\Models\Host; use App\Models\Host;
use App\Models\Member; use App\Models\Member;
@@ -35,7 +36,17 @@ class EmployeeController extends Controller
$this->scopeToBranch($request, $employees); $this->scopeToBranch($request, $employees);
$employees = $employees->paginate(25); $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 public function create(Request $request): View
@@ -25,7 +25,17 @@ class HostController extends Controller
$this->scopeToBranch($request, $hosts); $this->scopeToBranch($request, $hosts);
$hosts = $hosts->orderBy('name')->paginate(25); $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 public function create(Request $request): View
@@ -26,10 +26,19 @@ class MemberController extends Controller
->orderBy('created_at') ->orderBy('created_at')
->get(); ->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', [ return view('frontdesk.admin.members.index', [
'members' => $members, 'members' => $members,
'organization' => $organization, 'organization' => $organization,
'roles' => config('frontdesk.roles'), 'roles' => config('frontdesk.roles'),
'heroStats' => $heroStats,
]); ]);
} }
@@ -42,7 +42,17 @@ class VisitController extends Controller
->paginate(25) ->paginate(25)
->withQueryString(); ->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 public function calendar(Request $request): View
@@ -0,0 +1,39 @@
@props([
'badge',
'title',
'description' => null,
'stats' => [],
])
<div {{ $attributes->merge(['class' => 'relative overflow-hidden rounded-2xl border border-slate-200 bg-white']) }}>
<div class="absolute inset-0 bg-gradient-to-br from-indigo-50/80 via-white to-violet-50/60"></div>
<div class="relative px-6 py-8 sm:px-10">
<div class="flex flex-col gap-6 lg:flex-row lg:items-center lg:justify-between">
<div class="max-w-xl">
<div class="inline-flex items-center gap-1.5 rounded-full bg-indigo-100 px-3 py-1 text-xs font-semibold text-indigo-700">
{{ $badge }}
</div>
<h1 class="mt-3 text-2xl font-bold tracking-tight text-slate-900 sm:text-3xl">{{ $title }}</h1>
@if ($description)
<p class="mt-2 text-sm leading-6 text-slate-600">{{ $description }}</p>
@endif
@isset($actions)
<div class="mt-6 flex flex-wrap items-center gap-2">
{{ $actions }}
</div>
@endisset
</div>
@if (count($stats) > 0)
<div class="scrollbar-hide flex snap-x snap-mandatory gap-3 overflow-x-auto pb-2 sm:grid sm:grid-cols-3 sm:overflow-visible sm:pb-0 lg:gap-4" style="-ms-overflow-style:none;scrollbar-width:none;">
@foreach ($stats as $stat)
<div class="mobile-stats-card shrink-0 snap-start rounded-xl border border-slate-200 bg-white/90 px-4 py-3 text-center backdrop-blur-sm">
<p class="whitespace-nowrap text-xl font-bold text-slate-900 sm:text-2xl">{{ $stat['value'] }}</p>
<p class="mt-0.5 whitespace-nowrap text-[11px] font-medium text-slate-500">{{ $stat['label'] }}</p>
</div>
@endforeach
</div>
@endif
</div>
</div>
</div>
@@ -1,25 +1,49 @@
<x-app-layout title="Branches"> @php
<div class="flex items-center justify-between"> $canManageBranches = app(\App\Services\Frontdesk\FrontdeskPermissions::class)->can(
<h1 class="text-xl font-semibold text-slate-900">Branches</h1> auth()->user() ? app(\App\Services\Frontdesk\OrganizationResolver::class)->memberFor(auth()->user(), $organization) : null,
@if (app(\App\Services\Frontdesk\FrontdeskPermissions::class)->can(auth()->user() ? app(\App\Services\Frontdesk\OrganizationResolver::class)->memberFor(auth()->user(), $organization) : null, 'admin.branches.manage')) 'admin.branches.manage'
<a href="{{ route('frontdesk.branches.create') }}" class="btn-primary">Add branch</a> );
@endif @endphp
</div>
<div class="mt-4 space-y-3"> <x-app-layout title="Branches">
@forelse ($branches as $branch) <div class="space-y-6">
<div class="flex items-center justify-between rounded-2xl border border-slate-200 bg-white p-4"> <x-frontdesk.page-hero
<div> badge="Locations · Buildings · Reception desks"
<p class="font-medium text-slate-900">{{ $branch->name }}</p> title="Branches"
<p class="text-sm text-slate-500">{{ $branch->address ?? 'No address' }} · {{ $branch->buildings_count }} building(s)</p> description="Organize your sites, buildings, and reception desks so visits and devices stay scoped to the right location."
</div> :stats="[
<div class="flex gap-2"> ['value' => number_format($heroStats['total']), 'label' => 'Branches'],
<a href="{{ route('frontdesk.buildings.index', $branch) }}" class="text-sm text-indigo-600 hover:text-indigo-700">Buildings</a> ['value' => number_format($heroStats['active']), 'label' => 'Active'],
<a href="{{ route('frontdesk.branches.edit', $branch) }}" class="text-sm text-slate-600 hover:text-slate-800">Edit</a> ['value' => number_format($heroStats['buildings']), 'label' => 'Buildings'],
</div> ]">
@if ($canManageBranches)
<x-slot name="actions">
<a href="{{ route('frontdesk.branches.create') }}" class="btn-primary">
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg>
Add branch
</a>
</x-slot>
@endif
</x-frontdesk.page-hero>
<div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<div class="border-b border-slate-100 px-6 py-4">
<h2 class="text-sm font-semibold text-slate-900">All branches</h2>
</div> </div>
@empty @forelse ($branches as $branch)
<p class="text-sm text-slate-500">No branches yet.</p> <div class="flex items-center justify-between border-b border-slate-50 px-6 py-4 last:border-b-0">
@endforelse <div>
<p class="font-medium text-slate-900">{{ $branch->name }}</p>
<p class="text-sm text-slate-500">{{ $branch->address ?? 'No address' }} · {{ $branch->buildings_count }} building(s)</p>
</div>
<div class="flex gap-2">
<a href="{{ route('frontdesk.buildings.index', $branch) }}" class="text-sm text-indigo-600 hover:text-indigo-700">Buildings</a>
<a href="{{ route('frontdesk.branches.edit', $branch) }}" class="text-sm text-slate-600 hover:text-slate-800">Edit</a>
</div>
</div>
@empty
<p class="px-6 py-10 text-center text-sm text-slate-500">No branches yet.</p>
@endforelse
</div>
</div> </div>
</x-app-layout> </x-app-layout>
@@ -1,36 +1,53 @@
<x-app-layout title="Team members"> <x-app-layout title="Team">
<div class="flex items-center justify-between"> <div class="space-y-6">
<h1 class="text-xl font-semibold text-slate-900">Team members</h1> <x-frontdesk.page-hero
<a href="{{ route('frontdesk.members.create') }}" class="btn-primary">Add member</a> badge="Roles · Access · Branch scope"
</div> title="Team"
description="Invite colleagues, assign Frontdesk roles, and limit branch access for reception and security staff."
:stats="[
['value' => number_format($heroStats['total']), 'label' => 'Members'],
['value' => number_format($heroStats['admins']), 'label' => 'Administrators'],
['value' => number_format($heroStats['branch_scoped']), 'label' => 'Branch-scoped'],
]">
<x-slot name="actions">
<a href="{{ route('frontdesk.members.create') }}" class="btn-primary">
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg>
Add member
</a>
</x-slot>
</x-frontdesk.page-hero>
<div class="mt-4 overflow-hidden rounded-2xl border border-slate-200 bg-white"> <div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<table class="min-w-full text-sm"> <div class="border-b border-slate-100 px-6 py-4">
<thead class="bg-slate-50 text-left text-xs uppercase text-slate-500"> <h2 class="text-sm font-semibold text-slate-900">Team members</h2>
<tr><th class="px-4 py-3">Member</th><th class="px-4 py-3">Role</th><th class="px-4 py-3">Branch</th><th class="px-4 py-3"></th></tr> </div>
</thead> <table class="min-w-full text-sm">
<tbody class="divide-y divide-slate-50"> <thead class="bg-slate-50 text-left text-xs uppercase text-slate-500">
@foreach ($members as $member) <tr><th class="px-4 py-3">Member</th><th class="px-4 py-3">Role</th><th class="px-4 py-3">Branch</th><th class="px-4 py-3"></th></tr>
@php </thead>
$display = str_contains($member->user_ref, '@') <tbody class="divide-y divide-slate-50">
? $member->user_ref @foreach ($members as $member)
: (\App\Models\User::where('public_id', $member->user_ref)->value('email') ?? $member->user_ref); @php
@endphp $display = str_contains($member->user_ref, '@')
<tr> ? $member->user_ref
<td class="px-4 py-3 text-sm">{{ $display }}</td> : (\App\Models\User::where('public_id', $member->user_ref)->value('email') ?? $member->user_ref);
<td class="px-4 py-3">{{ $roles[$member->role] ?? $member->role }}</td> @endphp
<td class="px-4 py-3">{{ $member->branch?->name ?? 'All branches' }}</td> <tr>
<td class="px-4 py-3 text-right"> <td class="px-4 py-3 text-sm">{{ $display }}</td>
@if ($member->user_ref !== auth()->user()->public_id) <td class="px-4 py-3">{{ $roles[$member->role] ?? $member->role }}</td>
<form method="POST" action="{{ route('frontdesk.members.destroy', $member) }}" class="inline" onsubmit="return confirm('Remove this member?')"> <td class="px-4 py-3">{{ $member->branch?->name ?? 'All branches' }}</td>
@csrf @method('DELETE') <td class="px-4 py-3 text-right">
<button type="submit" class="text-red-600">Remove</button> @if ($member->user_ref !== auth()->user()->public_id)
</form> <form method="POST" action="{{ route('frontdesk.members.destroy', $member) }}" class="inline" onsubmit="return confirm('Remove this member?')">
@endif @csrf @method('DELETE')
</td> <button type="submit" class="text-red-600">Remove</button>
</tr> </form>
@endforeach @endif
</tbody> </td>
</table> </tr>
@endforeach
</tbody>
</table>
</div>
</div> </div>
</x-app-layout> </x-app-layout>
@@ -1,58 +1,73 @@
<x-app-layout title="Devices"> <x-app-layout title="Devices">
<div class="flex items-center justify-between"> <div class="space-y-6">
<div> <x-frontdesk.page-hero
<h1 class="text-xl font-semibold text-slate-900">Devices</h1> badge="Kiosks · Printers · Reception hardware"
<p class="text-sm text-slate-500">Kiosks, printers, and reception hardware</p> title="Devices"
</div> description="Register and monitor kiosks, badge printers, and reception hardware across your branches."
@if ($canManage) :stats="[
<a href="{{ route('frontdesk.devices.create') }}" class="btn-primary">Add device</a> ['value' => number_format($heroStats['total']), 'label' => 'Devices'],
@endif ['value' => number_format($heroStats['online']), 'label' => 'Online'],
</div> ['value' => number_format($heroStats['kiosks']), 'label' => 'Kiosks'],
]">
@if ($canManage)
<x-slot name="actions">
<a href="{{ route('frontdesk.devices.create') }}" class="btn-primary">
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg>
Add device
</a>
</x-slot>
@endif
</x-frontdesk.page-hero>
<div class="mt-4 overflow-hidden rounded-2xl border border-slate-200 bg-white"> <div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<table class="min-w-full divide-y divide-slate-100 text-sm"> <div class="border-b border-slate-100 px-6 py-4">
<thead class="bg-slate-50 text-left text-xs uppercase text-slate-500"> <h2 class="text-sm font-semibold text-slate-900">All devices</h2>
<tr> </div>
<th class="px-4 py-3">Name</th> <table class="min-w-full divide-y divide-slate-100 text-sm">
<th class="px-4 py-3">Type</th> <thead class="bg-slate-50 text-left text-xs uppercase text-slate-500">
<th class="px-4 py-3">Status</th>
<th class="px-4 py-3">Desk / branch</th>
<th class="px-4 py-3">Last online</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-slate-50">
@forelse ($devices as $device)
<tr> <tr>
<td class="px-4 py-3 font-medium">{{ $device->name }}</td> <th class="px-4 py-3">Name</th>
<td class="px-4 py-3 text-slate-600">{{ $deviceTypes[$device->type] ?? $device->type }}</td> <th class="px-4 py-3">Type</th>
<td class="px-4 py-3"> <th class="px-4 py-3">Status</th>
<span class="inline-flex rounded-full px-2 py-0.5 text-xs font-medium {{ $device->isOnline() ? 'bg-emerald-100 text-emerald-800' : 'bg-slate-100 text-slate-600' }}"> <th class="px-4 py-3">Desk / branch</th>
{{ $device->isOnline() ? 'Online' : ucfirst($device->status) }} <th class="px-4 py-3">Last online</th>
</span> <th class="px-4 py-3"></th>
</td>
<td class="px-4 py-3 text-slate-600">
{{ $device->receptionDesk?->name ?? '—' }}
@if ($device->branch)
<span class="text-slate-400">· {{ $device->branch->name }}</span>
@endif
</td>
<td class="px-4 py-3 text-slate-500">{{ $device->last_online_at?->diffForHumans() ?? 'Never' }}</td>
<td class="px-4 py-3 text-right">
@if ($canManage)
<a href="{{ route('frontdesk.devices.edit', $device) }}" class="text-indigo-700 hover:underline">Edit</a>
@endif
@if ($device->type === 'kiosk' && $device->device_token)
<a href="{{ route('frontdesk.kiosk.device', $device->device_token) }}" target="_blank" class="ml-3 text-indigo-700 hover:underline">Open kiosk</a>
@endif
</td>
</tr> </tr>
@empty </thead>
<tr><td colspan="6" class="px-4 py-8 text-center text-slate-500">No devices registered yet.</td></tr> <tbody class="divide-y divide-slate-50">
@endforelse @forelse ($devices as $device)
</tbody> <tr>
</table> <td class="px-4 py-3 font-medium">{{ $device->name }}</td>
<td class="px-4 py-3 text-slate-600">{{ $deviceTypes[$device->type] ?? $device->type }}</td>
<td class="px-4 py-3">
<span class="inline-flex rounded-full px-2 py-0.5 text-xs font-medium {{ $device->isOnline() ? 'bg-emerald-100 text-emerald-800' : 'bg-slate-100 text-slate-600' }}">
{{ $device->isOnline() ? 'Online' : ucfirst($device->status) }}
</span>
</td>
<td class="px-4 py-3 text-slate-600">
{{ $device->receptionDesk?->name ?? '—' }}
@if ($device->branch)
<span class="text-slate-400">· {{ $device->branch->name }}</span>
@endif
</td>
<td class="px-4 py-3 text-slate-500">{{ $device->last_online_at?->diffForHumans() ?? 'Never' }}</td>
<td class="px-4 py-3 text-right">
@if ($canManage)
<a href="{{ route('frontdesk.devices.edit', $device) }}" class="text-indigo-700 hover:underline">Edit</a>
@endif
@if ($device->type === 'kiosk' && $device->device_token)
<a href="{{ route('frontdesk.kiosk.device', $device->device_token) }}" target="_blank" class="ml-3 text-indigo-700 hover:underline">Open kiosk</a>
@endif
</td>
</tr>
@empty
<tr><td colspan="6" class="px-4 py-8 text-center text-slate-500">No devices registered yet.</td></tr>
@endforelse
</tbody>
</table>
@if ($devices->hasPages())
<div class="border-t border-slate-100 px-5 py-3">{{ $devices->links() }}</div>
@endif
</div>
</div> </div>
{{ $devices->links() }}
</x-app-layout> </x-app-layout>
@@ -1,54 +1,71 @@
<x-app-layout title="Employees"> <x-app-layout title="Employees">
<div class="flex flex-wrap items-center justify-between gap-3"> <div class="space-y-6">
<h1 class="text-xl font-semibold text-slate-900">Employees</h1> <x-frontdesk.page-hero
<div class="flex gap-2"> badge="Staff sign-in · Presence · Attendance"
<a href="{{ route('frontdesk.employees.export.attendance') }}" class="rounded-lg border border-slate-200 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Export attendance</a> title="Employees"
<a href="{{ route('frontdesk.employees.import') }}" class="rounded-lg border border-slate-200 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Import CSV</a> description="Register staff who sign in at the kiosk, track on-site presence, and export attendance records."
<a href="{{ route('frontdesk.employees.create') }}" class="btn-primary">Add employee</a> :stats="[
['value' => number_format($heroStats['total']), 'label' => 'Employees'],
['value' => number_format($heroStats['on_site']), 'label' => 'On site'],
['value' => number_format($heroStats['active']), 'label' => 'Active'],
]">
<x-slot name="actions">
<a href="{{ route('frontdesk.employees.export.attendance') }}" class="btn-secondary">Export attendance</a>
<a href="{{ route('frontdesk.employees.import') }}" class="btn-secondary">Import CSV</a>
<a href="{{ route('frontdesk.employees.create') }}" class="btn-primary">
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg>
Add employee
</a>
</x-slot>
</x-frontdesk.page-hero>
<div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<div class="border-b border-slate-100 px-6 py-4">
<h2 class="text-sm font-semibold text-slate-900">All employees</h2>
</div>
<table class="min-w-full divide-y divide-slate-100 text-sm">
<thead class="bg-slate-50 text-left text-xs uppercase text-slate-500">
<tr>
<th class="px-4 py-3">Name</th>
<th class="px-4 py-3">Code</th>
<th class="px-4 py-3">Department</th>
<th class="px-4 py-3">Status</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-slate-50">
@forelse ($employees as $employee)
@php
$presence = $employee->presence;
$status = $presence?->status ?? 'off_site';
$statusLabel = config('frontdesk.employee_presence_statuses.'.$status, $status);
@endphp
<tr>
<td class="px-4 py-3 font-medium">{{ $employee->full_name }}</td>
<td class="px-4 py-3 font-mono text-slate-600">{{ $employee->employee_code }}</td>
<td class="px-4 py-3 text-slate-600">{{ $employee->department ?? '—' }}</td>
<td class="px-4 py-3">
<span class="rounded-full px-2.5 py-0.5 text-xs font-medium
{{ $status === 'on_site' ? 'bg-emerald-50 text-emerald-700' : ($status === 'stepped_out' ? 'bg-amber-50 text-amber-800' : 'bg-slate-100 text-slate-600') }}">
{{ $statusLabel }}
</span>
@if ($presence?->destination)
<span class="mt-0.5 block text-xs text-slate-400">{{ $presence->destination }}</span>
@endif
</td>
<td class="px-4 py-3 text-right">
<a href="{{ route('frontdesk.employees.badge', $employee) }}" target="_blank" class="text-sm text-slate-600">Badge</a>
<a href="{{ route('frontdesk.employees.edit', $employee) }}" class="ml-3 text-sm text-indigo-600">Edit</a>
</td>
</tr>
@empty
<tr><td colspan="5" class="px-4 py-8 text-center text-slate-400">No employees yet. Add staff who will sign in at the kiosk.</td></tr>
@endforelse
</tbody>
</table>
@if ($employees->hasPages())
<div class="border-t border-slate-100 px-5 py-3">{{ $employees->links() }}</div>
@endif
</div> </div>
</div> </div>
<div class="mt-4 overflow-hidden rounded-2xl border border-slate-200 bg-white">
<table class="min-w-full divide-y divide-slate-100 text-sm">
<thead class="bg-slate-50 text-left text-xs uppercase text-slate-500">
<tr>
<th class="px-4 py-3">Name</th>
<th class="px-4 py-3">Code</th>
<th class="px-4 py-3">Department</th>
<th class="px-4 py-3">Status</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-slate-50">
@forelse ($employees as $employee)
@php
$presence = $employee->presence;
$status = $presence?->status ?? 'off_site';
$statusLabel = config('frontdesk.employee_presence_statuses.'.$status, $status);
@endphp
<tr>
<td class="px-4 py-3 font-medium">{{ $employee->full_name }}</td>
<td class="px-4 py-3 font-mono text-slate-600">{{ $employee->employee_code }}</td>
<td class="px-4 py-3 text-slate-600">{{ $employee->department ?? '—' }}</td>
<td class="px-4 py-3">
<span class="rounded-full px-2.5 py-0.5 text-xs font-medium
{{ $status === 'on_site' ? 'bg-emerald-50 text-emerald-700' : ($status === 'stepped_out' ? 'bg-amber-50 text-amber-800' : 'bg-slate-100 text-slate-600') }}">
{{ $statusLabel }}
</span>
@if ($presence?->destination)
<span class="mt-0.5 block text-xs text-slate-400">{{ $presence->destination }}</span>
@endif
</td>
<td class="px-4 py-3 text-right">
<a href="{{ route('frontdesk.employees.badge', $employee) }}" target="_blank" class="text-sm text-slate-600">Badge</a>
<a href="{{ route('frontdesk.employees.edit', $employee) }}" class="ml-3 text-sm text-indigo-600">Edit</a>
</td>
</tr>
@empty
<tr><td colspan="5" class="px-4 py-8 text-center text-slate-400">No employees yet. Add staff who will sign in at the kiosk.</td></tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-4">{{ $employees->links() }}</div>
</x-app-layout> </x-app-layout>
+49 -30
View File
@@ -1,36 +1,55 @@
<x-app-layout title="Host directory"> <x-app-layout title="Host directory">
<div class="flex items-center justify-between"> <div class="space-y-6">
<h1 class="text-xl font-semibold text-slate-900">Host directory</h1> <x-frontdesk.page-hero
<a href="{{ route('frontdesk.hosts.create') }}" class="btn-primary">Add host</a> badge="Host directory · Notifications · Departments"
</div> title="Hosts"
description="Manage the people visitors come to see — hosts receive arrival alerts and approve visits."
:stats="[
['value' => number_format($heroStats['total']), 'label' => 'Hosts'],
['value' => number_format($heroStats['available']), 'label' => 'Available'],
['value' => number_format($heroStats['departments']), 'label' => 'Departments'],
]">
<x-slot name="actions">
<a href="{{ route('frontdesk.hosts.create') }}" class="btn-primary">
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg>
Add host
</a>
</x-slot>
</x-frontdesk.page-hero>
<div class="mt-4 overflow-hidden rounded-2xl border border-slate-200 bg-white"> <div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<table class="min-w-full divide-y divide-slate-100 text-sm"> <div class="border-b border-slate-100 px-6 py-4">
<thead class="bg-slate-50 text-left text-xs uppercase text-slate-500"> <h2 class="text-sm font-semibold text-slate-900">All hosts</h2>
<tr> </div>
<th class="px-4 py-3">Name</th> <table class="min-w-full divide-y divide-slate-100 text-sm">
<th class="px-4 py-3">Department</th> <thead class="bg-slate-50 text-left text-xs uppercase text-slate-500">
<th class="px-4 py-3">Office</th>
<th class="px-4 py-3">Contact</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-slate-50">
@forelse ($hosts as $host)
<tr> <tr>
<td class="px-4 py-3 font-medium">{{ $host->name }}</td> <th class="px-4 py-3">Name</th>
<td class="px-4 py-3 text-slate-600">{{ $host->department ?? '—' }}</td> <th class="px-4 py-3">Department</th>
<td class="px-4 py-3 text-slate-600">{{ $host->office ?? '—' }}</td> <th class="px-4 py-3">Office</th>
<td class="px-4 py-3 text-slate-600">{{ $host->email ?? $host->phone ?? '—' }}</td> <th class="px-4 py-3">Contact</th>
<td class="px-4 py-3 text-right"> <th class="px-4 py-3"></th>
<a href="{{ route('frontdesk.hosts.edit', $host) }}" class="text-sm text-indigo-600">Edit</a>
</td>
</tr> </tr>
@empty </thead>
<tr><td colspan="4" class="px-4 py-8 text-center text-slate-400">No hosts yet. Add your first host to enable visitor notifications.</td></tr> <tbody class="divide-y divide-slate-50">
@endforelse @forelse ($hosts as $host)
</tbody> <tr>
</table> <td class="px-4 py-3 font-medium">{{ $host->name }}</td>
<td class="px-4 py-3 text-slate-600">{{ $host->department ?? '—' }}</td>
<td class="px-4 py-3 text-slate-600">{{ $host->office ?? '—' }}</td>
<td class="px-4 py-3 text-slate-600">{{ $host->email ?? $host->phone ?? '—' }}</td>
<td class="px-4 py-3 text-right">
<a href="{{ route('frontdesk.hosts.edit', $host) }}" class="text-sm text-indigo-600">Edit</a>
</td>
</tr>
@empty
<tr><td colspan="5" class="px-4 py-8 text-center text-slate-400">No hosts yet. Add your first host to enable visitor notifications.</td></tr>
@endforelse
</tbody>
</table>
@if ($hosts->hasPages())
<div class="border-t border-slate-100 px-5 py-3">{{ $hosts->links() }}</div>
@endif
</div>
</div> </div>
<div class="mt-4">{{ $hosts->links() }}</div>
</x-app-layout> </x-app-layout>
@@ -1,51 +1,65 @@
<x-app-layout title="Visit history"> <x-app-layout title="Visit history">
<div class="flex items-center justify-between gap-3"> <div class="space-y-6">
<h1 class="min-w-0 flex-1 truncate text-lg font-semibold text-slate-900 lg:text-xl">Visits</h1> <x-frontdesk.page-hero
@include('frontdesk.partials.reception-quick-actions', [ badge="Check-in · Badges · Visit history"
'desktopSchedule' => 'Schedule', title="Visits"
'desktopCheckIn' => 'Check in', description="Track visitor arrivals, scheduled appointments, and on-site activity across your locations."
'scheduleLabel' => 'Schedule visit', :stats="[
'checkInLabel' => 'Check in visitor', ['value' => number_format($heroStats['on_site']), 'label' => 'On site now'],
]) ['value' => number_format($heroStats['today']), 'label' => 'Checked in today'],
</div> ['value' => number_format($heroStats['total']), 'label' => 'All visits'],
]">
<x-slot name="actions">
<a href="{{ route('frontdesk.visits.schedule') }}" class="btn-secondary">Schedule visit</a>
<a href="{{ route('frontdesk.visits.create') }}" class="btn-primary">
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg>
Check in visitor
</a>
</x-slot>
</x-frontdesk.page-hero>
<form method="GET" class="mt-4 flex gap-2"> <form method="GET" class="flex flex-wrap gap-2">
<input type="search" name="q" value="{{ request('q') }}" placeholder="Search visitors…" class="rounded-lg border-slate-300 text-sm"> <input type="search" name="q" value="{{ request('q') }}" placeholder="Search visitors…" class="rounded-lg border-slate-300 text-sm">
<select name="status" class="rounded-lg border-slate-300 text-sm"> <select name="status" class="rounded-lg border-slate-300 text-sm">
<option value="">All statuses</option> <option value="">All statuses</option>
@foreach (config('frontdesk.visit_statuses') as $key => $label) @foreach (config('frontdesk.visit_statuses') as $key => $label)
<option value="{{ $key }}" @selected(request('status') === $key)>{{ $label }}</option> <option value="{{ $key }}" @selected(request('status') === $key)>{{ $label }}</option>
@endforeach @endforeach
</select> </select>
<button type="submit" class="rounded-lg border border-slate-200 px-4 py-2 text-sm">Filter</button> <button type="submit" class="rounded-lg border border-slate-200 px-4 py-2 text-sm">Filter</button>
</form> </form>
<div class="mt-4 overflow-hidden rounded-2xl border border-slate-200 bg-white"> <div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<table class="min-w-full divide-y divide-slate-100 text-sm"> <div class="border-b border-slate-100 px-6 py-4">
<thead class="bg-slate-50 text-left text-xs uppercase text-slate-500"> <h2 class="text-sm font-semibold text-slate-900">Visit history</h2>
<tr> </div>
<th class="px-4 py-3">Visitor</th> <table class="min-w-full divide-y divide-slate-100 text-sm">
<th class="px-4 py-3">Host</th> <thead class="bg-slate-50 text-left text-xs uppercase text-slate-500">
<th class="px-4 py-3">Type</th> <tr>
<th class="px-4 py-3">Status</th> <th class="px-4 py-3">Visitor</th>
<th class="px-4 py-3">Time</th> <th class="px-4 py-3">Host</th>
</tr> <th class="px-4 py-3">Type</th>
</thead> <th class="px-4 py-3">Status</th>
<tbody class="divide-y divide-slate-50"> <th class="px-4 py-3">Time</th>
@forelse ($visits as $visit)
<tr class="hover:bg-slate-50">
<td class="px-4 py-3"><a href="{{ route('frontdesk.visits.show', $visit) }}" class="font-medium text-indigo-700">{{ $visit->visitor->full_name }}</a></td>
<td class="px-4 py-3 text-slate-600">{{ $visit->host?->name ?? '—' }}</td>
<td class="px-4 py-3 capitalize text-slate-600">{{ str_replace('_', ' ', $visit->visitor_type) }}</td>
<td class="px-4 py-3 capitalize text-slate-600">{{ str_replace('_', ' ', $visit->status) }}</td>
<td class="px-4 py-3 text-slate-500">{{ $visit->checked_in_at?->format('M j, g:i A') ?? $visit->scheduled_at?->format('M j, g:i A') ?? $visit->created_at->format('M j, g:i A') }}</td>
</tr> </tr>
@empty </thead>
<tr><td colspan="5" class="px-4 py-8 text-center text-slate-400">No visits yet.</td></tr> <tbody class="divide-y divide-slate-50">
@endforelse @forelse ($visits as $visit)
</tbody> <tr class="hover:bg-slate-50">
</table> <td class="px-4 py-3"><a href="{{ route('frontdesk.visits.show', $visit) }}" class="font-medium text-indigo-700">{{ $visit->visitor->full_name }}</a></td>
<td class="px-4 py-3 text-slate-600">{{ $visit->host?->name ?? '—' }}</td>
<td class="px-4 py-3 capitalize text-slate-600">{{ str_replace('_', ' ', $visit->visitor_type) }}</td>
<td class="px-4 py-3 capitalize text-slate-600">{{ str_replace('_', ' ', $visit->status) }}</td>
<td class="px-4 py-3 text-slate-500">{{ $visit->checked_in_at?->format('M j, g:i A') ?? $visit->scheduled_at?->format('M j, g:i A') ?? $visit->created_at->format('M j, g:i A') }}</td>
</tr>
@empty
<tr><td colspan="5" class="px-4 py-8 text-center text-slate-400">No visits yet.</td></tr>
@endforelse
</tbody>
</table>
@if ($visits->hasPages())
<div class="border-t border-slate-100 px-5 py-3">{{ $visits->links() }}</div>
@endif
</div>
</div> </div>
<div class="mt-4">{{ $visits->links() }}</div>
</x-app-layout> </x-app-layout>