🤩 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:coupons.php
<?php $page = 'coupons'; $page_title = 'Coupons'; require_once '../includes/header.php'; if (isset($_GET['delete'])) { $db->prepare("DELETE FROM coupons WHERE id = ?")->execute([intval($_GET['delete'])]); admin_set_flash('success', 'Coupon deleted'); header('Location: ' . ADMIN_PATH . 'pages/coupons.php'); exit; } $coupons = $db->query("SELECT * FROM coupons ORDER BY created_at DESC")->fetchAll(); ?> <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 Coupons</h3> <a href="<?= ADMIN_PATH ?>pages/coupon-add.php" class="btn-admin btn-primary-admin"> <i class="fas fa-plus"></i> Add Coupon </a> </div> <div class="table-responsive"> <table class="admin-table"> <thead> <tr> <th>Code</th> <th>Type</th> <th>Value</th> <th>Min Cart</th> <th>Used / Limit</th> <th>Valid Till</th> <th>Status</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($coupons as $c): ?> <tr> <td><strong style="color: var(--primary-rose-gold);"><?= htmlspecialchars($c['code']) ?></strong></td> <td><span class="badge" style="background: var(--soft-pink); color: var(--primary-rose-gold);"><?= ucfirst($c['type']) ?></span></td> <td><strong><?= $c['type'] == 'percentage' ? $c['value'] . '%' : format_currency($c['value']) ?></strong></td> <td><?= format_currency($c['min_cart_amount']) ?></td> <td><?= $c['used_count'] ?> / <?= $c['usage_limit'] ?: '∞' ?></td> <td><?= $c['end_date'] ? date('M d, Y', strtotime($c['end_date'])) : 'No expiry' ?></td> <td> <span class="status-badge status-<?= $c['status'] ? 'active' : 'inactive' ?>"> <?= $c['status'] ? 'Active' : 'Inactive' ?> </span> </td> <td> <div class="action-buttons"> <a href="<?= ADMIN_PATH ?>pages/coupon-add.php?id=<?= $c['id'] ?>" class="btn-icon btn-admin btn-primary-admin" data-bs-toggle="tooltip" title="Edit"> <i class="fas fa-edit"></i> </a> <a href="?delete=<?= $c['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