// Kitchen display: poll open orders and render them oldest-first so the // pass works the tickets in the order they landed. Kiosk mode, no input. const POLL_MS = 2000; const root = document.getElementById("orders"); function ageClass(placedAt) { const mins = (Date.now() - new Date(placedAt).getTime()) / 60000; if (mins > 8) return "ticket late"; if (mins > 4) return "ticket warn"; return "ticket"; } function render(orders) { orders.sort((a, b) => new Date(a.placed_at) - new Date(b.placed_at)); root.innerHTML = ""; for (const o of orders) { const el = document.createElement("div"); el.className = ageClass(o.placed_at); el.innerHTML = `