Legal Entity Governance Tracker

Legal Entity Governance Tracker

Monitor key compliance dates and governance details for all your legal entities.

Filing Due: ${entity.nextFilingDue || 'N/A'}

Reg. Agent: ${entity.registeredAgent || 'N/A'}

`; dashboardView.appendChild(card); }); }; // --- FORM & DATA LOGIC --- const clearForm = () => { form.reset(); entityIdInput.value = ''; saveEntityBtn.textContent = 'Save Entity'; }; const saveEntity = () => { const entityData = { name: entityNameInput.value.trim(), type: entityTypeSelect.value, jurisdiction: entityJurisdictionInput.value.trim(), formationDate: formationDateInput.value, nextFilingDue: nextFilingDueInput.value, registeredAgent: registeredAgentInput.value.trim() }; if (!entityData.name) { alert('Entity Name is required.'); // Simple validation return; } const id = entityIdInput.value; if (id) { // Update existing const index = entities.findIndex(e => e.id == id); entities[index] = { ...entities[index], ...entityData }; } else { // Add new entityData.id = nextEntityId++; entities.push(entityData); } clearForm(); renderDashboard(); showTab(0); // Go back to dashboard after saving }; const editEntity = (id) => { const entity = entities.find(e => e.id == id); if (entity) { entityIdInput.value = entity.id; entityNameInput.value = entity.name; entityTypeSelect.value = entity.type; entityJurisdictionInput.value = entity.jurisdiction; formationDateInput.value = entity.formationDate; nextFilingDueInput.value = entity.nextFilingDue; registeredAgentInput.value = entity.registeredAgent; saveEntityBtn.textContent = 'Update Entity'; showTab(1); } }; const deleteEntity = (id) => { if (confirm('Are you sure you want to delete this entity?')) { const card = document.querySelector(`.edit-btn[data-id='${id}']`).closest('.entity-card'); card.classList.add('deleting'); setTimeout(() => { entities = entities.filter(e => e.id != id); renderDashboard(); }, 300); } }; // --- UI & NAVIGATION LOGIC --- const showTab = (tabIndex) => { tabContents.forEach(c => c.classList.add('hidden')); tabButtons.forEach(b => b.classList.replace('active', 'inactive')); document.getElementById(`tab-content-${tabIndex}`).classList.remove('hidden'); document.querySelector(`.tab-button[data-tab='${tabIndex}']`).classList.replace('inactive', 'active'); updateNavButtons(); currentTab = tabIndex; }; const updateNavButtons = () => { prevBtn.style.visibility = currentTab === 0 ? 'hidden' : 'visible'; nextBtn.style.visibility = currentTab === totalTabs - 1 ? 'hidden' : 'visible'; }; const navigateTabs = (direction) => { const nextTabIndex = currentTab + direction; if (nextTabIndex >= 0 && nextTabIndex < totalTabs) { showTab(nextTabIndex); } }; // --- PDF GENERATION --- const downloadPDF = () => { const { jsPDF } = window.jspdf; const pdfContentArea = document.getElementById('pdf-content-area'); let pdfHtml = `

Legal Entity Governance Report

${entities.map(e => ` `).join('')}
Entity Name Type Jurisdiction Formation Date Next Filing Due Registered Agent
${e.name || ''} ${e.type || ''} ${e.jurisdiction || ''} ${e.formationDate || ''} ${e.nextFilingDue || ''} ${e.registeredAgent || ''}
`; pdfContentArea.innerHTML = pdfHtml; pdfContentArea.classList.remove('hidden'); html2canvas(pdfContentArea, { scale: 2 }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'landscape', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgProps = pdf.getImageProperties(imgData); const imgHeight = (imgProps.height * pdfWidth) / imgProps.width; let heightLeft = imgHeight; let position = 0; pdf.addImage(imgData, 'PNG', 0, position, pdfWidth, imgHeight); heightLeft -= pdfHeight; while (heightLeft > 0) { position = heightLeft - imgHeight; pdf.addPage(); pdf.addImage(imgData, 'PNG', 0, position, pdfWidth, imgHeight); heightLeft -= pdfHeight; } pdf.save('Legal_Entity_Governance_Report.pdf'); pdfContentArea.innerHTML = ''; pdfContentArea.classList.add('hidden'); }); }; // --- EVENT LISTENERS --- prevBtn.addEventListener('click', () => navigateTabs(-1)); nextBtn.addEventListener('click', () => navigateTabs(1)); tabButtons.forEach(button => { button.addEventListener('click', () => showTab(parseInt(button.dataset.tab))); }); saveEntityBtn.addEventListener('click', saveEntity); clearFormBtn.addEventListener('click', clearForm); downloadPdfBtn.addEventListener('click', downloadPDF); dashboardView.addEventListener('click', (e) => { if (e.target.classList.contains('edit-btn')) { editEntity(e.target.dataset.id); } if (e.target.classList.contains('delete-btn')) { deleteEntity(e.target.dataset.id); } }); // --- INITIALIZATION --- renderDashboard(); showTab(0); });
Scroll to Top