⚖️ Attorney Fee Estimator Tool

Please enter valid non-negative numbers for hourly rate and estimated hours.

`; return; } const estimatedFee = hourlyRate * estimatedHours; let html = `

Client Name: ${clientName}
Contact Email: ${contactEmail}
Case Type: ${caseType}

Description Amount (USD)
Hourly Rate $${hourlyRate.toFixed(2)}
Estimated Hours ${estimatedHours.toFixed(2)}
Estimated Total Fee $${estimatedFee.toFixed(2)}
`; estimateOutput.innerHTML = html; } function loadJsPDF(callback) { if (window.jspdf) return callback(); const script = document.createElement("script"); script.src = "https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"; script.onload = callback; document.head.appendChild(script); } function generatePDF() { const clientName = document.getElementById("clientName").value.trim() || "N/A"; const contactEmail = document.getElementById("contactEmail").value.trim() || "N/A"; const caseTypeSelect = document.getElementById("caseType"); const caseType = caseTypeSelect.options[caseTypeSelect.selectedIndex]?.text || "N/A"; const hourlyRate = parseFloat(document.getElementById("hourlyRate").value); const estimatedHours = parseFloat(document.getElementById("estimatedHours").value); const estimatedFee = (!isNaN(hourlyRate) && !isNaN(estimatedHours)) ? hourlyRate * estimatedHours : 0; const now = new Date().toLocaleDateString(); loadJsPDF(() => { const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFont("helvetica", "bold"); doc.setFontSize(18); doc.setTextColor("#004080"); doc.text("Attorney Fee Estimate Report", 14, 20); doc.setFontSize(12); doc.setTextColor("#000"); doc.text(`Report Date: ${now}`, 14, 30); doc.text(`Client Name: ${clientName}`, 14, 38); doc.text(`Contact Email: ${contactEmail}`, 14, 46); doc.text(`Case Type: ${caseType}`, 14, 54); doc.text("Fee Details:", 14, 64); doc.autoTable({ startY: 70, head: [['Description', 'Amount (USD)']], body: [ ['Hourly Rate', hourlyRate ? `$${hourlyRate.toFixed(2)}` : 'N/A'], ['Estimated Hours', estimatedHours ? estimatedHours.toFixed(2) : 'N/A'], ['Estimated Total Fee', `$${estimatedFee.toFixed(2)}`] ], styles: { fontSize: 12 }, headStyles: { fillColor: '#004080', textColor: '#fff', fontStyle: 'bold' }, theme: 'grid', columnStyles: { 1: { halign: 'right' } } }); doc.save("Attorney_Fee_Estimate_Report.pdf"); }); } // Load jsPDF autotable plugin dynamically function loadAutoTableAndGeneratePDF() { if (window.jspdf && window.jspdf.autoTable) { generatePDF(); } else { const script = document.createElement('script'); script.src = "https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.28/jspdf.plugin.autotable.min.js"; script.onload = generatePDF; document.head.appendChild(script); } } nextBtn.addEventListener("click", () => { if (currentTab === tabs.length - 1) { currentTab = 0; } else { currentTab++; } setActiveTab(currentTab); }); prevBtn.addEventListener("click", () => { if (currentTab > 0) { currentTab--; setActiveTab(currentTab); } }); downloadPDFBtn.addEventListener("click", loadAutoTableAndGeneratePDF); setActiveTab(currentTab); });
Scroll to Top