<?php $__env->startSection('title', 'Homework / LMS'); ?>
<?php $__env->startSection('page_title', 'Homework, Assignments & Notes'); ?>
<?php $__env->startSection('breadcrumbs'); ?>
    <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Home</a></li><li class="breadcrumb-item active">LMS</li>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page_actions'); ?>
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('lms.create')): ?><a href="<?php echo e(route('materials.create')); ?>" class="btn btn-primary"><i class="bi bi-plus-lg me-1"></i>Post Material</a><?php endif; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="card mb-3"><div class="card-body py-2">
        <form method="GET" class="row g-2 align-items-end">
            <div class="col-md-3"><label class="form-label small">Class</label>
                <select name="class_id" class="form-select form-select-sm">
                    <option value="">All classes</option>
                    <?php $__currentLoopData = $classes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($c->id); ?>" <?php if(($filters['class_id'] ?? '')==$c->id): echo 'selected'; endif; ?>><?php echo e($c->name); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select></div>
            <div class="col-md-3"><label class="form-label small">Type</label>
                <select name="type" class="form-select form-select-sm">
                    <option value="">All types</option>
                    <?php $__currentLoopData = App\Models\LearningMaterial::TYPES; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $val => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($val); ?>" <?php if(($filters['type'] ?? '')===$val): echo 'selected'; endif; ?>><?php echo e($label); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select></div>
            <div class="col-md-3"><button class="btn btn-sm btn-primary"><i class="bi bi-funnel me-1"></i>Filter</button>
                <a href="<?php echo e(route('materials.index')); ?>" class="btn btn-sm btn-light border">Reset</a></div>
        </form>
    </div></div>

    <div class="card"><div class="card-body">
        <table class="table table-hover align-middle">
            <thead><tr><th>Title</th><th>Type</th><th>Class</th><th>Subject</th><th>Due</th><th class="text-center">Submissions</th><th class="text-end">Actions</th></tr></thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $materials; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td><a href="<?php echo e(route('materials.show', $m)); ?>" class="fw-semibold text-decoration-none"><?php echo e($m->title); ?></a><?php if($m->attachment): ?> <i class="bi bi-paperclip text-muted"></i><?php endif; ?></td>
                        <td><span class="badge bg-soft-<?php echo e($m->type_color); ?>"><?php echo e($m->type_label); ?></span></td>
                        <td class="small"><?php echo e($m->schoolClass?->name); ?></td>
                        <td class="small"><?php echo e($m->subject?->name ?? '—'); ?></td>
                        <td class="small"><?php echo e(optional($m->due_date)->format('d M Y') ?? '—'); ?></td>
                        <td class="text-center"><?php echo e($m->type === 'assignment' ? $m->submissions_count : '—'); ?></td>
                        <td class="text-end">
                            <a href="<?php echo e(route('materials.show', $m)); ?>" class="btn btn-sm btn-light border"><i class="bi bi-eye"></i></a>
                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('lms.update')): ?><a href="<?php echo e(route('materials.edit', $m)); ?>" class="btn btn-sm btn-light border"><i class="bi bi-pencil"></i></a><?php endif; ?>
                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('lms.delete')): ?><form method="POST" action="<?php echo e(route('materials.destroy', $m)); ?>" class="d-inline" data-confirm="Delete?"><?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?><button class="btn btn-sm btn-light border text-danger"><i class="bi bi-trash"></i></button></form><?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">No materials yet.</td></tr>
                <?php endif; ?>
            </tbody>
        </table>
        <?php echo e($materials->links()); ?>

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

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/u385418287/domains/itartificer.com/public_html/sms-erp/resources/views/lms/index.blade.php ENDPATH**/ ?>