KDS: Fix station selection logic, add debug logging

This commit is contained in:
John Mizerek 2026-01-18 13:22:27 -08:00
parent 4e4f3cf465
commit 108a90531e

View file

@ -70,21 +70,28 @@ function saveConfigToStorage() {
// Check if station selection is needed // Check if station selection is needed
async function checkStationSelection() { async function checkStationSelection() {
if (!config.businessId) return; if (!config.businessId) {
console.log('[KDS] No businessId, cannot start');
return;
}
// If station already selected, start KDS console.log('[KDS] Starting with businessId:', config.businessId, 'stationId:', config.stationId);
if (config.stationId !== null) {
// If station already selected (including 0 for "all"), start KDS
if (config.stationId !== null && config.stationId !== undefined) {
updateStationBadge(); updateStationBadge();
startAutoRefresh(); startAutoRefresh();
return; return;
} }
// Load stations and show selection // Load stations to see if we need to show picker
await loadStations(); await loadStations();
if (stations.length > 0) { if (stations.length > 0) {
showStationSelection(); showStationSelection();
} else { } else {
// No stations configured, just start with all orders // No stations configured, default to all orders
config.stationId = 0;
updateStationBadge();
startAutoRefresh(); startAutoRefresh();
} }
} }