Autosave: 20260226-135745

This commit is contained in:
Flatlogic Bot 2026-02-26 13:57:45 +00:00
parent 3f43980699
commit 7e5ce73bed

View File

@ -9,11 +9,11 @@ try {
// Fetch all tables with their area names, filtered by outlet_id
$sql = "
SELECT t.id, t.name, t.capacity, a.name AS area_name
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
ORDER BY a.name ASC, t.name ASC
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]);
@ -34,7 +34,7 @@ try {
// Mark tables as occupied
foreach ($tables as &$table) {
$table['is_occupied'] = in_array($table['id'], $occupiedTableIds);
$table['is_occupied'] = in_array($table['id'], $occupiedTableIds) || $table['status'] === 'occupied';
}
echo json_encode(['success' => true, 'tables' => $tables]);