@extends('layouts.app') @section('title', 'My Report Cards') @section('page-title', 'Report Cards') @section('content')

@if(auth()->user()->role === 'parent') Children's Report Cards @else My Report Cards @endif

View and download academic report cards

@if(auth()->user()->role === 'parent' && isset($children)) {{-- Parent view: grouped by child --}} @foreach($children as $child) @php $childCards = $reportCards->where('student_id', $child->id); @endphp
{{ strtoupper(substr($child->name, 0, 1)) }}

{{ $child->name }}

{{ $child->studentProfile?->class_?->full_name ?? '' }} · {{ $child->studentProfile?->admission_number ?? '' }}

@if($childCards->isNotEmpty())
@foreach($childCards as $rc)
{{-- Term Icon --}}
{{-- Info --}}

{{ $rc->term }}

@php $gColor = App\Services\GradeService::color($rc->overall_grade); @endphp Grade {{ $rc->overall_grade }}

{{ $rc->academicYear?->name ?? '' }} · {{ $rc->class_?->full_name ?? '' }}

{{-- Stats --}} {{-- Download --}} @if($rc->pdf_path) Download @else Pending @endif
@endforeach
@else

No report cards available yet for {{ $child->name }}

@endif
@endforeach @if($children->isEmpty())

No children linked to your account

@endif @else {{-- Student view --}}
@if($reportCards->isNotEmpty())
@foreach($reportCards as $rc)
{{-- Term Icon --}}
{{-- Info --}}

{{ $rc->term }}

@php $gColor = App\Services\GradeService::color($rc->overall_grade); @endphp Grade {{ $rc->overall_grade }}

{{ $rc->academicYear?->name ?? '' }} · {{ $rc->class_?->full_name ?? '' }}

{{-- Remarks --}} @if($rc->teacher_remarks)

{{ $rc->teacher_remarks }}

@endif
{{-- Stats --}} {{-- Download --}} @if($rc->pdf_path) Download @else Pending @endif
@endforeach
@else

No report cards available yet

Report cards will appear here once generated by your school

@endif
@endif
@endsection