<?php $__env->startSection('title', 'Kelola Poster Edukasi'); ?>

<?php $__env->startSection('content'); ?>
<div class="card border-0 shadow-sm rounded-4 p-4 card-accent-blue">
    <div class="d-flex flex-column flex-md-row justify-content-between align-items-md-center gap-3 mb-4">
        <div>
            <h5 class="fw-bold mb-1 text-dark"><i class="fa-solid fa-file-image text-primary me-2"></i> Kelola Poster Edukasi</h5>
            <small class="text-muted">Upload dan hapus media poster edukasi sampah yang siap diunduh oleh siswa</small>
        </div>
        <a href="<?php echo e(route('admin.posters.create')); ?>" class="btn btn-primary rounded-pill fw-bold px-4 py-2 shadow-sm" style="background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%); border: none;">
            <i class="fa-solid fa-plus me-1"></i> Tambah Poster Baru
        </a>
    </div>

    <div class="table-responsive">
        <table class="table table-hover align-middle">
            <thead class="table-light">
                <tr>
                    <th style="width: 80px;" class="text-center">Pratinjau</th>
                    <th>Judul Poster</th>
                    <th>Deskripsi Singkat</th>
                    <th style="width: 150px;">Unduhan</th>
                    <th class="text-end" style="width: 150px;">Aksi</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $posters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pos): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <tr>
                    <td class="text-center">
                        <img src="<?php echo e($pos->preview_image); ?>" alt="" class="rounded-3 shadow-sm border border-2 border-white" style="width: 50px; height: 50px; object-fit: cover;">
                    </td>
                    <td><strong class="text-dark d-block" style="font-size: 0.95rem;"><?php echo e($pos->title); ?></strong></td>
                    <td><small class="text-muted"><?php echo e(Str::limit($pos->description, 75)); ?></small></td>
                    <td>
                        <span class="badge bg-info text-dark">
                            <i class="fa-solid fa-download me-1"></i> <?php echo e($pos->download_count); ?>x Diunduh
                        </span>
                    </td>
                    <td class="text-end">
                        <form action="<?php echo e(route('admin.posters.destroy', $pos->id)); ?>" method="POST" class="d-inline" onsubmit="return confirm('Hapus poster ini?')">
                            <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                            <button class="btn btn-sm btn-outline-danger rounded-pill px-3">
                                <i class="fa-solid fa-trash me-1"></i> Hapus
                            </button>
                        </form>
                    </td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <tr>
                    <td colspan="5" class="text-center text-muted py-5">
                        <i class="fa-solid fa-folder-open fs-2 mb-2 text-muted"></i>
                        <p class="mb-0">Belum ada poster edukasi. Klik tombol di atas untuk menambah.</p>
                    </td>
                </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>

    <div class="d-flex justify-content-center mt-4">
        <?php echo e($posters->links()); ?>

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

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