This commit is contained in:
Flatlogic Bot 2026-02-27 03:16:35 +00:00
parent fb1aa34d97
commit 130a0dc0a3
2 changed files with 4 additions and 5 deletions

View File

@ -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.*, 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 t
LEFT JOIN areas a ON t.area_id = a.id LEFT JOIN areas a ON t.area_id = a.id
WHERE t.is_deleted = 0 WHERE t.is_deleted = 0
ORDER BY a.name ASC, 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'];
@ -262,4 +262,3 @@ function editTable(table) {
</script> </script>
<?php include 'includes/footer.php'; ?> <?php include 'includes/footer.php'; ?>
<?php // Actually, footer.php is usually included at the end. Let me fix that. ?>

View File

@ -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, 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 t
LEFT JOIN areas a ON t.area_id = a.id LEFT JOIN areas 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, 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]);