<?php $__env->startSection('title', 'Trang học viên'); ?>

<?php $__env->startSection('content'); ?>
<div class="d-flex justify-content-between align-items-center mb-4">
    <div>
        <h3 class="fw-bold mb-1">Trang học viên</h3>
        <div class="text-muted">
            <?php echo e($enrollment->student->full_name ?? ''); ?> -
            <?php echo e($enrollment->trainingClass->name ?? ''); ?>

        </div>
    </div>

    <a href="<?php echo e(route('student-portal.index')); ?>" class="btn btn-outline-secondary">
        Đổi học viên
    </a>
</div>

<?php if(session('success')): ?>
    <div class="alert alert-success"><?php echo e(session('success')); ?></div>
<?php endif; ?>

<div class="card shadow-sm">
    <div class="card-body">
        <h5 class="fw-bold mb-3">Bài trắc nghiệm của tôi</h5>

        <table class="table table-hover align-middle">
            <thead class="table-light">
                <tr>
                    <th>Bài trắc nghiệm</th>
                    <th>Số câu</th>
                    <th>Thời gian</th>
                    <th>Điểm chuẩn</th>
                    <th>Điểm đạt được</th>
                    <th>Kết quả</th>
                    <th class="text-end">Thao tác</th>
                </tr>
            </thead>

            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $quizzes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $quiz): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <?php $attempt = $attempts[$quiz->id] ?? null; ?>
                    <tr>
                        <td><strong><?php echo e($quiz->title); ?></strong></td>
                        <td><?php echo e($quiz->questions->count()); ?> câu</td>
                        <td><?php echo e($quiz->duration_minutes); ?> phút</td>
                        <td><?php echo e($quiz->pass_score); ?> / <?php echo e($quiz->max_score); ?></td>
                        <td>
                            <?php if($attempt && $attempt->status == 'Đã nộp'): ?>
                                <strong><?php echo e($attempt->total_score); ?></strong>
                            <?php else: ?>
                                <span class="text-muted">Chưa có</span>
                            <?php endif; ?>
                        </td>
                        <td>
                            <?php if($attempt && $attempt->status == 'Đã nộp'): ?>
                                <span class="badge <?php echo e($attempt->result == 'Đạt' ? 'bg-success' : 'bg-danger'); ?>">
                                    <?php echo e($attempt->result); ?>

                                </span>
                            <?php elseif($attempt && $attempt->status == 'Đang làm'): ?>
                                <span class="badge bg-info text-dark">Đang làm</span>
                            <?php else: ?>
                                <span class="badge bg-warning text-dark">Chưa làm</span>
                            <?php endif; ?>
                        </td>
                        <td class="text-end">
                            <?php if($attempt && $attempt->status == 'Đã nộp'): ?>
                                <a href="<?php echo e(route('student-portal.quiz.result', [$enrollment->id, $attempt->id])); ?>"
                                   class="btn btn-sm btn-outline-primary">
                                    Xem kết quả
                                </a>
                            <?php else: ?>
                                <a href="<?php echo e(route('student-portal.quiz.intro', [$enrollment->id, $quiz->id])); ?>"
                                   class="btn btn-sm <?php echo e($attempt ? 'btn-info' : 'btn-primary'); ?>">
                                    <?php echo e($attempt ? 'Tiếp tục làm bài' : 'Xem đề thi'); ?>

                                </a>
                            <?php endif; ?>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="7" class="text-center text-muted py-4">
                            Lớp học này chưa có bài trắc nghiệm.
                        </td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?>

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