<?php $__env->startSection('title', 'Enter Scores'); ?>
<?php $__env->startSection('content'); ?>
    <?php if (isset($component)) { $__componentOriginal00a2e3c817942d1565d2933416f28c6a = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal00a2e3c817942d1565d2933416f28c6a = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.page-head','data' => ['title' => 'Gradebook Entry','subtitle' => 'Assessment scores by class, subject & term']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('page-head'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Gradebook Entry','subtitle' => 'Assessment scores by class, subject & term']); ?>
         <?php $__env->slot('actions', null, []); ?> 
            <a href="<?php echo e(route('school.grades.index')); ?>" class="btn btn-outline">Back</a>
         <?php $__env->endSlot(); ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal00a2e3c817942d1565d2933416f28c6a)): ?>
<?php $attributes = $__attributesOriginal00a2e3c817942d1565d2933416f28c6a; ?>
<?php unset($__attributesOriginal00a2e3c817942d1565d2933416f28c6a); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal00a2e3c817942d1565d2933416f28c6a)): ?>
<?php $component = $__componentOriginal00a2e3c817942d1565d2933416f28c6a; ?>
<?php unset($__componentOriginal00a2e3c817942d1565d2933416f28c6a); ?>
<?php endif; ?>

    <?php if (isset($component)) { $__componentOriginal36665f0dc0e45320e21db1e20a989acf = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal36665f0dc0e45320e21db1e20a989acf = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.panel','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('panel'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
        <form method="GET" action="<?php echo e(route('school.grades.entry')); ?>" style="display:grid; grid-template-columns: repeat(3, 1fr); gap:12px; margin-bottom:20px;">
            <select class="input" name="class_id" required>
                <option value="">Class</option>
                <?php $__currentLoopData = $classes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $class): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($class->id); ?>" <?php if($classId == $class->id): echo 'selected'; endif; ?>><?php echo e($class->name); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
            <select class="input" name="subject_id" required>
                <option value="">Subject</option>
                <?php $__currentLoopData = $subjects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $subject): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($subject->id); ?>" <?php if($subjectId == $subject->id): echo 'selected'; endif; ?>><?php echo e($subject->name); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
            <select class="input" name="term_id" required>
                <?php $__currentLoopData = $terms; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $term): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($term->id); ?>" <?php if($termId == $term->id): echo 'selected'; endif; ?>><?php echo e($term->name); ?> (<?php echo e($term->academicYear?->name); ?>)</option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
            <select class="input" name="assessment_type" required>
                <option value="">Assessment type</option>
                <?php $__currentLoopData = $assessmentTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($type); ?>" <?php if($assessmentType === $type): echo 'selected'; endif; ?>><?php echo e(ucfirst($type)); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
            <input class="input" type="number" name="max_score" min="1" value="<?php echo e($maxScore); ?>" placeholder="Max score">
            <input class="input" type="text" name="title" value="<?php echo e($title); ?>" placeholder="Assessment title (optional)">
            <button type="submit" class="btn btn-outline" style="grid-column: span 3;">Load Students</button>
        </form>

        <?php if($context): ?>
            <form method="POST" action="<?php echo e(route('school.grades.entry.store')); ?>">
                <?php echo csrf_field(); ?>
                <input type="hidden" name="class_id" value="<?php echo e($classId); ?>">
                <input type="hidden" name="subject_id" value="<?php echo e($subjectId); ?>">
                <input type="hidden" name="term_id" value="<?php echo e($termId); ?>">
                <input type="hidden" name="assessment_type" value="<?php echo e($assessmentType); ?>">
                <input type="hidden" name="max_score" value="<?php echo e($maxScore); ?>">
                <input type="hidden" name="title" value="<?php echo e($title); ?>">

                <?php if($context['assessment']): ?>
                    <p style="margin-bottom:12px; color:var(--text2);">Editing: <strong><?php echo e($context['assessment']->title); ?></strong> (max <?php echo e($context['assessment']->max_score); ?>)</p>
                <?php endif; ?>

                <div class="table-wrap">
                    <table>
                        <thead><tr><th>Student</th><th>Score / <?php echo e($maxScore); ?></th><th>Grade</th><th>Remarks</th></tr></thead>
                        <tbody>
                            <?php $__currentLoopData = $context['students']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $student): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php ($entry = $context['entries'][$student->id] ?? null); ?>
                                <tr>
                                    <td><?php echo e($student->full_name); ?> <small style="color:var(--text3);">(<?php echo e($student->admission_number); ?>)</small></td>
                                    <td>
                                        <input type="hidden" name="records[<?php echo e($loop->index); ?>][student_id]" value="<?php echo e($student->id); ?>">
                                        <input class="input" type="number" step="0.01" min="0" max="<?php echo e($maxScore); ?>" name="records[<?php echo e($loop->index); ?>][score]" value="<?php echo e(old('records.'.$loop->index.'.score', $entry?->score)); ?>">
                                    </td>
                                    <td><?php echo e($entry?->grade_letter ?? '—'); ?></td>
                                    <td><input class="input" type="text" name="records[<?php echo e($loop->index); ?>][remarks]" value="<?php echo e(old('records.'.$loop->index.'.remarks', $entry?->remarks)); ?>"></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
                <button type="submit" class="btn btn-primary" style="margin-top:16px;">Save Scores</button>
            </form>
        <?php else: ?>
            <?php if (isset($component)) { $__componentOriginal074a021b9d42f490272b5eefda63257c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal074a021b9d42f490272b5eefda63257c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.empty-state','data' => ['title' => 'Select filters','message' => 'Choose class, subject, term and assessment type to enter scores.']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('empty-state'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Select filters','message' => 'Choose class, subject, term and assessment type to enter scores.']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal074a021b9d42f490272b5eefda63257c)): ?>
<?php $attributes = $__attributesOriginal074a021b9d42f490272b5eefda63257c; ?>
<?php unset($__attributesOriginal074a021b9d42f490272b5eefda63257c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal074a021b9d42f490272b5eefda63257c)): ?>
<?php $component = $__componentOriginal074a021b9d42f490272b5eefda63257c; ?>
<?php unset($__componentOriginal074a021b9d42f490272b5eefda63257c); ?>
<?php endif; ?>
        <?php endif; ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal36665f0dc0e45320e21db1e20a989acf)): ?>
<?php $attributes = $__attributesOriginal36665f0dc0e45320e21db1e20a989acf; ?>
<?php unset($__attributesOriginal36665f0dc0e45320e21db1e20a989acf); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal36665f0dc0e45320e21db1e20a989acf)): ?>
<?php $component = $__componentOriginal36665f0dc0e45320e21db1e20a989acf; ?>
<?php unset($__componentOriginal36665f0dc0e45320e21db1e20a989acf); ?>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\southend\resources\views\admin\grades\entry.blade.php ENDPATH**/ ?>