diff --git a/api/setup/saveWizard.cfm b/api/setup/saveWizard.cfm index 9639130..27ec420 100644 --- a/api/setup/saveWizard.cfm +++ b/api/setup/saveWizard.cfm @@ -344,6 +344,15 @@ try { } response.steps.append("Created 7 default task categories"); + // Create default kitchen station + queryTimed(" + INSERT INTO Stations (BusinessID, Name, Color, SortOrder) + VALUES (:businessID, 'Kitchen', '##FF9800', 1) + ", { + businessID: { value: businessId, cfsqltype: "cf_sql_integer" } + }, { datasource: "payfrit" }); + response.steps.append("Created default Kitchen station"); + // Save business hours from structured schedule if (structKeyExists(biz, "hoursSchedule") && isArray(biz.hoursSchedule)) { hoursSchedule = biz.hoursSchedule; diff --git a/kds/kds.js b/kds/kds.js index f23694e..f1502f9 100644 --- a/kds/kds.js +++ b/kds/kds.js @@ -59,9 +59,17 @@ function loadConfig() { if (saved) { try { const parsed = JSON.parse(saved); - config.stationId = parsed.stationId !== undefined ? parsed.stationId : null; - config.stationName = parsed.stationName || null; - config.stationColor = parsed.stationColor || null; + // Reset station selection if business changed since last KDS use + if (parsed.businessId && parsed.businessId !== config.businessId) { + config.stationId = null; + config.stationName = null; + config.stationColor = null; + saveConfigToStorage(); + } else { + config.stationId = parsed.stationId !== undefined ? parsed.stationId : null; + config.stationName = parsed.stationName || null; + config.stationColor = parsed.stationColor || null; + } config.refreshInterval = (parsed.refreshInterval || 5) * 1000; } catch (e) { console.error('[KDS] Failed to load config:', e); @@ -73,6 +81,7 @@ function loadConfig() { function saveConfigToStorage() { localStorage.setItem('kds_config', JSON.stringify({ + businessId: config.businessId, stationId: config.stationId, stationName: config.stationName, stationColor: config.stationColor,