📋 Editor Contratto

Compila i campi variabili del contratto di prestazione occasionale

COMMITTENTE

Dati Società

Amministratore Unico

PRESTATORE

PRESTAZIONE

Descrizione attività

Luogo e durata

COMPENSO

CLAUSOLE

📄 Anteprima

`; const blob = new Blob([html], {type: 'text/html'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `Contratto_Prestazione_${new Date().toISOString().split('T')[0]}.html`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); } function salvaLocale() { const fields = {}; document.querySelectorAll('input, textarea').forEach(el => { if(el.id) fields[el.id] = el.value; }); localStorage.setItem('contratto_editor', JSON.stringify(fields)); alert('Dati salvati localmente'); } function caricaLocale() { const fields = JSON.parse(localStorage.getItem('contratto_editor') || '{}'); Object.entries(fields).forEach(([id, value]) => { const el = document.getElementById(id); if(el) el.value = value; }); alert('Dati caricati'); generaContratto(); } function generaPDF() { const previewText = document.getElementById('preview').innerText; const w = window.open('', 'print_pdf', 'width=900,height=700'); const html = ` Contratto Prestazione Occasionale

CONTRATTO DI PRESTAZIONE OCCASIONALE

${previewText.replace(//g, '>')}
`; w.document.write(html); w.document.close(); } function generaDOCX() { const previewText = document.getElementById('preview').innerText; const data = btoa(unescape(encodeURIComponent(previewText))); const xml = ` ${previewText.split('\n').map(line => `${line.replace(/&/g,'&').replace(//g,'>')}`).join('')} `; const blob = new Blob([xml], {type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `Contratto_Prestazione_${new Date().toISOString().split('T')[0]}.docx`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); } // Generazione iniziale window.addEventListener('load', ()=>generaContratto());