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

    <div class="mb-6 flex items-center justify-between">
        <h1 class="text-xl font-semibold text-gray-900">Tema Warna</h1>
        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('create themes')): ?>
            <a href="<?php echo e(route('admin.themes.create')); ?>" class="rounded bg-gray-900 px-3 py-2 text-sm text-white hover:bg-gray-700">
                Tambah Tema
            </a>
        <?php endif; ?>
    </div>
    <p class="mb-4 text-sm text-gray-500">Buat beberapa tema (mis. Default, Natal, Kemerdekaan), lalu klik "Aktifkan" salah satu untuk mengganti warna utama homepage saat ada event.</p>

    <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">Warna</th>
                    <th class="px-4 py-2">Logo</th>
                    <th class="px-4 py-2">Nama</th>
                    <th class="px-4 py-2">Status</th>
                    <th class="px-4 py-2">Aksi</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $themes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $theme): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr class="border-t border-gray-100">
                        <td class="px-4 py-2">
                            <span class="inline-block h-6 w-6 rounded-full border border-gray-200 align-middle" style="background-color: <?php echo e($theme->primary_color); ?>"></span>
                            <span class="ml-2 align-middle text-xs text-gray-500"><?php echo e($theme->primary_color); ?></span>
                        </td>
                        <td class="px-4 py-2">
                            <?php if($theme->logoUrl()): ?>
                                <img src="<?php echo e($theme->logoUrl()); ?>" alt="Logo <?php echo e($theme->name); ?>" class="h-8 w-auto rounded bg-slate-800 object-contain p-1">
                            <?php else: ?>
                                <span class="text-xs text-gray-400">-</span>
                            <?php endif; ?>
                        </td>
                        <td class="px-4 py-2 font-medium text-gray-900"><?php echo e($theme->name); ?></td>
                        <td class="px-4 py-2">
                            <?php if($theme->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 themes')): ?>
                                    <?php if (! ($theme->is_active)): ?>
                                        <form method="POST" action="<?php echo e(route('admin.themes.activate', $theme)); ?>">
                                            <?php echo csrf_field(); ?>
                                            <button type="submit" class="text-green-600 hover:underline">Aktifkan</button>
                                        </form>
                                    <?php endif; ?>
                                    <a href="<?php echo e(route('admin.themes.edit', $theme)); ?>" class="text-blue-600 hover:underline">Edit</a>
                                <?php endif; ?>
                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('delete themes')): ?>
                                    <form method="POST" action="<?php echo e(route('admin.themes.destroy', $theme)); ?>"
                                          onsubmit="return confirm('Hapus tema ini?')">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('DELETE'); ?>
                                        <button type="submit" class="text-red-600 hover:underline">Hapus</button>
                                    </form>
                                <?php endif; ?>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="5" class="px-4 py-6 text-center text-gray-500">Belum ada tema.</td>
                    </tr>
                <?php endif; ?>
            </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/themes/index.blade.php ENDPATH**/ ?>