<div class="panel-actions">
    <a class="btn-primary" href="<?= e(url('admin/kategori/ekle')) ?>">+ Yeni Kategori</a>
</div>

<div class="panel">
    <div class="table-scroll">
    <table class="data-table">
        <thead><tr><th>#</th><th>Görsel</th><th>Ad</th><th>Ürün</th><th>Sıra</th><th>Durum</th><th>İşlem</th></tr></thead>
        <tbody>
        <?php foreach ($categories as $c): ?>
            <tr>
                <td><?= (int)$c['id'] ?></td>
                <td>
                    <?php if (!empty($c['image'])): ?>
                        <img class="thumb" src="<?= e(media_url($c['image'])) ?>" alt="">
                    <?php else: ?><span class="thumb thumb-emoji"><?= e($c['icon'] ?: '🍽') ?></span><?php endif; ?>
                </td>
                <td><strong><?= e($c['name']) ?></strong><br><small class="muted"><?= e($c['slug']) ?></small></td>
                <td><?= (int)$c['pc'] ?></td>
                <td><?= (int)$c['sort_order'] ?></td>
                <td><?= $c['is_active'] ? '<span class="pill on">Aktif</span>' : '<span class="pill off">Pasif</span>' ?></td>
                <td class="actions">
                    <a class="mini-btn" href="<?= e(url('admin/kategori/duzenle/'.$c['id'])) ?>">Düzenle</a>
                    <a class="mini-btn danger" href="<?= e(del_link('admin/kategori/sil/'.$c['id'])) ?>" data-confirm="Bu kategoriyi silmek istediğinize emin misiniz?">Sil</a>
                </td>
            </tr>
        <?php endforeach; ?>
        <?php if (empty($categories)): ?><tr><td colspan="7" class="muted">Kategori yok.</td></tr><?php endif; ?>
        </tbody>
    </table>
    </div>
</div>
