From 108a90531e3e25454e396393f0b3b93a787c5d36 Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Sun, 18 Jan 2026 13:22:27 -0800 Subject: [PATCH] KDS: Fix station selection logic, add debug logging --- kds/kds.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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(); } }