@extends('layouts.app') @section('content')
{{-- =========================== PAGE HEADER ============================ --}}

{{ $user->name }} - Performance Report

Summary of progress, performance, and trainee insights.

{{-- =========================== SUMMARY CARDS / CIRCLES ============================ --}} @if(!empty($summaryCards) && count($summaryCards) > 0)
@foreach($summaryCards as $card) @php $progress = is_numeric($card['value']) ? min($card['value'],100) : 0; @endphp
{{ $progress }}%
{{ $card['label'] }}

{{ $card['value'] }}{{ $card['suffix'] ?? '' }}

@endforeach
@else

No summary data available for this user yet.

@endif {{-- =========================== TRAINEE MODULE PROGRESS ============================ --}} @if($user->role === 'trainee')

Module Progress

@if($activities->count() > 0)
@foreach($activities as $index => $activity) @php $progress = 0; if(in_array(strtolower($activity['status']), ['completed','done'])) { $progress = 100; } elseif(isset($activity['score']) && is_numeric($activity['score'])) { $progress = $activity['score']; } @endphp @endforeach
# Module Title Status Score Grade Comments Date Progress
{{ $index + 1 }} {{ $activity['title'] }} {{ ucfirst($activity['status'] ?? 'N/A') }} {{ $activity['score'] ?? 'N/A' }} {{ $activity['grade'] ?? 'N/A' }} {{ $activity['comments'] ?? '-' }} {{ $activity['date'] ?? '-' }}
@else

No modules recorded for this trainee yet.

@endif @endif {{-- =========================== TRAINER / LEAD TRAINER REPORT ============================ --}} @if(in_array($user->role, ['trainer', 'lead_trainer']))

Trainee Performance

@if(isset($user->trainees) && $user->trainees->count() > 0)
@foreach($user->trainees as $index => $trainee) @php $total = $trainee->performances->count(); $completed = $trainee->performances->where('status','completed')->count(); $progress = $total > 0 ? round(($completed/$total)*100,1) : 0; @endphp @endforeach
# Trainee Name Average Score Completed Modules Overall Progress
{{ $index + 1 }} {{ $trainee->name }} {{ round($trainee->performances->avg('score') ?? 0,1) }}% {{ $completed }}
@else

No trainees assigned yet.

@endif @endif
{{-- =========================== CIRCULAR CHART STYLES =========================== --}} @endsection