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