Shareholder Dispute Resolution Agreement Generator

Shareholder Dispute Resolution Agreement Generator

Create a formal agreement to resolve internal shareholder conflicts.

Company Information

Date of Agreement

Shareholder A (Party 1)

Shareholder B (Party 2)

______________________________
${data.shareholderBName}

`; }; // --- UI & NAVIGATION --- const updateNavButtons = () => { prevBtn.disabled = currentTab === '1'; nextBtn.disabled = currentTab === '3'; prevBtn.classList.toggle('opacity-50', prevBtn.disabled); nextBtn.classList.toggle('opacity-50', nextBtn.disabled); }; window.switchTab = (tabId) => { currentTab = tabId; tabs.forEach(id => { document.getElementById(`tab-content-${id}`).classList.toggle('hidden', id !== currentTab); document.getElementById(`tab-btn-${id}`).classList.toggle('tab-active', id === currentTab); document.getElementById(`tab-btn-${id}`).classList.toggle('tab-inactive', id !== currentTab); }); if (tabId === '3') { document.getElementById('agreement-preview').innerHTML = generateAgreementText(); } updateNavButtons(); }; const navigateTabs = (direction) => { const currentIndex = tabs.indexOf(currentTab); let nextIndex = currentIndex + direction; if (nextIndex >= 0 && nextIndex < tabs.length) { switchTab(tabs[nextIndex]); } }; const handleResolutionMethodChange = () => { const buyoutSection = document.getElementById('buyout-section'); const thirdPartySection = document.getElementById('third-party-section'); const thirdPartyTitle = document.getElementById('third-party-title'); const method = resolutionMethod.value; buyoutSection.classList.toggle('hidden', method !== 'buyout'); thirdPartySection.classList.toggle('hidden', method !== 'mediation' && method !== 'arbitration'); if (method === 'mediation') { thirdPartyTitle.textContent = 'Mediator Details'; } else if (method === 'arbitration') { thirdPartyTitle.textContent = 'Arbitrator Details'; } }; const updateShareholderDropdowns = () => { const nameA = shareholderAName.value || 'Shareholder A'; const nameB = shareholderBName.value || 'Shareholder B'; sellingShareholder.innerHTML = ``; buyingShareholder.innerHTML = ``; }; // --- PDF GENERATION --- const downloadPdf = () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ unit: 'pt', format: 'a4' }); const agreementHtml = generateAgreementText(); const tempDiv = document.createElement('div'); tempDiv.innerHTML = agreementHtml; const title = tempDiv.querySelector('h2').innerText; const paragraphs = Array.from(tempDiv.querySelectorAll('p')); let y = 60; const margin = 50; const pageWidth = doc.internal.pageSize.getWidth(); const maxWidth = pageWidth - margin * 2; doc.setFontSize(16); doc.setFont('times', 'bold'); doc.text(title, pageWidth / 2, y, { align: 'center' }); y += 40; doc.setFontSize(12); doc.setFont('times', 'normal'); paragraphs.forEach(p => { const isBold = p.querySelector('strong'); if (isBold) { doc.setFont('times', 'bold'); } const text = p.innerText; const lines = doc.splitTextToSize(text, maxWidth); lines.forEach(line => { if (y > doc.internal.pageSize.getHeight() - margin) { doc.addPage(); y = margin; } doc.text(line, margin, y); y += 15; // line height }); if (isBold) { doc.setFont('times', 'normal'); } y += 5; // extra space after paragraph }); doc.save('Shareholder_Dispute_Agreement.pdf'); }; // --- EVENT LISTENERS & INITIAL SETUP --- prevBtn.addEventListener('click', () => navigateTabs(-1)); nextBtn.addEventListener('click', () => navigateTabs(1)); resolutionMethod.addEventListener('change', handleResolutionMethodChange); document.getElementById('download-pdf-btn').addEventListener('click', downloadPdf); [shareholderAName, shareholderBName].forEach(el => el.addEventListener('keyup', updateShareholderDropdowns)); // Initial setup const today = new Date().toISOString().split('T')[0]; agreementDate.value = today; closingDate.value = today; thirdPartyDate.value = today; updateNavButtons(); handleResolutionMethodChange(); updateShareholderDropdowns(); lucide.createIcons(); });
Scroll to Top