

<?php $__env->startSection('title', 'Registered Courses'); ?>

<?php $__env->startSection('content'); ?>
<div class="container mt-4">
    <div class="card shadow-sm">
        <div class="card-header bg-primary text-white">
            <h5 class="mb-0">Registered Courses</h5>
        </div>
        <div class="card-body">
            <?php if(session('success')): ?>
                <div class="alert alert-success"><?php echo e(session('success')); ?></div>
            <?php endif; ?>

            <?php if($registrations->isEmpty()): ?>
                <p class="text-muted">You have not registered for any courses yet.</p>
            <?php else: ?>
                <div class="table-responsive">
                    <table class="table table-bordered table-striped">
                        <thead class="thead-dark">
                            <tr class="bg-dark text-white">
                                <th>#</th>
                                <th>Course Code</th>
                                <th>Description</th>
                                <th>Level</th>
                                <th>Semester</th>
                                <th>Credits</th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $registrations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $course): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php
                                    $level = $course->level ?? 'N/A';
                                    $semester = $course->semester ?? 'N/A';
                                ?>
                                <tr>
                                    <td><?php echo e($index + 1); ?></td>
                                    <td><?php echo e($course->course_code); ?></td>
                                    <td><?php echo e($course->course_description); ?></td>
                                    <td><?php echo e($level); ?></td>
                                    <td><?php echo e($semester); ?></td>
                                    <td><?php echo e($course->credits); ?></td>
                                    <td>
                                        <form action="<?php echo e(route('student.courses.deregister', $course->id)); ?>" method="POST" onsubmit="return confirm('Are you sure you want to deregister this course?')">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="btn btn-sm btn-danger">De-register</button>
                                        </form>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.student', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\studentportal\resources\views/student/courses.blade.php ENDPATH**/ ?>