KDS: Fix station selection logic, add debug logging
This commit is contained in:
parent
4e4f3cf465
commit
108a90531e
1 changed files with 12 additions and 5 deletions
17
kds/kds.js
17
kds/kds.js
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue