@extends('layouts.school') @section('title', 'Results') @section('header', 'Results & Report Cards') @section('content')
@php $requireWorkflow = \App\Services\Academic\ResultSettingsService::flag($settings, 'require_workflow'); $statusBadges = [ 'draft' => 'bg-gray-100 text-gray-600', 'submitted' => 'bg-blue-50 text-blue-700', 'reviewed' => 'bg-amber-50 text-amber-700', 'approved' => 'bg-indigo-50 text-indigo-700', 'published' => 'bg-green-50 text-green-700', ]; $workflowForm = fn (string $action) => route("school.results.$action", request()->route('schoolId')); $counts = ['draft' => 0, 'submitted' => 0, 'reviewed' => 0, 'approved' => 0, 'published' => 0]; foreach ($sheetStatuses as $status) { if (isset($counts[$status])) $counts[$status]++; } @endphp @if($computed)

Class average: {{ $computed['classAverage'] ?? '-' }}%

@csrf
@if(!$requireWorkflow)
@csrf
@csrf
@else @if($counts['draft'])
@csrf
@endif @if($counts['submitted'])
@csrf
@endif @if($counts['reviewed'])
@csrf
@endif @if($counts['approved'] || $counts['published'])
@csrf
@csrf
@endif @endif
@php $ranked = collect($computed['students'])->sortBy(fn ($r) => $r['position'] ?? 999999); @endphp @forelse($ranked as $row) @php $missing = collect($row['subjects'])->sum(fn ($s) => $s['missing']); $sheetStatus = $sheetStatuses[$row['student']->id] ?? null; @endphp @empty @endforelse
Pos Student Total Average Grade Status Missing Scores
{{ $row['position'] ?? '-' }} {{ $row['student']->full_name }} @if($sheetStatus){{ $sheetStatus }}@endif {{ $row['total'] ?? '-' }} {{ $row['average'] !== null ? $row['average'].'%' : '-' }} {{ $row['grade'] ?? '-' }} {{ $sheetStatus ? ucfirst($sheetStatus) : 'Not computed' }} {{ $missing > 0 ? $missing.' missing' : 'Complete' }} Report Card
No active students in this class.

Subject Averages

@foreach($computed['subjects'] as $subject) @endforeach
SubjectClass AvgHighestLowest
{{ $subject->name }} {{ $computed['subjectAverages'][$subject->id] !== null ? $computed['subjectAverages'][$subject->id].'%' : '-' }} {{ $computed['subjectStats'][$subject->id]['highest'] ?? '-' }} {{ $computed['subjectStats'][$subject->id]['lowest'] ?? '-' }}
@endif @endsection