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

Analytics Dashboard

Deep insights across exam types, subjects, and student performance

{{-- ============ FILTER: EXAM TYPE ============ --}} @php $selectedExamType = request('exam_type', ''); $examTypes = config('academix.exam_types', []); @endphp
All Exams @foreach($examTypes as $key => $label) {{ $key }} @if(isset($examTypeCounts[$key])) {{ $examTypeCounts[$key] }} @endif @endforeach
{{-- ============ KPI STRIP ============ --}}

Total Exams

{{ $totalExams ?? 0 }}

Total Attempts

{{ $totalAttempts ?? 0 }}

Active Students

{{ $totalStudents ?? 0 }}

Avg Score

{{ number_format($averageScore ?? 0, 1) }}%

{{-- ============ TOP CHARTS ROW ============ --}}
{{-- Exam Type Performance --}}

Exam Type Performance

Average score per exam type

{{-- Daily Attempts --}}

Daily Attempts

Last 7 days · Click on a point to see details

{{-- ============ LEADERBOARD ============ --}}

Leaderboard

Top Performing Students

Ranked by average score across all attempted tests

@forelse ($topStudents as $index => $row)
#{{ $index + 1 }}
{{ $row->user->name }}

{{ $row->user->name }}

{{ $row->attempts ?? 0 }} test{{ ($row->attempts ?? 0) > 1 ? 's' : '' }} attempted

{{ number_format($row->avg_percentage, 2) }}%

View
@empty
No student data yet.
@endforelse
{{-- ============ AI INSIGHTS ============ --}}

AI Summary

{{ $aiInsights['headline'] ?? 'AI Insights' }}

{{ $aiInsights['summary'] ?? 'Analytics insights will appear here once enough exam data is available.' }}

Data-backed guidance for exam planning

Key Focus

{{ collect($aiInsights['insights'] ?? [])->first() ?? 'Awaiting stronger patterns from exam activity.' }}

Priority Action

{{ collect($aiInsights['actions'] ?? [])->first() ?? 'No urgent intervention suggested yet.' }}

Signal Strength

{{ count($aiInsights['insights'] ?? []) ? 'Focused summary from current trends.' : 'More exam data will sharpen future recommendations.' }}

Top Findings

@forelse(collect($aiInsights['insights'] ?? [])->take(3) as $insight)
{{ $insight }}
@empty

No findings yet.

@endforelse

Priority Actions

@forelse(collect($aiInsights['actions'] ?? [])->take(3) as $action)
{{ $action }}
@empty

No actions yet.

@endforelse
{{-- ============ WEAK TOPICS + HARDEST QUESTIONS ============ --}}

Weak Topic Detection

Lowest Accuracy Topics

Hardest Questions

Most Missed Questions

@forelse($hardestQuestions as $item)

{{ $item->question_text }}

{{ $item->exam_title }} • {{ $item->topic ?? 'No topic' }}

{{ number_format($item->wrong_rate, 2) }}% wrong

{{ $item->attempts }} student attempts recorded

@empty
Hardest-question analytics will appear once students complete more exams.
@endforelse
{{-- ============ DAILY ATTEMPTS MODAL ============ --}} @endsection