@extends('layouts.school') @section('title', 'Student Report Card') @section('header', 'Student Report Card') @section('content')
@if($student)
{{ $student->initials }}

{{ $student->full_name }}

{{ $student->admission_no }} · {{ $student->class?->name ?? 'No class' }} · {{ ucfirst($student->gender ?? '') }}

{{-- Grades --}} @if($results->count())

Examination Results

@foreach($results as $r) @php $pct = $r->max_marks > 0 ? round(($r->marks_obtained / $r->max_marks) * 100, 1) : 0; @endphp @endforeach
Subject Exam Score Max % Grade Remark
{{ $r->subject?->name ?? '—' }} {{ $r->exam?->name ?? '—' }} {{ $r->marks_obtained }} {{ $r->max_marks }} {{ $pct }}% {{ $r->grade ?? '—' }} {{ $r->remark ?? '—' }}
@php $totalObtained = $results->sum('marks_obtained'); $totalMax = $results->sum('max_marks'); $avgPct = $totalMax > 0 ? round(($totalObtained / $totalMax) * 100, 1) : 0; @endphp

Total Score

{{ $totalObtained }} / {{ $totalMax }}

Average

{{ $avgPct }}%

Subjects

{{ $results->count() }}

@else
No results found for this student.
@endif {{-- Attendance --}}

Attendance Summary

{{ $attendanceStats['total'] }}

Total Days

{{ $attendanceStats['present'] }}

Present

{{ $attendanceStats['absent'] }}

Absent

{{ $attendanceStats['late'] }}

Late

@if($attendanceStats['total'] > 0)
Attendance Rate {{ round(($attendanceStats['present'] / $attendanceStats['total']) * 100, 1) }}%
@endif
@else
Select a student above to view their report card.
@endif @endsection