Autosave: 20260226-135745
This commit is contained in:
parent
3f43980699
commit
7e5ce73bed
@ -9,11 +9,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.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
|
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
|
WHERE a.outlet_id = :outlet_id AND t.is_deleted = 0
|
||||||
ORDER BY a.name ASC, t.name 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]);
|
||||||
@ -34,7 +34,7 @@ try {
|
|||||||
|
|
||||||
// Mark tables as occupied
|
// Mark tables as occupied
|
||||||
foreach ($tables as &$table) {
|
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]);
|
echo json_encode(['success' => true, 'tables' => $tables]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user