@extends('layouts.app') @section('title', 'Dashboard') @section('content') @include('partials.flash') @php $tiles = [ ['label' => 'Care Workers', 'value' => $stats['learners'], 'icon' => 'group', 'href' => \Illuminate\Support\Facades\Route::has('admin.users.index') ? route('admin.users.index') : null], ['label' => 'Compliance', 'value' => $stats['compliance'].'%', 'icon' => 'verified_user', 'href' => \Illuminate\Support\Facades\Route::has('admin.compliance.index') ? route('admin.compliance.index') : null], ['label' => 'Published Courses', 'value' => $stats['courses_published'], 'icon' => 'school', 'sub' => $stats['courses_total'].' total', 'href' => \Illuminate\Support\Facades\Route::has('admin.courses.index') ? route('admin.courses.index') : null], ['label' => 'Services', 'value' => $stats['services'], 'icon' => 'holiday_village', 'href' => \Illuminate\Support\Facades\Route::has('admin.services.index') ? route('admin.services.index') : null], ['label' => 'Overdue Courses', 'value' => $stats['overdue'], 'icon' => 'warning', 'tone' => 'text-error', 'href' => \Illuminate\Support\Facades\Route::has('admin.compliance.index') ? route('admin.compliance.index') : null], ]; @endphp {{-- KPI tiles --}}
@foreach($tiles as $t) <{{ $t['href'] ? 'a' : 'div' }} @if($t['href']) href="{{ $t['href'] }}" @endif class="surface-card rounded-xl p-5 {{ $t['href'] ? 'hover:bg-surface-container-high transition-colors' : '' }}">
{{ $t['icon'] }}

{{ $t['value'] }}

{{ $t['label'] }}

@isset($t['sub'])

{{ $t['sub'] }}

@endisset @endforeach
{{-- Training status donut --}} @include('management._status-donut', [ 'mix' => $status, 'overdueHref' => \Illuminate\Support\Facades\Route::has('admin.compliance.index') ? route('admin.compliance.index', ['overdue' => 1]) : null, ]) {{-- Completions trend --}}

Training completed

Completions per month · last 12 months

@php $W = 640; $H = 200; $pl = 8; $pr = 8; $pt = 14; $pb = 26; $n = count($monthly); $xf = fn ($i) => $pl + ($n <= 1 ? 0 : $i * ($W - $pl - $pr) / ($n - 1)); $yf = fn ($v) => $pt + ($H - $pt - $pb) * (1 - $v / $monthlyMax); $pts = collect($monthly)->map(fn ($p, $i) => round($xf($i), 1).','.round($yf($p['count']), 1)); $area = 'M '.round($xf(0), 1).','.round($H - $pb, 1).' L '.$pts->implode(' L ').' L '.round($xf($n - 1), 1).','.round($H - $pb, 1).' Z'; @endphp @foreach($monthly as $i => $p) {{ $p['full'] }}: {{ $p['count'] }} {{ $p['label'] }} @endforeach
{{-- Users by role --}}

Users by role ({{ $stats['users'] }})

@foreach($rolesView as $r)
{{ $r['label'] }}
{{ $r['count'] }}
@endforeach
{{-- Biggest gaps --}}

Biggest training gaps

@forelse($gaps as $g)
{{ $g->title }} {{ $g->overdue }}
@empty

No overdue training — nice work.

@endforelse
{{-- Recent activity --}}
history

Recent activity

@if(\Illuminate\Support\Facades\Route::has('admin.logs')) Audit log → @endif
{{-- Upcoming sessions + email status --}}
{{ $emailEnabled ? 'mark_email_read' : 'unsubscribe' }}

Email

{{ $emailEnabled ? 'On — assignment & reminder emails send.' : 'Off — in-app notifications only.' }}

@if(\Illuminate\Support\Facades\Route::has('admin.settings')) Configure → @endif
{{-- Background jobs (queue) --}} @isset($queue)
deployed_code

Background jobs

@if($queue['waiting'] > 0)

{{ $queue['waiting'] }} waiting — is the worker running?

@elseif($queue['failed'] > 0)

{{ $queue['failed'] }} failed {{ \Illuminate\Support\Str::plural('job', $queue['failed']) }} need attention.

@else

Healthy — {{ $queue['pending'] }} pending, none failed.

@endif
pending{{ $queue['pending'] }} pending error{{ $queue['failed'] }} failed
@if(\Illuminate\Support\Facades\Route::has('admin.queue')) View queue → @endif
@endisset
event_upcoming

Upcoming sessions

    @forelse($upcomingSessions as $s)
  • {{ $s->title }}

    {{ $s->session_date->format('j M Y') }} · {{ $s->booked }} booked{{ $s->trainerName() ? ' · '.$s->trainerName() : '' }}

  • @empty
  • No upcoming sessions.
  • @endforelse
@endsection