Business Transaction Legal Checklist

Business Transaction Legal Checklist

Transaction Progress Summary

Action Items

${section.title}

${item.text}

`; actionItemsList.appendChild(li); } }); }); if (incompleteCount === 0) { actionItemsList.innerHTML = `
  • All checklist items are complete.
  • `; } } function renderDetailedChecklist() { detailedChecklistContainer.innerHTML = ''; Object.values(state.checklist).forEach(section => { const sectionEl = document.createElement('div'); sectionEl.className = 'mb-8'; let itemsHTML = ''; section.items.forEach(item => { itemsHTML += ` ${item.text} `; }); sectionEl.innerHTML = `

    ${section.title}

    ${itemsHTML}
    Item Status Notes
    `; detailedChecklistContainer.appendChild(sectionEl); }); } // --- EVENT HANDLERS & LOGIC --- function switchTab(tabName) { state.currentTab = tabName; const tabOrder = ['dashboard', 'checklist', 'config']; const currentIndex = tabOrder.indexOf(tabName); Object.values(tabs).forEach(tab => tab.classList.remove('active')); Object.values(contents).forEach(content => content.classList.add('hidden')); tabs[tabName].classList.add('active'); contents[tabName].classList.remove('hidden'); navButtons.prev.disabled = currentIndex === 0; navButtons.next.disabled = currentIndex === tabOrder.length - 1; } detailedChecklistContainer.addEventListener('change', (e) => { if (e.target.classList.contains('status-selector')) { const row = e.target.closest('tr'); const itemId = parseInt(row.dataset.itemId); const section = Object.values(state.checklist).find(s => s.items.some(i => i.id === itemId)); const item = section.items.find(i => i.id === itemId); item.status = e.target.value; renderDashboard(); } }); detailedChecklistContainer.addEventListener('input', (e) => { if (e.target.classList.contains('notes-input')) { const row = e.target.closest('tr'); const itemId = parseInt(row.dataset.itemId); const section = Object.values(state.checklist).find(s => s.items.some(i => i.id === itemId)); const item = section.items.find(i => i.id === itemId); item.notes = e.target.value; } }); document.getElementById('transaction-name').addEventListener('input', (e) => state.transactionDetails.name = e.target.value); document.getElementById('seller-name').addEventListener('input', (e) => state.transactionDetails.seller = e.target.value); document.getElementById('buyer-name').addEventListener('input', (e) => state.transactionDetails.buyer = e.target.value); downloadPdfBtn.addEventListener('click', () => { const { jsPDF } = window.jspdf; const doc = new jsPDF(); const { name, seller, buyer } = state.transactionDetails; doc.setFontSize(20); doc.text(`Legal Checklist: ${name}`, 14, 22); doc.setFontSize(11); doc.setTextColor(100); doc.text(`Seller: ${seller} | Buyer: ${buyer}`, 14, 30); doc.text(`Report Generated: ${new Date().toLocaleDateString()}`, 14, 36); let lastY = 40; Object.values(state.checklist).forEach(section => { doc.setFontSize(14); doc.setTextColor(40); doc.text(section.title, 14, lastY + 12); const head = [['Item', 'Status', 'Notes']]; const body = section.items.map(item => [item.text, item.status, item.notes]); doc.autoTable({ startY: lastY + 15, head: head, body: body, theme: 'striped', headStyles: { fillColor: [13, 148, 136] }, // teal-600 didDrawPage: (data) => { lastY = data.cursor.y; } }); lastY = doc.lastAutoTable.finalY; }); doc.save(`${name.replace(/\s/g, '_')}_Checklist.pdf`); }); // --- ATTACH EVENT LISTENERS --- tabs.dashboard.addEventListener('click', () => switchTab('dashboard')); tabs.checklist.addEventListener('click', () => switchTab('checklist')); tabs.config.addEventListener('click', () => switchTab('config')); navButtons.next.addEventListener('click', () => { const tabOrder = ['dashboard', 'checklist', 'config']; const currentIndex = tabOrder.indexOf(state.currentTab); if (currentIndex < tabOrder.length - 1) switchTab(tabOrder[currentIndex + 1]); }); navButtons.prev.addEventListener('click', () => { const tabOrder = ['dashboard', 'checklist', 'config']; const currentIndex = tabOrder.indexOf(state.currentTab); if (currentIndex > 0) switchTab(tabOrder[currentIndex - 1]); }); // --- INITIALIZATION --- function init() { renderAll(); switchTab('dashboard'); } init(); });
    Scroll to Top