// Video call booking (owner #71): day chips switch the visible times in place. The chips are real links (?tgl=), so the // picker also works without JS; one delegated listener per picker, nothing runs until a tap. import { store } from '/engine/engine.js'; for (const box of document.querySelectorAll('[data-days]')) { box.addEventListener('click', (e) => { const a = e.target.closest('a[data-day]'); if (!a) return; e.preventDefault(); for (const x of box.querySelectorAll('a[data-day]')) (x === a ? x.setAttribute('aria-current', 'true') : x.removeAttribute('aria-current')); for (const g of box.querySelectorAll('[data-for]')) g.hidden = g.dataset.for !== a.dataset.day; }); } // Coming from the price check on this device: name, number, car and city are filled in (kept 1 day, cleared on booking). const saved = store.get('vc'); const form = document.querySelector('form.book'); if (form && saved && Date.now() - (saved.t || 0) < 864e5) { for (const k of ['nama', 'wa', 'mobil', 'kota']) { const el = form.elements[k]; if (el && el.type !== 'hidden' && !el.value && saved[k]) el.value = saved[k]; } } form?.addEventListener('submit', () => store.remove('vc'));