<?php $__empty_1 = true; $__currentLoopData = $enrollments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $enrollment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<tr class="<?php echo e($i % 2 === 0 ? 'bg-white' : 'bg-gray-50/50'); ?> hover:bg-indigo-50/30 transition">

    
    <td class="px-4 py-3 text-gray-400 text-xs font-medium">
        <?php echo e($enrollments->firstItem() + $i); ?>

    </td>

    
    <td class="px-4 py-3">
        <div class="flex items-center gap-2">
            <span class="w-7 h-7 bg-purple-100 rounded-full flex items-center justify-center text-xs font-bold text-purple-600 flex-shrink-0">
                <?php echo e(strtoupper(substr($enrollment->user->name ?? 'U', 0, 1))); ?>

            </span>
            <div>
                <p class="font-semibold text-gray-800 text-sm leading-tight"><?php echo e($enrollment->user->name ?? '—'); ?></p>
                <p class="text-gray-400 text-xs mt-0.5"><?php echo e($enrollment->user->email ?? '—'); ?></p>
            </div>
        </div>
    </td>

    
    <td class="px-4 py-3">
        <p class="text-sm font-medium text-gray-700 line-clamp-1"><?php echo e($enrollment->course->title ?? '—'); ?></p>
    </td>

    
    <td class="px-4 py-3">
        <?php
            $statusMap = [
                'active'          => ['bg-green-100 text-green-700',  'fa-circle-check',    'Active'],
                'completed'       => ['bg-blue-100 text-blue-700',    'fa-graduation-cap',  'Completed'],
                'pending_payment' => ['bg-amber-100 text-amber-700',  'fa-clock',           'Pending Payment'],
                'payment_failed'  => ['bg-red-100 text-red-700',      'fa-circle-xmark',    'Payment Failed'],
                'cancelled'       => ['bg-gray-100 text-gray-500',    'fa-ban',             'Cancelled'],
            ];
            [$cls, $icon, $label] = $statusMap[$enrollment->status] ?? ['bg-gray-100 text-gray-500', 'fa-circle', ucfirst($enrollment->status)];
        ?>
        <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium <?php echo e($cls); ?>">
            <i class="fas <?php echo e($icon); ?> text-xs"></i> <?php echo e($label); ?>

        </span>
    </td>

    
    <td class="px-4 py-3">
        <?php if($enrollment->amount_paid > 0): ?>
            <span class="text-sm font-medium text-gray-700">
                <?php echo e($enrollment->course->currency ?? 'UGX'); ?> <?php echo e(number_format($enrollment->amount_paid)); ?>

            </span>
        <?php else: ?>
            <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-700">
                <i class="fas fa-gift text-xs"></i> Free
            </span>
        <?php endif; ?>
    </td>

    
    <td class="px-4 py-3">
        <span class="text-xs text-gray-500">
            <?php echo e($enrollment->payment_method === 'mtn_momo' ? 'MTN MoMo' : ucfirst(str_replace('_', ' ', $enrollment->payment_method))); ?>

        </span>
    </td>

    
    <td class="px-4 py-3">
        <span class="text-xs text-gray-500">
            <?php echo e($enrollment->enrolled_at?->format('d M Y') ?? $enrollment->created_at->format('d M Y')); ?>

        </span>
    </td>

    
    <td class="px-4 py-3">
        <div class="flex items-center gap-1">
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view self-paced enrollments')): ?>
            <a href="<?php echo e(route('self-paced.dashboard.enrollments.show', $enrollment)); ?>"
               title="View"
               class="w-7 h-7 flex items-center justify-center rounded-lg bg-indigo-50 hover:bg-indigo-100 text-indigo-600 transition">
                <i class="fas fa-eye text-xs"></i>
            </a>
            <?php endif; ?>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('manage self-paced enrollments')): ?>
            <?php if(!$enrollment->canAccess()): ?>
            <button type="button"
                    title="Activate"
                    onclick="confirmActivate(<?php echo e($enrollment->id); ?>)"
                    class="w-7 h-7 flex items-center justify-center rounded-lg bg-green-50 hover:bg-green-100 text-green-600 transition">
                <i class="fas fa-play text-xs"></i>
            </button>
            <form id="activate-form-<?php echo e($enrollment->id); ?>"
                  action="<?php echo e(route('self-paced.dashboard.enrollments.activate', $enrollment)); ?>"
                  method="POST" class="hidden">
                <?php echo csrf_field(); ?>
            </form>
            <?php endif; ?>
            <?php if(!$enrollment->isCompleted() && !$enrollment->isCancelled()): ?>
            <button type="button"
                    title="Cancel"
                    onclick="confirmCancel(<?php echo e($enrollment->id); ?>, '<?php echo e(addslashes($enrollment->user->name ?? '')); ?>')"
                    class="w-7 h-7 flex items-center justify-center rounded-lg bg-red-50 hover:bg-red-100 text-red-600 transition">
                <i class="fas fa-ban text-xs"></i>
            </button>
            <form id="cancel-form-<?php echo e($enrollment->id); ?>"
                  action="<?php echo e(route('self-paced.dashboard.enrollments.cancel', $enrollment)); ?>"
                  method="POST" class="hidden">
                <?php echo csrf_field(); ?>
            </form>
            <?php endif; ?>
            <?php if($enrollment->isPendingPayment() || $enrollment->isPaymentFailed()): ?>
            <button type="button"
                    title="Check Payment"
                    onclick="document.getElementById('check-payment-form-<?php echo e($enrollment->id); ?>').submit()"
                    class="w-7 h-7 flex items-center justify-center rounded-lg bg-teal-50 hover:bg-teal-100 text-teal-600 transition">
                <i class="fas fa-rotate text-xs"></i>
            </button>
            <form id="check-payment-form-<?php echo e($enrollment->id); ?>"
                  action="<?php echo e(route('self-paced.dashboard.enrollments.check-payment', $enrollment)); ?>"
                  method="POST" class="hidden">
                <?php echo csrf_field(); ?>
            </form>
            <?php endif; ?>
            <?php endif; ?>
        </div>
    </td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<tr>
    <td colspan="8" class="px-6 py-16 text-center">
        <i class="fas fa-users text-5xl text-gray-200 mb-4 block"></i>
        <p class="text-gray-400 font-medium">No enrollments found</p>
        <p class="text-gray-300 text-sm mt-1">Try adjusting your search or filters.</p>
    </td>
</tr>
<?php endif; ?>
<?php /**PATH /home/www/sshia.org/sshia/resources/views/self-paced/dashboard/enrollments/partials/table.blade.php ENDPATH**/ ?>