MOVET Check-list

Check-list Pré-Embarque — armazenamento local e exportação PDF

Identificação

Sinais Vitais

Estado Neurológico

Suporte

Origem / Destino

Intercorrências / Procedimentos

Checklists salvos 0

`; const w = window.open('', '_blank'); if (!w) return alert('Bloqueador de pop-ups impede a impressão. Permita pop-ups e tente novamente.'); w.document.write(html); w.document.close(); } exportPdfBtn.addEventListener('click', () => { if (!saved.length) return alert('Sem registros para exportar.'); openPrintable(saved[0]); }); exportAllPdfBtn.addEventListener('click', () => { if (!saved.length) return alert('Sem registros para exportar.'); // open printable view with all entries const html = ` Checklists MOVET

Checklists MOVET

${saved.map(s=>`

${s.paciente||'—'} — ${s.tutor||''}

Data: ${new Date(s.createdAt).toLocaleString()}
${Object.entries(s).filter(([k])=>k!=='createdAt').map(([k,v])=>``).join('')}
${k.replace(/_/g,' ')}${String(v)}
`).join('')} `; const w = window.open('', '_blank'); if (!w) return alert('Bloqueador de pop-ups impede a impressão. Permita pop-ups e tente novamente.'); w.document.write(html); w.document.close(); }); exportJsonBtn.addEventListener('click', () => { if (!saved.length) return alert('Sem registros para exportar.'); const blob = new Blob([JSON.stringify(saved, null, 2)], {type:'application/json'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href=url; a.download = 'movet_checklists_'+new Date().toISOString()+'.json'; a.click(); URL.revokeObjectURL(url); }); exportCsvBtn.addEventListener('click', () => { if (!saved.length) return alert('Sem registros para exportar.'); const keys = Object.keys(saved[0]); const lines = [keys.join(',')]; saved.forEach(r=>{ const vals = keys.map(k=>'"'+String(r[k]||'').replace(/"/g,'""')+'"'); lines.push(vals.join(',')); }); const blob = new Blob([lines.join('\n')], {type:'text/csv;charset=utf-8;'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href=url; a.download = 'movet_checklists_'+new Date().toISOString()+'.csv'; a.click(); URL.revokeObjectURL(url); }); clearAllBtn.addEventListener('click', () => { if (!confirm('Apagar todos os checklists locais?')) return; saved = []; localStorage.removeItem(STORAGE_KEY); renderList(); alert('Todos os registros foram apagados.'); }); function renderList() { countSaved.textContent = saved.length; listEl.innerHTML = ''; saved.forEach((s,idx)=>{ const d=document.createElement('div'); d.className='card'; d.style.marginBottom='8px'; d.innerHTML = '
'+ (s.paciente||'—') +'
'+(s.tutor||'')+'
'; listEl.appendChild(d); }); } loadSaved(); // register service worker (for caching) if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js').then(()=>console.log('sw registered')).catch(()=>console.log('sw failed')); }