diff --git a/admin/table_edit.php b/admin/table_edit.php
index 4645cfa..fb94237 100644
--- a/admin/table_edit.php
+++ b/admin/table_edit.php
@@ -31,8 +31,11 @@ if (!$table) {
die("Table not found.");
}
-// Fetch Areas for Dropdown
-$areas = $pdo->query("SELECT id, name FROM areas ORDER BY name ASC")->fetchAll();
+// Fetch Areas for Dropdown (with outlet names)
+$areas = $pdo->query("SELECT areas.id, areas.name, outlets.name as outlet_name
+ FROM areas
+ JOIN outlets ON areas.outlet_id = outlets.id
+ ORDER BY outlets.name ASC, areas.name ASC")->fetchAll();
include 'includes/header.php';
?>
@@ -53,12 +56,12 @@ include 'includes/header.php';
-
+
@@ -77,4 +80,4 @@ include 'includes/header.php';
-
+
\ No newline at end of file
diff --git a/admin/tables.php b/admin/tables.php
index 118dc6a..c6e39a1 100644
--- a/admin/tables.php
+++ b/admin/tables.php
@@ -15,17 +15,21 @@ if (isset($_GET['delete'])) {
exit;
}
-// Fetch tables with area names
-$query = "SELECT tables.*, areas.name as area_name
+// Fetch tables with area and outlet names
+$query = "SELECT tables.*, areas.name as area_name, outlets.name as outlet_name
FROM tables
LEFT JOIN areas ON tables.area_id = areas.id
+ LEFT JOIN outlets ON areas.outlet_id = outlets.id
ORDER BY tables.id DESC";
$tables_pagination = paginate_query($pdo, $query);
$tables = $tables_pagination['data'];
-// Fetch areas for dropdown
-$areas = $pdo->query("SELECT id, name FROM areas ORDER BY name ASC")->fetchAll();
+// Fetch areas for dropdown (with outlet names)
+$areas = $pdo->query("SELECT areas.id, areas.name, outlets.name as outlet_name
+ FROM areas
+ JOIN outlets ON areas.outlet_id = outlets.id
+ ORDER BY outlets.name ASC, areas.name ASC")->fetchAll();
include 'includes/header.php';
@@ -58,7 +62,7 @@ $baseUrl = $protocol . $host . ($dir === '/' ? '' : $dir) . '/qorder.php';