<?php $pageTitle = 'Enrollments'; ?>
<div class="mb-4"><p class="text-secondary">Manage student enrollments</p></div>
<div class="card-cix mb-4">
    <form method="GET" action="<?= base_url('admin/enrollments') ?>" class="row g-3 align-items-end">
        <div class="col-md-6"><label class="form-label-cix">Search</label><input type="text" name="search" class="form-control-cix" placeholder="Student #, name, course..." value="<?= e($search ?? '') ?>"></div>
        <div class="col-md-2"><button type="submit" class="btn-cix btn-cix-primary"><i class="fas fa-search"></i></button></div>
    </form>
</div>
<div class="card-cix">
    <div class="table-responsive">
        <table class="table-cix"><thead><tr><th>Student #</th><th>Name</th><th>Course</th><th>Package</th><th>Status</th><th>Enrolled</th></tr></thead>
        <tbody><?php if (empty($enrollments)): ?><tr><td colspan="6" class="text-center text-secondary p-4">No enrollments</td></tr>
        <?php else: foreach ($enrollments as $e): ?>
        <tr><td style="color:var(--secondary);font-weight:600"><?= e($e['student_number']) ?></td><td><?= e($e['first_name'] . ' ' . $e['last_name']) ?></td>
        <td class="text-secondary"><?= e($e['course_title']) ?></td><td class="text-secondary"><?= e($e['package_name'] ?? '-') ?></td>
        <td><span class="badge-cix badge-<?= $e['status'] ?>"><?= ucfirst($e['status']) ?></span></td><td class="text-secondary small"><?= e($e['enrolled_at']) ?></td></tr>
        <?php endforeach; endif; ?></tbody></table>
    </div>
</div>
