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

<?php $__env->startSection('content'); ?>
<div class="card border-0 shadow-sm rounded-4 p-4 card-accent-green">
    <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-newspaper text-success me-2"></i> Kelola Artikel Edukasi</h5>
            <small class="text-muted">Buat, ubah, dan hapus materi artikel untuk website edukasi sampah</small>
        </div>
        <a href="<?php echo e(route('admin.articles.create')); ?>" class="btn btn-success rounded-pill fw-bold px-4 py-2 shadow-sm" style="background: linear-gradient(90deg, #10b981 0%, #059669 100%); border: none;">
            <i class="fa-solid fa-plus me-1"></i> Tambah Artikel 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">Gambar</th>
                    <th>Judul Artikel</th>
                    <th style="width: 150px;">Kategori</th>
                    <th style="width: 150px;">Tanggal Rilis</th>
                    <th class="text-end" style="width: 200px;">Aksi</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $articles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $art): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <tr>
                    <td class="text-center">
                        <img src="<?php echo e($art->image); ?>" alt="" class="rounded-3 shadow-sm border border-2 border-white" style="width: 50px; height: 50px; object-fit: cover;">
                    </td>
                    <td>
                        <a href="<?php echo e(route('articles.show', $art->slug)); ?>" target="_blank" class="text-decoration-none text-dark link-success">
                            <strong class="d-block" style="font-size: 0.95rem;"><?php echo e($art->title); ?></strong>
                        </a>
                        <small class="text-muted"><?php echo e(Str::limit($art->snippet, 75)); ?></small>
                    </td>
                    <td><span class="badge bg-success"><?php echo e($art->category); ?></span></td>
                    <td><small class="text-muted"><i class="fa-regular fa-calendar me-1"></i><?php echo e($art->created_at->format('d M Y')); ?></small></td>
                    <td class="text-end">
                        <div class="d-inline-flex gap-2">
                            <a href="<?php echo e(route('articles.show', $art->slug)); ?>" target="_blank" class="btn btn-sm btn-outline-info rounded-pill px-3">
                                <i class="fa-solid fa-eye me-1"></i> Lihat
                            </a>
                            <a href="<?php echo e(route('admin.articles.edit', $art->id)); ?>" class="btn btn-sm btn-outline-warning rounded-pill px-3">
                                <i class="fa-solid fa-pen me-1"></i> Edit
                            </a>
                            <form action="<?php echo e(route('admin.articles.destroy', $art->id)); ?>" method="POST" class="d-inline" onsubmit="return confirm('Yakin ingin menghapus artikel 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>
                        </div>
                    </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 artikel edukasi. Klik tombol di atas untuk membuat.</p>
                    </td>
                </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>

    <div class="d-flex justify-content-center mt-4">
        <?php echo e($articles->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/articles/index.blade.php ENDPATH**/ ?>