

<?php $__env->startSection('title', 'Exam Management'); ?>

<?php $__env->startSection('breadcrumb'); ?>
    <li class="breadcrumb-item active" aria-current="page">Exams</li>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('actions'); ?>
    <a href="<?php echo e(route('exams.create')); ?>" class="btn btn-primary d-flex align-items-center">
        <i class="bi bi-plus-lg me-2"></i> Create Exam
    </a>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>

<!-- Search & Filter -->
<div class="card mb-4">
    <div class="card-body">
        <form method="GET" action="<?php echo e(route('exams.index')); ?>" class="row g-3">
            <div class="col-md-3">
                <label class="form-label small text-muted fw-bold">Search</label>
                 <div class="input-group">
                    <span class="input-group-text bg-white border-end-0"><i class="bi bi-search text-muted"></i></span>
                    <input type="text" name="search" class="form-control border-start-0 ps-0" value="<?php echo e(request('search')); ?>" placeholder="Exam name...">
                </div>
            </div>

            <div class="col-md-3">
                 <label class="form-label small text-muted fw-bold">Batch</label>
                 <select name="batch_id" class="form-select">
                     <option value="">All Batches</option>
                     <?php $__currentLoopData = ($batches ?? []); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $batch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                         <option value="<?php echo e($batch->id); ?>" <?php echo e(request('batch_id') == $batch->id ? 'selected' : ''); ?>>
                             <?php echo e($batch->name); ?>

                         </option>
                     <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                 </select>
            </div>

            <div class="col-md-3">
                <label class="form-label small text-muted fw-bold">Status</label>
                <select name="status" class="form-select">
                    <option value="">All Status</option>
                    <option value="upcoming" <?php echo e(request('status')=='upcoming' ? 'selected' : ''); ?>>Upcoming</option>
                    <option value="ongoing" <?php echo e(request('status')=='ongoing' ? 'selected' : ''); ?>>Ongoing</option>
                    <option value="completed" <?php echo e(request('status')=='completed' ? 'selected' : ''); ?>>Completed</option>
                </select>
            </div>

            <div class="col-md-3 d-flex align-items-end">
                <button class="btn btn-dark w-100">Filter</button>
            </div>
        </form>
    </div>
</div>

<!-- Exams List -->
<div class="card">
    <div class="card-body p-0">
        <div class="table-responsive">
            <table class="table table-hover align-middle mb-0">
                <thead class="bg-light text-muted small text-uppercase">
                    <tr>
                        <th class="ps-4">Exam Details</th>
                        <th>Target Batch</th>
                        <th>Class</th>
                        <th>Template</th>
                        <th>Status</th>
                        <th class="text-end pe-4">Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $exams; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $exam): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td class="ps-4">
                                <div class="d-flex align-items-center">
                                    <div class="rounded p-2 bg-light border me-3 text-center" style="min-width: 50px;">
                                        <div class="small fw-bold text-uppercase text-muted"><?php echo e($exam->start_date ? \Carbon\Carbon::parse($exam->start_date)->format('M') : 'N/A'); ?></div>
                                        <div class="h5 mb-0 fw-bold text-dark"><?php echo e($exam->start_date ? \Carbon\Carbon::parse($exam->start_date)->format('d') : '--'); ?></div>
                                    </div>
                                    <div>
                                        <h6 class="mb-0 text-dark fw-bold"><?php echo e($exam->name); ?></h6>
                                        <div class="text-muted small">
                                            <?php if($exam->end_date): ?>
                                                Ends: <?php echo e(\Carbon\Carbon::parse($exam->end_date)->format('M d, Y')); ?>

                                            <?php else: ?>
                                                <span class="text-muted fst-italic">No end date</span>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <span class="badge bg-info bg-opacity-10 text-info border border-info border-opacity-25"><?php echo e($exam->batch->name ?? 'N/A'); ?></span>
                            </td>
                            <td>
                                <span class="badge bg-primary bg-opacity-10 text-primary border border-primary border-opacity-25">
                                    <?php echo e($exam->class == 11 ? 'Class XI' : 'Class XII'); ?>

                                </span>
                            </td>
                            <td>
                                <?php if($exam->examTemplate): ?>
                                    <div class="d-flex align-items-center">
                                        <i class="bi bi-file-earmark-text text-secondary me-2"></i>
                                        <span><?php echo e($exam->examTemplate->name); ?></span>
                                    </div>
                                <?php else: ?>
                                    <span class="text-muted small">No Template</span>
                                <?php endif; ?>
                            </td>
                            <td>
                                <?php if($exam->status === 'upcoming'): ?>
                                    <span class="badge bg-warning text-dark border border-warning">Upcoming</span>
                                <?php elseif($exam->status === 'open_for_entry'): ?>
                                    <span class="badge bg-success border border-success">Open for Entry</span>
                                <?php elseif($exam->status === 'published'): ?>
                                    <span class="badge bg-info text-dark border border-info">Published</span>
                                <?php elseif($exam->status === 'archived'): ?>
                                    <span class="badge bg-secondary border border-secondary">Archived</span>
                                <?php else: ?>
                                    <span class="badge bg-light text-dark border"><?php echo e(ucfirst($exam->status)); ?></span>
                                <?php endif; ?>
                            </td>
                            <td class="text-end pe-4">
                                <div class="btn-group">
                                    <a href="<?php echo e(route('exams.show', $exam)); ?>" class="btn btn-sm btn-light text-primary" data-bs-toggle="tooltip" title="View details"><i class="bi bi-eye"></i></a>
                                    <a href="<?php echo e(route('exams.edit', $exam)); ?>" class="btn btn-sm btn-light text-warning" data-bs-toggle="tooltip" title="Edit exam"><i class="bi bi-pencil-square"></i></a>
                                    
                                    <form action="<?php echo e(route('exams.destroy', $exam)); ?>" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this exam?');">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('DELETE'); ?>
                                        <button type="submit" class="btn btn-sm btn-light text-danger" title="Delete"><i class="bi bi-trash"></i></button>
                                    </form>
                                </div>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="5" class="py-5 text-center text-muted">
                                <div class="mb-3">
                                    <i class="bi bi-pencil-square fs-1 text-secondary opacity-50"></i>
                                </div>
                                <p class="mb-1">No exams found.</p>
                                <a href="<?php echo e(route('exams.create')); ?>" class="btn btn-sm btn-primary mt-2">Create First Exam</a>
                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
    <?php if($exams->hasPages()): ?>
        <div class="card-footer bg-white border-top-0 py-3">
             <?php echo e($exams->withQueryString()->links('pagination::bootstrap-5')); ?>

        </div>
    <?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH T:\Motiur\college\admin\resources\views/exams/index.blade.php ENDPATH**/ ?>