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