@extends('admin.admin_dashboard') @section('customcss') @endsection @section('admin') @php // ✅ Guard: exam missing হলে 404 abort_if(empty($exam), 404); // ✅ Safe school vars (schoolInfo null হলেও error হবে না) $schoolLogo = $schoolInfo?->school_logo ? asset('core/storage/app/public/' . $schoolInfo->school_logo) : ''; $schoolName = $schoolInfo?->school_name ?? 'School Name'; $schoolAddress = $schoolInfo?->address ?? 'School Address'; $schoolPhone = $schoolInfo?->phone ?? 'N/A'; $schoolEmail = $schoolInfo?->email ?? 'N/A'; $schoolEIIN = $schoolInfo?->eiin ?? 'N/A'; @endphp
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- Quick Documents Section --}} {{-- Exam Info --}}

Exam Information

Exam Name
{{ $exam->exam_name ?? '-' }} ({{ $exam->examType?->name ?? '-' }})
Session
{{ $exam->session?->name ?? '-' }}
Class
{{ $exam->class?->name ?? '-' }}
Start Date
{{ $exam->start_date ? \Carbon\Carbon::parse($exam->start_date)->format('d M Y') : '-' }}
End Date
{{ $exam->end_date ? \Carbon\Carbon::parse($exam->end_date)->format('d M Y') : '-' }}
Published
{!! ($exam->is_published ?? 0) ? 'Yes' : 'No' !!}
Has Results
{!! ($hasResults ?? false) ? 'Yes' : 'No' !!}
Full Mark
{{ number_format((float)($exam->full_mark ?? 0), 2) }}
{{-- row --}}
{{-- card-body --}}
{{-- COMPONENT + ROUTINE --}}
{{-- Components --}}

Exam Components

@forelse($subjectAssignments ?? [] as $asgn) @php $sub = $asgn->subject; @endphp {{-- ✅ subject missing হলে skip --}} @if(!$sub) @continue @endif @php $components = $componentsGrouped[$sub->id] ?? collect(); @endphp @if($components->count()) @foreach($components as $idx => $comp) @if($idx === 0) @endif @endforeach @else @endif @empty @endforelse
Subject Component Full Mark Pass Mark
{{ $sub->name ?? '-' }}{{ $comp->component_name ?? '-' }} {{ $comp->full_mark ?? '-' }} {{ $comp->pass_mark ?? '-' }}
{{ $sub->name ?? '-' }} Components not configured yet. Configure now
No subjects assigned for this class.
{{-- end --}}
{{-- Routine --}}

Exam Routine

@if(($exam->routines?->count() ?? 0) > 0) Edit Routine @endif Add Routine
@if(($exam->routines?->count() ?? 0) > 0)
@foreach($exam->routines as $key => $routine) @php $examDate = $routine->exam_date ? \Carbon\Carbon::parse($routine->exam_date) : null; $today = \Carbon\Carbon::today(); $isPast = $examDate ? $examDate->lt($today) : false; @endphp @endforeach
SL Subject Date Start Time End Time Status
{{ $key + 1 }} {{ $routine->subject?->name ?? '-' }} {{ $examDate ? $examDate->format('d M Y') : '-' }} {{ $routine->start_time ? \Carbon\Carbon::parse($routine->start_time)->format('h:i A') : '-' }} {{ $routine->end_time ? \Carbon\Carbon::parse($routine->end_time)->format('h:i A') : '-' }} @if($examDate) @if($isPast) Exam Done @else Upcoming @endif @else N/A @endif
@else

No exam routine added yet.

@endif {{-- Instructions for Print --}} @if(($exam->routines?->count() ?? 0) > 0)
These instructions will appear in the printed routine.
@endif
{{-- routineArea --}}
@endsection