<?php $__env->startSection('content'); ?>
<div class="container mx-auto max-w-5xl px-4">
    <?php echo $__env->make('admin.panel._nav', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <h1 class="mb-6 text-xl font-semibold text-gray-900">Konten Section Homepage</h1>

    <div class="overflow-x-auto rounded border border-gray-200">
        <table class="min-w-full text-sm">
            <thead class="bg-gray-50 text-left text-gray-600">
                <tr>
                    <th class="px-4 py-2">Section</th>
                    <th class="px-4 py-2">Judul</th>
                    <th class="px-4 py-2">Item</th>
                    <th class="px-4 py-2">Status</th>
                    <th class="px-4 py-2">Aksi</th>
                </tr>
            </thead>
            <tbody>
                <?php $__currentLoopData = $sections; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $section): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr class="border-t border-gray-100">
                        <td class="px-4 py-2 font-medium text-gray-900"><?php echo e($section->name); ?></td>
                        <td class="px-4 py-2"><?php echo e($section->title ?: '-'); ?></td>
                        <td class="px-4 py-2"><?php echo e($section->items_count); ?></td>
                        <td class="px-4 py-2">
                            <?php if($section->is_active): ?>
                                <span class="rounded bg-green-100 px-2 py-1 text-xs text-green-800">Aktif</span>
                            <?php else: ?>
                                <span class="rounded bg-gray-200 px-2 py-1 text-xs text-gray-700">Nonaktif</span>
                            <?php endif; ?>
                        </td>
                        <td class="px-4 py-2">
                            <div class="flex flex-wrap gap-2">
                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('edit sections')): ?>
                                    <a href="<?php echo e(route('admin.sections.edit', $section)); ?>" class="text-blue-600 hover:underline">Edit</a>
                                    <form method="POST" action="<?php echo e(route('admin.sections.toggle-status', $section)); ?>">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('PATCH'); ?>
                                        <button type="submit" class="text-amber-600 hover:underline">
                                            <?php echo e($section->is_active ? 'Nonaktifkan' : 'Aktifkan'); ?>

                                        </button>
                                    </form>
                                <?php endif; ?>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon2\www\dsi112com\resources\views/admin/panel/sections/index.blade.php ENDPATH**/ ?>