@extends('layouts.dashboard') @section('title', 'Live Tracking Dashboard') @section('content')

Live Tracking Dashboard

Active Employees

{{ $activeEmployees->count() }}

Active Visits

{{ $activeVisits->count() }}

Today's Visits

{{ \App\Models\Visit::whereDate('scheduled_date', today())->count() }}

Alerts

@php // SAFELY check if scheduled_end column exists if (\Schema::hasColumn('visits', 'scheduled_end')) { echo \App\Models\Visit::where('scheduled_end', '<', now())->where('status', 'in_progress')->count(); } else { // Fallback to using scheduled_date + duration logic echo \App\Models\Visit::where('status', 'in_progress') ->where('last_location_update', '<', now()->subMinutes(30)) ->count(); } @endphp

Currently Active Employees

@forelse($activeEmployees as $employee) @php $visit = $employee->visits->first(); @endphp @empty @endforelse
Employee Current Location Last Update Actions
{{ $employee->name }}
{{ $employee->employee_id }}
@if($visit && $visit->current_address) {{ Str::limit($visit->current_address, 30) }} @else Not available @endif
@if($visit) {{ $visit->updated_at->diffForHumans() }} @else N/A @endif
@if($visit) @else No active visit @endif

No active employees at the moment

Active Visits

@forelse($activeVisits as $visit) @empty @endforelse
Employee & Client Status Duration Actions
{{ $visit->employee->name ?? 'Unknown' }}
{{ $visit->client->name ?? 'Unknown Client' }}
{{ $visit->scheduled_date->format('H:i') }}
In Progress @if($visit->started_at) {{ $visit->started_at->diffForHumans(null, true) }} @else Not started @endif Track

No active visits at the moment

Live Map View

View all active employees on an interactive map

All Employees

Browse all employees with tracking information

Alerts & Notifications

View tracking alerts and notifications

@endsection