{ title: "Exterior & Parking Lot", items: ["Trash picked up","Windows clean","Exterior lights working","Entrance mats clean"] }, { title: "Dining Room & Lobby", items: ["Tables/chairs clean","Floors swept/mopped","Condiment station stocked","Trash cans not overflowing"] }, { title: "Restrooms", items: ["Toilets/urinals clean","Sinks/mirrors clean","Soap/paper stocked","No odors"] }, { title: "Kitchen / Backline", items: ["Surfaces sanitized","Food properly labeled","Temps in range","Handwash sink stocked"] }, { title: "Drive‑Thru", items: ["Headset working","Menu board clean","POS functioning","DT window clean"] }, { title: "Walk‑in / Freezer", items: ["Proper storage order","No expired product","Doors seal","Floors clean"] }, { title: "Safety & Cleanliness", items: ["Wet floor signs in use","Fire extinguishers tagged","No blocked exits","Chemicals labeled"] }, { title: "Management / Records", items: ["Daily checklists up to date","Crew schedule posted","Training up to date","Thermometer calibration log"] } ]; const sectionsEl = document.getElementById('sections'); const sections = DEFAULT_SECTIONS.map(sec => ({ title: sec.title, items: sec.items.map(label => ({ label, status: 'Yes', note: '' })) })); function renderSections(){ sectionsEl.innerHTML = ''; sections.forEach((s, si) => { const wrap = document.createElement('div'); wrap.className = 'section'; wrap.innerHTML = `

${s.title}

`; s.items.forEach((it, ii) => { const row = document.createElement('div'); row.className = 'item'; row.innerHTML = ` `; const radios = row.querySelectorAll(`input[type=radio][name=s${si}i${ii}]`); radios.forEach(r => r.addEventListener('change', e => it.status = e.target.value)); const note = row.querySelector('input[type=text]'); note.addEventListener('input', e => it.note = e.target.value); wrap.appendChild(row); }); sectionsEl.appendChild(wrap); }); } renderSections(); const photoInput = document.getElementById('photoInput'); const addPhotoBtn = document.getElementById('addPhotoBtn'); const photoList = document.getElementById('photoList'); addPhotoBtn.addEventListener('click', ()=> photoInput.click()); photoInput.addEventListener('change', ()=>{ photoList.innerHTML = ''; [...photoInput.files].forEach(f => { const div = document.createElement('div'); div.textContent = f.name; photoList.appendChild(div); }); }); document.getElementById('visitForm').addEventListener('submit', (e)=>{ document.getElementById('sections_json').value = JSON.stringify(sections); });