fix 8
This commit is contained in:
parent
130a0dc0a3
commit
1e9abec636
@ -67,11 +67,11 @@ if (isset($_GET['deleted'])) {
|
||||
|
||||
$areas = $pdo->query("SELECT * FROM areas WHERE is_deleted = 0 ORDER BY name ASC")->fetchAll();
|
||||
|
||||
$query = "SELECT t.id, t.table_number, t.capacity, t.status, t.area_id, a.name as area_name
|
||||
FROM tables t
|
||||
LEFT JOIN areas a ON t.area_id = a.id
|
||||
WHERE t.is_deleted = 0
|
||||
ORDER BY a.name ASC, t.`table_number` ASC";
|
||||
$query = "SELECT `t`.`id`, `t`.`table_number`, `t`.`capacity`, `t`.`status`, `t`.`area_id`, `a`.`name` AS `area_name`
|
||||
FROM `tables` AS `t`
|
||||
LEFT JOIN `areas` AS `a` ON `t`.`area_id` = `a`.`id`
|
||||
WHERE `t`.`is_deleted` = 0
|
||||
ORDER BY `a`.`name` ASC, `t`.`table_number` ASC";
|
||||
$tables_pagination = paginate_query($pdo, $query);
|
||||
$tables = $tables_pagination['data'];
|
||||
|
||||
@ -261,4 +261,4 @@ function editTable(table) {
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
@ -35,10 +35,10 @@ try {
|
||||
if ($tid) {
|
||||
// Validate table exists AND belongs to the correct outlet
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT t.id, t.table_number
|
||||
FROM tables t
|
||||
JOIN areas a ON t.area_id = a.id
|
||||
WHERE t.id = ? AND a.outlet_id = ?"
|
||||
"SELECT `t`.`id`, `t`.`table_number`
|
||||
FROM `tables` AS `t`
|
||||
JOIN `areas` AS `a` ON `t`.`area_id` = `a`.`id`
|
||||
WHERE `t`.`id` = ? AND `a`.`outlet_id` = ?"
|
||||
);
|
||||
$stmt->execute([$tid, $outlet_id]);
|
||||
$table = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
@ -52,10 +52,10 @@ try {
|
||||
if (!$table_id) {
|
||||
// Optional: try to find the first available table for this outlet
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT t.id, t.table_number
|
||||
FROM tables t
|
||||
JOIN areas a ON t.area_id = a.id
|
||||
WHERE a.outlet_id = ?
|
||||
"SELECT `t`.`id`, `t`.`table_number`
|
||||
FROM `tables` AS `t`
|
||||
JOIN `areas` AS `a` ON `t`.`area_id` = `a`.`id`
|
||||
WHERE `a`.`outlet_id` = ?
|
||||
LIMIT 1"
|
||||
);
|
||||
$stmt->execute([$outlet_id]);
|
||||
@ -419,4 +419,4 @@ You've earned *{points_earned} points* with this order.
|
||||
if ($pdo->inTransaction()) $pdo->rollBack();
|
||||
error_log("Order Error: " . $e->getMessage());
|
||||
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
@ -11,11 +11,11 @@ try {
|
||||
|
||||
// Fetch all tables with their area names, filtered by outlet_id
|
||||
$sql = "
|
||||
SELECT t.id, t.table_number as name, t.capacity, a.name AS area_name, t.status
|
||||
FROM tables t
|
||||
LEFT JOIN areas a ON t.area_id = a.id
|
||||
WHERE a.outlet_id = :outlet_id AND t.is_deleted = 0
|
||||
ORDER BY a.name ASC, t.`table_number` ASC
|
||||
SELECT `t`.`id`, `t`.`table_number` AS `name`, `t`.`capacity`, `a`.`name` AS `area_name`, `t`.`status`
|
||||
FROM `tables` AS `t`
|
||||
LEFT JOIN `areas` AS `a` ON `t`.`area_id` = `a`.`id`
|
||||
WHERE `a`.`outlet_id` = :outlet_id AND `t`.`is_deleted` = 0
|
||||
ORDER BY `a`.`name` ASC, `t`.`table_number` ASC
|
||||
";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute(['outlet_id' => $outlet_id]);
|
||||
|
||||
12
qorder.php
12
qorder.php
@ -18,11 +18,11 @@ if ($table_id <= 0) {
|
||||
// Fetch table and outlet info
|
||||
try {
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT t.id, t.table_number as table_name, a.outlet_id, o.name as outlet_name
|
||||
FROM tables t
|
||||
JOIN areas a ON t.area_id = a.id
|
||||
JOIN outlets o ON a.outlet_id = o.id
|
||||
WHERE t.id = ?
|
||||
SELECT `t`.`id`, `t`.`table_number` AS `table_name`, `a`.`outlet_id`, `o`.`name` AS `outlet_name`
|
||||
FROM `tables` AS `t`
|
||||
JOIN `areas` AS `a` ON `t`.`area_id` = `a`.`id`
|
||||
JOIN `outlets` AS `o` ON `a`.`outlet_id` = `o`.`id`
|
||||
WHERE `t`.`id` = ?
|
||||
");
|
||||
$stmt->execute([$table_id]);
|
||||
$table_info = $stmt->fetch();
|
||||
@ -526,4 +526,4 @@ foreach ($variants_raw as $v) {
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user