@extends('Component.layout') @section('title', 'Test Marks - Iqra') @section('breadcrumb', 'Dashboard / Test Marks') @section('content')

Test Marks & Progress

Detailed view of {{ $student->first_name }}'s academic performance.

@if($marks->count() > 0)

Performance Over Time

@endif

Test History

@forelse($marks as $mark) @php $percentage = ($mark->exam->max_marks > 0) ? ($mark->marks_obtained / $mark->exam->max_marks) * 100 : 0; $gradeColor = 'text-blue-600 bg-blue-50'; if($percentage >= 90) { $gradeColor = 'text-emerald-600 bg-emerald-50'; } elseif($percentage >= 75) { $gradeColor = 'text-cyan-600 bg-cyan-50'; } elseif($percentage >= 50) { $gradeColor = 'text-amber-600 bg-amber-50'; } elseif($percentage < 35) { $gradeColor = 'text-rose-600 bg-rose-50'; } @endphp
{{ $mark->exam->exam_date->format('d M, Y') }}

{{ $mark->exam->title }}

{{ $mark->exam->subject }} Tr. {{ $mark->exam->teacher->name }}
{{ rtrim(rtrim(number_format($mark->marks_obtained, 2), '0'), '.') }} / {{ number_format($mark->exam->max_marks, 0) }}
Marks Obtained
@empty

No Marks Yet

When tests are completed and graded, they will appear here.

@endforelse
@php $totalPossible = 0; $totalObtained = 0; foreach($marks as $mark) { if ($mark->exam->max_marks > 0) { $totalPossible += $mark->exam->max_marks; $totalObtained += $mark->marks_obtained; } } $progressPercent = $totalPossible > 0 ? min(100, ($totalObtained / $totalPossible) * 100) : 0; $lossPercent = $totalPossible > 0 ? 100 - $progressPercent : 0; $marksLost = max(0, $totalPossible - $totalObtained); $overallColor = 'text-blue-600'; $overallBg = 'bg-blue-500'; if($progressPercent >= 90) { $overallColor = 'text-emerald-600'; $overallBg = 'bg-emerald-500'; } elseif($progressPercent >= 75) { $overallColor = 'text-cyan-600'; $overallBg = 'bg-cyan-500'; } elseif($progressPercent >= 50) { $overallColor = 'text-amber-600'; $overallBg = 'bg-amber-500'; } elseif($progressPercent > 0 && $progressPercent < 35) { $overallColor = 'text-rose-600'; $overallBg = 'bg-rose-500'; } @endphp

Overall Progress

{{ $marks->count() }} Tests
@if($totalPossible > 0)
{{ number_format($progressPercent, 1) }}%

Average Success Rate

Progress Loss
@php $lastTest = $marks->first(); $lastTestPct = 0; if ($lastTest && $lastTest->exam->max_marks > 0) { $lastTestPct = ($lastTest->marks_obtained / $lastTest->exam->max_marks) * 100; } @endphp @if($lastTest)
Most Recent Test {{ $lastTest->exam->exam_date->format('d M') }}

{{ $lastTest->exam->title }}

{{ $lastTest->exam->subject }}

{{ number_format($lastTestPct, 1) }}%
{{ rtrim(rtrim(number_format($lastTest->marks_obtained, 2), '0'), '.') }} / {{ number_format($lastTest->exam->max_marks, 0) }}
@endif
Achieved
{{ rtrim(rtrim(number_format($totalObtained, 2), '0'), '.') }}
out of {{ number_format($totalPossible, 0) }}
Loss
{{ rtrim(rtrim(number_format($marksLost, 2), '0'), '.') }}
marks lost

@if($progressPercent >= 75) Outstanding performance! Your child is retaining most of the test material. Keep up the great work! @elseif($progressPercent >= 50) Good progress. Focusing on the areas where marks were lost will help improve the overall score. @else Needs attention. Consider reviewing the recent test materials to reduce the mark loss rate. @endif

@else

Not enough data to calculate progress yet.

@endif
@if($marks->count() > 0) @php $chartMarks = $marks->reverse()->values(); // X-axis: Test Title + Subject $categories = $chartMarks->map(function($m) { return $m->exam->title . ' (' . $m->exam->subject . ')'; })->toJson(); // Y-axis data (Percentage) $seriesData = $chartMarks->map(function($m) { $pct = ($m->exam->max_marks > 0) ? ($m->marks_obtained / $m->exam->max_marks) * 100 : 0; return round($pct, 1); })->toJson(); // Tooltip metadata $metaData = $chartMarks->map(function($m) { return [ 'obtained' => rtrim(rtrim(number_format($m->marks_obtained, 2), '0'), '.'), 'max' => number_format($m->exam->max_marks, 0) ]; })->toJson(); @endphp @endif @endsection