@extends('adminlte::page') @section('title', 'My Children\'s Results') @section('content_header')

Academic Results

@stop @section('content') {{-- Stats Cards --}}
Children {{ $students->count() }}
Subjects Taken {{ \App\Models\Mark::whereIn('student_id', $students->pluck('id'))->distinct('subject_id')->count('subject_id') }}
Average GPA @php $avgGpa = \App\Models\StudentResult::whereIn('student_id', $students->pluck('id'))->avg('gpa'); @endphp {{ number_format($avgGpa ?? 0, 2) }}
Highest GPA @php $maxGpa = \App\Models\StudentResult::whereIn('student_id', $students->pluck('id'))->max('gpa'); @endphp {{ number_format($maxGpa ?? 0, 2) }}
{{-- Filters --}}

Filter Results

{{-- Student Summary Table --}}

Student Performance Summary

+ + @forelse($students as $student) @php // Fetch student results for the selected exam (or latest) $studentResult = null; $examId = request('exam_id'); if ($examId) { $studentResult = \App\Models\StudentResult::where('student_id', $student->id) ->where('exam_id', $examId) ->first(); } else { // Get the most recent result (optional) $studentResult = \App\Models\StudentResult::where('student_id', $student->id) ->latest('created_at') ->first(); } @endphp + + @empty @endforelse
Admission No Student Name Class Exam Total Points GPA Division Position Actions
{{ $student->admission_no }} {{ $student->full_name }}
{{ $student->email ?? '' }}
{{ $student->class->name ?? 'N/A' }} {{ $studentResult ? ($studentResult->exam->name ?? 'N/A') : 'N/A' }} {{ $studentResult->total_points ?? '-' }} {{ number_format($studentResult->gpa ?? 0, 2) }} @if($studentResult) @php $divisionClass = match($studentResult->division) { 'I' => 'success', 'II' => 'primary', 'III' => 'warning', 'IV' => 'danger', default => 'secondary' }; @endphp {{ $studentResult->division }} @else - @endif {{ $studentResult->position ?? '-' }} Details No students found.
{{-- Subject Breakdown for Selected Student (Optional) --}} @if(request('student_id') && $selectedStudent = $students->firstWhere('id', request('student_id'))) @php $examId = request('exam_id'); if ($examId) { $marks = \App\Models\Mark::where('student_id', $selectedStudent->id) ->where('exam_id', $examId) ->with('subject') ->get(); } else { $marks = \App\Models\Mark::where('student_id', $selectedStudent->id) ->with('subject') ->latest('exam_id') ->get(); } @endphp @if($marks->count())
Subject Marks for {{ $selectedStudent->full_name }}
+ + @foreach($marks as $mark) @php $grade = \App\Models\Grade::where('min_mark', '<=', $mark->mark) ->where('max_mark', '>=', $mark->mark) ->first(); @endphp @endforeach
Subject Mark Grade Point Remark
{{ $mark->subject->name }} {{ $mark->mark }} {{ $grade->name ?? '-' }} {{ $grade->point ?? 0 }} {{ $grade->description ?? '-' }}
@endif @endif @stop @push('css') @endpush