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

Student Profile

Complete performance overview and account management

Edit Student
@csrf
@csrf @method('DELETE')
{{-- ============ BASIC INFO ============ --}}
{{ $student->name }}
Student

{{ $student->name }}

{{ $student->email ?? 'N/A' }}

Reg No

{{ $student->registration_no ?? 'N/A' }}

Contact No

{{ $student->phone ?? 'N/A' }}

D.O.B

{{ optional($student->date_of_birth)->format('d M Y') ?? 'N/A' }}

Joined

{{ $student->created_at->format('d M Y') }}

Status

@if($student->trashed()) Deleted @elseif($student->status === 'blocked' ?? false) Blocked @else Active @endif

Last Activity

{{ $lastActivity ? $lastActivity->diffForHumans() : 'No activity yet' }}

{{-- ============ KPI STATS ============ --}}

๐Ÿ“Š Performance Overview

Total Attempts

{{ $totalAttempts }}

Avg Score

{{ number_format($avgScore, 1) }}%

Best Score

{{ number_format($bestScore, 1) }}%

Pass Rate

{{ number_format($passRate, 1) }}%

{{-- ============ CHARTS ROW: Pass/Fail Doughnut + Score Trend Line ============ --}} @if($totalAttempts > 0)
{{-- Pass/Fail Doughnut --}}

๐ŸŽฏ Pass vs Fail

Overall test outcome split

Passed

{{ $passedCount }}

Failed

{{ $failedCount }}

{{-- Score Trend Line Chart --}}

๐Ÿ“ˆ Score Trend

Last {{ min(10, $totalAttempts) }} attempts

Latest first
@endif {{-- ============ EXAM TYPE BREAKDOWN ============ --}} @if(count($examTypeBreakdown) > 0)

๐ŸŽฏ Performance by Exam Type

@foreach($examTypeBreakdown as $type) @php if ($type['avg'] >= 75) { $color = 'green'; $label = 'Excellent'; $emoji = '๐ŸŒŸ'; } elseif ($type['avg'] >= 60) { $color = 'green'; $label = 'Good'; $emoji = '๐Ÿ‘'; } elseif ($type['avg'] >= 40) { $color = 'yellow'; $label = 'Average'; $emoji = 'โš ๏ธ'; } else { $color = 'red'; $label = 'Needs Work'; $emoji = '๐Ÿšจ'; } @endphp
{{ $type['code'] }} {{ $type['attempts'] }} attempt{{ $type['attempts'] > 1 ? 's' : '' }}

{{ $type['name'] }}

{{ number_format($type['avg'], 1) }}% {{ $emoji }} {{ $label }}
Best: {{ number_format($type['best'] ?? $type['avg'], 1) }}% Lowest: {{ number_format($type['worst'] ?? $type['avg'], 1) }}%
@endforeach
@endif {{-- ============ EXAM HISTORY ============ --}}

๐Ÿ“‹ Exam History

@forelse($results as $r) @php $passed = ($r->status ?? null) === 'Pass' || ($r->obtained_marks >= ($r->total_marks * 0.4)); $percentage = $r->total_marks > 0 ? round(($r->obtained_marks / $r->total_marks) * 100, 1) : 0; $barColor = $percentage >= 60 ? 'green' : ($percentage >= 40 ? 'yellow' : 'red'); @endphp
@if($r->exam->exam_type ?? null) {{ $r->exam->exam_type }} @endif @if($r->exam->subject ?? null && $r->exam->subject !== 'All Subjects') ๐Ÿ“š {{ $r->exam->subject }} @endif @if($r->exam->topic ?? null) โ†’ {{ $r->exam->topic }} @endif

{{ $r->exam->title ?? 'Exam' }}

{{-- Progress bar under title --}}

{{ optional($r->submitted_at ?? $r->created_at)->format('d M Y, h:i A') }}

{{ $r->obtained_marks }} / {{ $r->total_marks }}

{{ $percentage }}% ยท {{ $passed ? 'Pass' : 'Fail' }}

View Sheet
@empty

๐Ÿ“ญ

No exams attempted yet

This student hasn't taken any tests so far.

@endforelse
{{-- ============ CHART.JS SCRIPTS ============ --}} @if($totalAttempts > 0) @endif @endsection