@csrf
<div class="row g-3">
    <div class="col-md-5"><label class="form-label">Exam Name <span class="text-danger">*</span></label>
        <input type="text" name="name" value="{{ old('name', $exam->name) }}" class="form-control @error('name') is-invalid @enderror" placeholder="Mid Term 2025-2026" required>
        @error('name')<div class="invalid-feedback">{{ $message }}</div>@enderror</div>
    <div class="col-md-3"><label class="form-label">Type</label>
        <select name="type" class="form-select">
            @foreach(App\Models\Exam::TYPES as $val => $label)<option value="{{ $val }}" @selected(old('type',$exam->type)===$val)>{{ $label }}</option>@endforeach
        </select></div>
    <div class="col-md-4"><label class="form-label">Session</label>
        <select name="academic_session_id" class="form-select">
            @foreach($sessions as $s)<option value="{{ $s->id }}" @selected(old('academic_session_id', $exam->academic_session_id ?? optional($sessions->firstWhere('is_current',true))->id)==$s->id)>{{ $s->name }}</option>@endforeach
        </select></div>
    <div class="col-md-3"><label class="form-label">Start Date</label>
        <input type="date" name="start_date" value="{{ old('start_date', optional($exam->start_date)->format('Y-m-d')) }}" class="form-control"></div>
    <div class="col-md-3"><label class="form-label">End Date</label>
        <input type="date" name="end_date" value="{{ old('end_date', optional($exam->end_date)->format('Y-m-d')) }}" class="form-control"></div>
</div>
<div class="mt-3 d-flex gap-2">
    <button class="btn btn-primary"><i class="bi bi-check-lg me-1"></i>{{ $submitLabel ?? 'Save' }}</button>
    <a href="{{ route('exams.index') }}" class="btn btn-light border">Cancel</a>
</div>
