{{-- ─── STAT CARDS ─────────────────────────────────────── --}}
{{-- On-Site --}}

On-Site Now

{{ $stats['onSiteCount'] }}

of {{ $stats['totalWorkers'] }} active workers

@php $pctOnsite = $stats['totalWorkers'] > 0 ? ($stats['onSiteCount'] / $stats['totalWorkers']) * 100 : 0; @endphp
{{-- Away --}}

Away / Out

{{ $stats['awayCount'] }}

{{ $stats['noRecord'] }} no record yet

@php $pctAway = $stats['totalWorkers'] > 0 ? ($stats['awayCount'] / $stats['totalWorkers']) * 100 : 0; @endphp
{{-- Check-Ins Today --}}

Check-Ins Today

{{ $stats['checkInsToday'] }}

{{ $stats['checkOutsToday'] }} check-outs

↑ {{ $stats['checkInsToday'] }} in ↓ {{ $stats['checkOutsToday'] }} out
{{-- Violations --}}

Geofence Alerts

{{ $stats['geofenceViolationsToday'] }}

violations today

@if($stats['geofenceViolationsToday'] > 0)
⚠ Review Attendance Logs
@else
@endif
{{-- ─── LIVE OPERATIONS MAP ────────────────────────────── --}}

Live Operations Map

Site Geofence
Inside Geofence
Geofence Violation
{{-- ─── MAIN GRID: PRESENCE TABLE + RIGHT SIDEBAR ────────── --}}
{{-- Live Presence Table ──────────────────────── --}}

Live Worker Presence

Refreshes every 10s
{{-- Active filter banner --}}
Filtering by site:
@if($livePresence->isEmpty())

No presence records yet

Open the Simulator to trigger events

@else
@foreach($livePresence as $p) @endforeach
Worker Site Status Method Last Seen Signal
{{ strtoupper(substr($p['worker'], 0, 1)) }}
{{ $p['worker'] }}
{{ $p['site'] }} @if($p['status'] === 'present') Present @else Away @endif @if($p['last_event'] === 'nfc') ⬡ NFC @elseif($p['last_event'] === 'geofence') 📍 GEO @else 〰 BLE @endif {{ $p['last_seen_at'] }} @if($p['last_seen_ago'] !== null) @php $m = $p['last_seen_ago']; if ($m < 1) { echo 'just now'; } elseif ($m < 60) { echo $m . 'm ago'; } elseif ($m < 1440) { echo floor($m / 60) . 'h ago'; } else { echo floor($m / 1440) . 'd ago'; } @endphp @endif @if($p['rssi'] !== null) @php $rssiClass = $p['rssi'] >= -60 ? 'text-emerald-600 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-900/20' : ($p['rssi'] >= -80 ? 'text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20' : 'text-rose-600 dark:text-rose-400 bg-rose-50 dark:bg-rose-900/20'); @endphp {{ $p['rssi'] }} @else @endif
@endif
{{-- Right Sidebar ─────────────────────────────── --}}
{{-- Site Headcount --}}

Site Headcount

@if($siteBreakdown->isEmpty())

No workers on-site

@else
@foreach($siteBreakdown as $row)
{{ $row['site'] }} {{ $row['count'] }}
@php $pct = $stats['totalWorkers'] > 0 ? ($row['count'] / $stats['totalWorkers']) * 100 : 0; @endphp
@endforeach
@endif
{{-- Quick Links --}}

Quick Access

@foreach([ ['href' => '/admin/attendance-logs', 'icon' => 'heroicon-o-clipboard-document-check', 'color' => 'text-primary-500', 'bg' => 'bg-primary-50 dark:bg-primary-900/20', 'label' => 'Attendance Logs'], ['href' => '/admin/presence-logs', 'icon' => 'heroicon-o-signal', 'color' => 'text-purple-500', 'bg' => 'bg-purple-50 dark:bg-purple-900/20', 'label' => 'BLE Presence Logs'], ['href' => '/admin/worker-timesheet','icon' => 'heroicon-o-calendar-days', 'color' => 'text-emerald-500','bg' => 'bg-emerald-50 dark:bg-emerald-900/20','label' => 'Timesheets'], ['href' => '/simulator', 'icon' => 'heroicon-o-device-phone-mobile', 'color' => 'text-blue-500', 'bg' => 'bg-blue-50 dark:bg-blue-900/20', 'label' => 'Supervisor Simulator'], ] as $link)
{{ $link['label'] }}
@endforeach
{{-- ─── TODAY'S ACTIVITY FEED ─────────────────────────── --}}

Today's NFC Activity

View All
@if($todayFeed->isEmpty())

No NFC events today

Open Simulator and trigger some check-ins

@else
@foreach($todayFeed as $entry) @endforeach
Time Worker Site Event PIN Geofence
{{ $entry['timestamp'] }} {{ $entry['worker'] }} {{ $entry['site'] }} @if($entry['direction'] === 'in') ↑ Check-In @elseif($entry['direction'] === 'violation') ⚠ Violation @else ↓ Check-Out @endif @if($entry['pin_verified']) @else @endif @if($entry['geofence_ok'] === true) @elseif($entry['geofence_ok'] === false) @else @endif
@endif