Electronic Court Filing System

Electronic Court Filing System

Submit legal documents securely and efficiently.

Case Details

$

Parties

${doc.type} - (Simulated file: ${doc.fileName})

`; }); }; const populateReview = () => { // Collect data first filingData.caseInfo = { number: getEl('caseNumber').value, type: getEl('caseType').value, jurisdiction: getEl('jurisdiction').value, fee: getEl('filingFee').value, plaintiff: getEl('plaintiffName').value, defendant: getEl('defendantName').value }; const reviewContent = getEl('review-content'); reviewContent.innerHTML = `

Case Information

Case Number:
${filingData.caseInfo.number}
Case Type:
${filingData.caseInfo.type}
Plaintiff:
${filingData.caseInfo.plaintiff}
Defendant:
${filingData.caseInfo.defendant}
Jurisdiction:
${filingData.caseInfo.jurisdiction}
Filing Fee:
$${filingData.caseInfo.fee}

Documents (${filingData.documents.length})

    ${filingData.documents.map(d => `
  • ${d.title} (${d.type})
  • `).join('')}
`; }; // --- CORE LOGIC & EVENT HANDLERS --- const showTab = (tabName) => { if (tabName === 'review') populateReview(); currentTab = tabName; Object.values(tabs).forEach(tab => tab.style.display = 'none'); Object.values(tabButtons).forEach(btn => btn.classList.replace('active', 'inactive')); if (tabs[tabName]) tabs[tabName].style.display = 'block'; if (tabButtons[tabName]) tabButtons[tabName].classList.replace('inactive', 'active'); updateNavButtons(); }; const updateNavButtons = () => { const currentIndex = tabOrder.indexOf(currentTab); navButtons.prev.style.visibility = currentIndex === 0 ? 'hidden' : 'visible'; navButtons.next.style.visibility = (currentIndex === tabOrder.length - 1 || currentTab === 'confirmation') ? 'hidden' : 'visible'; if(currentTab === 'review') { navButtons.next.textContent = 'Submit Filing'; } else { navButtons.next.textContent = 'Next'; } if (currentTab === 'confirmation') { navButtons.prev.style.visibility = 'hidden'; } }; const handleNavClick = (direction) => { const currentIndex = tabOrder.indexOf(currentTab); if (currentTab === 'review' && direction === 1) { submitFiling(); return; } const newIndex = currentIndex + direction; if (newIndex >= 0 && newIndex < tabOrder.length) showTab(tabOrder[newIndex]); }; const addDocument = () => { const title = getEl('docTitle').value.trim(); const type = getEl('docType').value; const fileInput = getEl('file-upload-input'); const fileName = fileInput.files.length > 0 ? fileInput.files[0].name : 'sample.pdf'; if (!title) { alert('Please provide a document title.'); return; } filingData.documents.push({ title, type, fileName }); renderDocList(); getEl('docTitle').value = ''; fileInput.value = ''; getEl('file-drop-zone').querySelector('p').textContent = 'No file chosen'; }; window.removeDocument = (index) => { filingData.documents.splice(index, 1); renderDocList(); }; const submitFiling = () => { const confNumber = `ECF-${Date.now()}`; getEl('confirmation-number').textContent = confNumber; filingData.confirmationNumber = confNumber; filingData.filingDate = new Date().toLocaleString('en-US'); showTab('confirmation'); }; // --- PDF DOWNLOAD --- const downloadPDF = () => { const { jsPDF } = window.jspdf; const doc = new jsPDF(); const { caseInfo, documents, confirmationNumber, filingDate } = filingData; doc.setFontSize(18); doc.text("Electronic Filing Confirmation", 105, 20, { align: 'center' }); doc.setFontSize(11); doc.setTextColor(100); doc.text(`Filing Date: ${filingDate}`, 14, 30); doc.text(`Confirmation Number: ${confirmationNumber}`, 14, 36); const caseData = [ ["Case Number:", caseInfo.number], ["Jurisdiction:", caseInfo.jurisdiction], ["Case Type:", caseInfo.type], ["Plaintiff:", caseInfo.plaintiff], ["Defendant:", caseInfo.defendant], ["Filing Fee Paid:", `$${caseInfo.fee}`], ]; doc.autoTable({ startY: 45, head: [['Case Details', '']], body: caseData, theme: 'plain', headStyles: { fontStyle: 'bold', fillColor: [230, 230, 230] }, }); const docTableData = documents.map(d => [d.title, d.type, d.fileName]); doc.autoTable({ startY: doc.previousAutoTable.finalY + 10, head: [['Filed Document Title', 'Type', 'File Name']], body: docTableData, theme: 'striped', headStyles: { fillColor: [41, 128, 185] }, }); doc.save(`Filing_Confirmation_${caseInfo.number}.pdf`); }; // --- EVENT LISTENERS --- navButtons.prev.addEventListener('click', () => handleNavClick(-1)); navButtons.next.addEventListener('click', () => handleNavClick(1)); getEl('add-doc-btn').addEventListener('click', addDocument); getEl('download-pdf-btn').addEventListener('click', downloadPDF); Object.keys(tabButtons).forEach(tabName => { if(tabButtons[tabName]) tabButtons[tabName].addEventListener('click', () => showTab(tabName)); }); const dropZone = getEl('file-drop-zone'); const fileInput = getEl('file-upload-input'); dropZone.addEventListener('click', () => fileInput.click()); fileInput.addEventListener('change', (e) => { if (e.target.files.length > 0) { dropZone.querySelector('p').textContent = e.target.files[0].name; } }); // --- INITIALIZATION --- populateJurisdiction(); updateNavButtons(); renderDocList(); });
Scroll to Top