diff --git a/admin/ads.php b/admin/ads.php index d85cd67..c4dcbb4 100644 --- a/admin/ads.php +++ b/admin/ads.php @@ -4,6 +4,8 @@ require_permission("ads_view"); require_once __DIR__ . '/../db/config.php'; $pdo = db(); +$message = ''; + // Ensure the table exists (idempotent) $pdo->exec("CREATE TABLE IF NOT EXISTS ads_images ( id INT AUTO_INCREMENT PRIMARY KEY, @@ -16,23 +18,27 @@ $pdo->exec("CREATE TABLE IF NOT EXISTS ads_images ( )"); if (isset($_GET['delete'])) { - $id = $_GET['delete']; - - // Get image path to delete file - $stmt = $pdo->prepare("SELECT image_path FROM ads_images WHERE id = ?"); - $stmt->execute([$id]); - $ad = $stmt->fetch(); - - if ($ad) { - $fullPath = __DIR__ . '/../' . $ad['image_path']; - if (file_exists($fullPath) && is_file($fullPath)) { - unlink($fullPath); + if (!has_permission('ads_del')) { + $message = '
Manage pictures for the public ads display page.
+ Add Image + += $message ?> +Welcome back, = htmlspecialchars($userName) ?>!
+ +Welcome back, = htmlspecialchars($userName) ?>!
+| ID | +Type | +Table/Customer | +Total | +Status | +Date | +
|---|---|---|---|---|---|
| #= $order['id'] ?> | ++ 'bg-info', + 'takeaway' => 'bg-success', + 'delivery' => 'bg-warning', + 'drive-thru' => 'bg-purple', + default => 'bg-secondary' + }; + ?> + = ucfirst($order['order_type']) ?> + | ++ + Table = htmlspecialchars($order['table_number']) ?> + + = htmlspecialchars($order['customer_name'] ?? 'Guest') ?> + + | += format_currency($order['total_amount']) ?> | ++ + = ucfirst($order['status']) ?> + + | += date('M d, H:i', strtotime($order['created_at'])) ?> | +
| No recent orders found. | |||||
Welcome to the Admin Panel, = htmlspecialchars($userName) ?>!
+ +| ID | -Type | -Table/Customer | -Total | -Status | -Date | -
|---|---|---|---|---|---|
| #= $order['id'] ?> | -- 'bg-info', - 'takeaway' => 'bg-success', - 'delivery' => 'bg-warning', - 'drive-thru' => 'bg-purple', - default => 'bg-secondary' - }; - ?> - = ucfirst($order['order_type']) ?> - | -- - Table = htmlspecialchars($order['table_number']) ?> - - = htmlspecialchars($order['customer_name'] ?? 'Guest') ?> - - | -= format_currency($order['total_amount']) ?> | -- - = ucfirst($order['status']) ?> - - | -= date('M d, H:i', strtotime($order['created_at'])) ?> | -
| No recent orders found. | |||||
{customer_name}, {company_name}, {order_id},
@@ -187,6 +198,7 @@ require_once __DIR__ . '/includes/header.php';
Updating the status here will immediately reflect across all systems (Kitchen, POS, Admin).
+Order Created
+= date('M d, Y H:i:s', strtotime($order['created_at'])) ?>
+ +Last Updated
+= $order['updated_at'] ? date('M d, Y H:i:s', strtotime($order['updated_at'])) : 'Never' ?>
+Placed on = date('M d, Y H:i', strtotime($order['created_at'])) ?>
+| Product | +Price | +Qty | +Total | +
|---|---|---|---|
|
+ = htmlspecialchars($item['product_name']) ?>
+
+ Variant: = htmlspecialchars($item['variant_name']) ?>
+
+ |
+ = format_currency($item['unit_price']) ?> | += $item['quantity'] ?> | += format_currency($item['unit_price'] * $item['quantity']) ?> | +
|
+ Subtotal
+ 0): ?>
+ Discount
+
+ VAT / Tax
+ Total Amount+ |
+
+ = format_currency($subtotal) ?>
+ 0): ?>
+ -= format_currency($order['discount']) ?>
+
+ = format_currency(0) ?>
+ = format_currency($order['total_amount']) ?>+ |
+ ||
= htmlspecialchars($order['notes'] ?? 'No notes provided for this order.') ?>
+No customer attached to this order (Guest)
+