diff --git a/kds/index.html b/kds/index.html index f14edbf..eae0544 100644 --- a/kds/index.html +++ b/kds/index.html @@ -76,8 +76,7 @@
-

Kitchen Display System

-
Loading...
+

Kitchen Display System

diff --git a/kds/kds.js b/kds/kds.js index 91b1706..bb26493 100644 --- a/kds/kds.js +++ b/kds/kds.js @@ -77,6 +77,9 @@ async function checkStationSelection() { console.log('[KDS] Starting with businessId:', config.businessId, 'stationId:', config.stationId); + // Load business name + await loadBusinessName(); + // If station already selected (including 0 for "all"), start KDS if (config.stationId !== null && config.stationId !== undefined) { updateStationBadge(); @@ -96,6 +99,25 @@ async function checkStationSelection() { } } +// Load business name from API +async function loadBusinessName() { + if (!config.businessId) return; + + try { + const response = await fetch(`${config.apiBaseUrl}/businesses/get.cfm`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ BusinessID: config.businessId }) + }); + const data = await response.json(); + if (data.OK && data.BUSINESS) { + document.getElementById('businessName').textContent = data.BUSINESS.BusinessName || 'Kitchen Display System'; + } + } catch (e) { + console.error('Failed to load business name:', e); + } +} + // Load stations from API async function loadStations() { if (!config.businessId) return;