Business Litigation Outcome Probability Calculator

Business Litigation Outcome Probability Calculator

Estimate potential litigation outcomes by assessing key case factors.

Initial Case Information

$

${probSettle.toFixed(1)}%

ESTIMATED VALUE*

$${expectedValue.toLocaleString('en-US', {maximumFractionDigits:0})}

*Estimated Value is a speculative calculation for informational purposes. It's calculated as (Win % * Amount) - (Loss % * Amount * 0.5), and does not account for settlement value or legal fees.
`; dashboardContainer.innerHTML = dashboardHtml; downloadBtnContainer.classList.remove('hidden'); const ctx = document.getElementById('outcomeChart').getContext('2d'); if (myChart) myChart.destroy(); myChart = new Chart(ctx, { type: 'doughnut', data: { labels: ['Win', 'Loss', 'Settle'], datasets: [{ data: [probWin, probLoss, probSettle], backgroundColor: ['#10b981', '#ef4444', '#f59e0b'] }] }, options: { responsive: true, plugins: { legend: { position: 'bottom' } } } }); }; // --- 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; if (currentTab === '2') initializeFactors(); if (currentTab === '3') calculateAndRenderDashboard(); 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); }); updateNavButtons(); }; const navigateTabs = (direction) => { const currentIndex = tabs.indexOf(currentTab); let nextIndex = currentIndex + direction; if (nextIndex >= 0 && nextIndex < tabs.length) switchTab(tabs[nextIndex]); }; // --- PDF GENERATION --- downloadPdfBtn.addEventListener('click', () => { const { jsPDF } = window.jspdf; const doc = new jsPDF(); const caseName = document.getElementById('caseName').value || 'N/A'; const litigationType = document.getElementById('litigationType').value; const amountInDispute = parseFloat(document.getElementById('amountInDispute').value) || 0; doc.setFontSize(18); doc.text("Business Litigation Outcome Report", 14, 22); doc.setFontSize(11); doc.setTextColor(100); doc.autoTable({ startY: 30, body: [ ['Case Name', caseName], ['Litigation Type', litigationType], ['Amount in Dispute', `$${amountInDispute.toLocaleString()}`], ], theme: 'striped', }); doc.setFontSize(14); doc.text("Probability Analysis", 14, doc.previousAutoTable.finalY + 15); const chartCanvas = document.getElementById('outcomeChart'); const chartImage = chartCanvas.toDataURL('image/png', 1.0); doc.addImage(chartImage, 'PNG', 110, doc.previousAutoTable.finalY + 20, 80, 80); const finalProbs = myChart.data.datasets[0].data; doc.autoTable({ startY: doc.previousAutoTable.finalY + 20, head: [['Outcome', 'Probability']], body: [ ['Win', `${finalProbs[0].toFixed(1)}%`], ['Loss', `${finalProbs[1].toFixed(1)}%`], ['Settlement', `${finalProbs[2].toFixed(1)}%`], ], theme: 'grid', tableWidth: 90, headStyles: { fillColor: [45, 102, 193] }, }); doc.setFontSize(14); doc.text("Factor Assessment", 14, doc.previousAutoTable.finalY + 20); const factorData = FACTORS.map(f => { const sliderValue = document.getElementById(`${f.id}Value`).textContent; return [f.label, sliderValue]; }); doc.autoTable({ head: [['Factor', 'Assessed Level']], body: factorData, startY: doc.previousAutoTable.finalY + 30, theme: 'striped', headStyles: { fillColor: [45, 102, 193] }, }); const finalY = doc.previousAutoTable.finalY; doc.setFontSize(8); doc.setTextColor(150); const disclaimer = "This report is generated based on user-provided assessments and a simplified model. It is for informational purposes only and does not constitute legal or financial advice. Actual outcomes can vary significantly."; const disclaimerLines = doc.splitTextToSize(disclaimer, 180); doc.text(disclaimerLines, 14, finalY + 15); doc.save(`Litigation_Report_${caseName.replace(/\s/g, '_')}.pdf`); }); // --- INITIALIZATION --- updateNavButtons(); lucide.createIcons(); prevBtn.addEventListener('click', () => navigateTabs(-1)); nextBtn.addEventListener('click', () => navigateTabs(1)); });
Scroll to Top