{{-- My Compliance (trainer's own e-learning). From TrainerComplianceController@myCompliance: $me, $summary, $courses (each with ->live_status and ->pivot) --}} @extends('layouts.app') @section('title', 'My Compliance') @section('content') @include('partials.flash')

My Compliance

Your own mandatory e-learning and where you stand.

@if(\Illuminate\Support\Facades\Route::has('trainer.courses')) school Go to My Learning @endif
{{-- KPI tiles (dashboard UI) --}} @php $sColor = $summary['compliance'] >= 90 ? 'text-primary' : ($summary['compliance'] >= 70 ? 'text-gold' : 'text-error'); $tiles = [ ['label' => 'Overall Compliance', 'value' => $summary['compliance'].'%', 'icon' => 'verified', 'class' => $sColor], ['label' => 'Completed', 'value' => $summary['completed'].' / '.$summary['total'], 'icon' => 'task_alt', 'class' => 'text-primary'], ['label' => 'Overdue', 'value' => $summary['overdue'], 'icon' => 'running_with_errors', 'class' => $summary['overdue'] > 0 ? 'text-error' : 'text-on-surface-variant'], ['label' => 'In Progress', 'value' => $summary['in_progress'], 'icon' => 'timelapse', 'class' => 'text-on-surface-variant'], ]; @endphp
@foreach($tiles as $tile)
{{ $tile['icon'] }}

{{ $tile['value'] }}

{{ $tile['label'] }}

@endforeach
@php $meta = [ 'completed' => ['label' => 'Completed', 'chip' => 'bg-primary/10 text-primary', 'icon' => 'check_circle', 'action' => 'Review'], 'in_progress' => ['label' => 'In progress', 'chip' => 'bg-gold/20 text-[#8a6d3b]', 'icon' => 'timelapse', 'action' => 'Continue'], 'overdue' => ['label' => 'Overdue', 'chip' => 'bg-error-container text-error', 'icon' => 'error', 'action' => 'Start now'], 'not_started' => ['label' => 'Not started', 'chip' => 'bg-surface-container-high text-outline', 'icon' => 'radio_button_unchecked', 'action' => 'Start'], ]; @endphp @if($courses->isEmpty())
check_circle

No e-learning assigned

Mandatory courses will appear here when assigned.

@else
@foreach($courses as $c) @php $m = $meta[$c->live_status]; $due = $c->pivot->due_at ? \Carbon\Carbon::parse($c->pivot->due_at) : null; $progress = (int) $c->pivot->progress_percent; @endphp @endforeach
Course Status Due Progress Action

{{ $c->title }}

{{ ucwords(str_replace('_', ' ', $c->category)) }}

{{ $m['icon'] }} {{ $m['label'] }} {{ $due ? $due->format('d M Y') : '—' }}
{{ $c->live_status === 'completed' ? 100 : $progress }}%
{{ $m['action'] }} arrow_forward
@endif @endsection