

<?php $__env->startSection('content'); ?>
<div class="container-xxl flex-grow-1 container-p-y">
    <div class="card">
        <div class="card-header">
            <div class="row align-items-center">
                <div class="col">
                    <h5 class="mb-0">Assignments</h5>
                </div>

                <div class="col text-end">
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('assignments create')): ?>
                        <a href="<?php echo e(route('assignments.create')); ?>" class="btn btn-primary">
                            Add Assignment
                        </a>
                    <?php endif; ?>
                </div>
            </div>
            <hr/>
        </div>

        <div class="card-body">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('success')): ?>
                <div class="alert alert-success"><?php echo e(session('success')); ?></div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            <div class="table-responsive">
                <table class="table" id="bookings-table">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Course</th>
                            <th>Title</th>
                            <th>Due Date</th>
                            <th>Created By</th>
                            <th>Created At</th>
                            <th style="width:220px;">Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $assignments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td><?php echo e($a->id); ?></td>
                                <td><?php echo e($a->course?->title ?? 'N/A'); ?></td>
                                <td><?php echo e($a->title); ?></td>
                                <td><?php echo e($a->due_date ? $a->due_date->format('Y-m-d H:i') : 'N/A'); ?></td>
                                <td><?php echo e($a->creator?->name ?? 'N/A'); ?></td>
                                <td><?php echo e($a->created_at?->format('Y-m-d')); ?></td>
                                <td>
                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('assignments view')): ?>
                                        <a class="btn btn-sm btn-info"
                                           href="<?php echo e(route('assignments.show', $a)); ?>">
                                            View
                                        </a>
                                    <?php endif; ?>

                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('assignments update')): ?>
                                        <a class="btn btn-sm btn-warning"
                                           href="<?php echo e(route('assignments.edit', $a)); ?>">
                                            Edit
                                        </a>
                                    <?php endif; ?>

                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('assignments delete')): ?>
                                        <form class="d-inline"
                                              method="POST"
                                              action="<?php echo e(route('assignments.destroy', $a)); ?>"
                                              onsubmit="return confirm('Delete this assignment?');">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button class="btn btn-sm btn-danger">Delete</button>
                                        </form>
                                    <?php endif; ?>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="7" class="text-center">No assignments found.</td>
                            </tr>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </tbody>
                </table>
            </div>

            <a href="<?php echo e(route('courses.index')); ?>" class="btn btn-secondary mt-3">Back to Courses</a>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('script'); ?>
<script>
$(document).ready(function () {
    $('#bookings-table').DataTable({
        responsive: false,
        scrollX: true,
        pageLength: 10,
        lengthMenu: [5, 10, 25, 50, 100],
        order: [[0, 'desc']],
        columnDefs: [{ orderable: false, targets: -1 }]
    });
});
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH F:\xampp\htdocs\G_desizn\digitizing-academy\resources\views/assignments/index.blade.php ENDPATH**/ ?>