101 lines
4.3 KiB
PHP
101 lines
4.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
$pdo = db();
|
|
$categories = $pdo->query("SELECT * FROM categories ORDER BY sort_order")->fetchAll();
|
|
$all_products = $pdo->query("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id")->fetchAll();
|
|
|
|
$table_id = $_GET['table'] ?? '1'; // Default table
|
|
$outlet_id = 1; // Main outlet
|
|
$settings = get_company_settings();
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>Menu - <?= htmlspecialchars($settings['company_name']) ?></title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time() ?>">
|
|
</head>
|
|
<body>
|
|
<nav class="navbar">
|
|
<div class="container d-flex justify-content-between align-items-center">
|
|
<a href="index.php" class="brand-logo"><?= htmlspecialchars($settings['company_name']) ?></a>
|
|
<div class="d-flex align-items-center">
|
|
<span class="badge bg-dark me-3">Table <?= htmlspecialchars($table_id) ?></span>
|
|
<a href="admin/orders.php" class="btn btn-sm btn-outline-dark">Staff POS</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="container mt-4">
|
|
<div class="row">
|
|
<!-- Menu Column -->
|
|
<div class="col-lg-8">
|
|
<h1 class="mb-4 fw-bold">Order Now</h1>
|
|
|
|
<?php foreach ($categories as $category): ?>
|
|
<h2 class="menu-category-title"><?= htmlspecialchars($category['name']) ?></h2>
|
|
<div class="row g-4 mb-5">
|
|
<?php foreach ($all_products as $product):
|
|
if ($product['category_id'] == $category['id']): ?>
|
|
<div class="col-md-6 col-lg-4">
|
|
<div class="product-card">
|
|
<img src="https://picsum.photos/seed/<?= $product['id'] ?>/400/300" alt="<?= htmlspecialchars($product['name']) ?>" class="product-image">
|
|
<div class="product-info">
|
|
<h3 class="product-name"><?= htmlspecialchars($product['name']) ?></h3>
|
|
<p class="product-desc"><?= htmlspecialchars($product['description']) ?></p>
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<span class="product-price"><?= format_currency($product['price']) ?></span>
|
|
<button class="btn btn-add btn-sm add-to-cart"
|
|
data-id="<?= $product['id'] ?>"
|
|
data-name="<?= htmlspecialchars($product['name']) ?>"
|
|
data-price="<?= $product['price'] ?>">
|
|
Add to Cart
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
<!-- Cart Column -->
|
|
<div class="col-lg-4 d-none d-lg-block">
|
|
<div class="cart-sidebar">
|
|
<h4 class="fw-bold mb-4">Your Order</h4>
|
|
<div id="cart-items" class="flex-grow-1 overflow-auto">
|
|
<p class="text-center text-muted mt-5">Your cart is empty.</p>
|
|
</div>
|
|
<div class="cart-total mt-3">
|
|
<span>Total</span>
|
|
<span id="cart-total-price"><?= format_currency(0) ?></span>
|
|
</div>
|
|
<button class="btn btn-dark w-100 btn-lg mt-4" id="checkout-btn" disabled>Place Order</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Mobile Cart Trigger -->
|
|
<div class="fixed-bottom d-lg-none p-3 bg-white border-top">
|
|
<button class="btn btn-dark w-100 btn-lg" id="mobile-cart-btn">View Cart (<?= format_currency(0) ?>)</button>
|
|
</div>
|
|
|
|
<div class="toast-container" id="toast-container"></div>
|
|
|
|
<script>
|
|
const COMPANY_SETTINGS = <?= json_encode($settings) ?>;
|
|
</script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="assets/js/main.js?v=<?= time() ?>"></script>
|
|
</body>
|
|
</html>
|