E-Contract Signing and Compliance Tracker

E-Contract Signing and Compliance Tracker

Pending Signature

0

Fully Executed

0

Expiring Soon (90 Days)

0

Total Contracts

0

Action Required

Add New Contract

All Contracts

Select a contract from the 'Contract Management' tab and click 'Send for Signing' to activate this portal.

Audit Trail & Compliance Log

This document outlines the terms of service, intellectual property rights, and confidentiality obligations. This agreement is set to expire on ${new Date(contract.expires).toLocaleDateString()}. By signing, you agree to all terms and conditions contained within the full agreement.

`; }, renderComplianceLog() { const rows = this.logs.map(log => { const contract = this.contracts.find(c => c.id === log.contractId); return [ new Date(log.timestamp).toLocaleString(), contract ? contract.name : `Contract ID ${log.contractId}`, log.action ]; }); this.dom.complianceLogTable.innerHTML = this.createTable(['Timestamp', 'Contract', 'Action'], rows.reverse()); }, // --- ACTIONS --- handleContractFormSubmit(e) { e.preventDefault(); const newContract = { id: Date.now(), name: e.target.elements['contract-name'].value, counterparty: e.target.elements['counterparty-name'].value, expires: e.target.elements['expiration-date'].value, status: 'Draft', created: new Date().toISOString().split('T')[0], signed: null }; this.contracts.push(newContract); this.addLog(newContract.id, `Contract created for ${newContract.counterparty}.`); this.dom.contractForm.reset(); this.renderAll(); }, sendForSigning(id) { const contract = this.contracts.find(c => c.id === id); if (contract && contract.status === 'Draft') { contract.status = 'Pending Signature'; this.addLog(id, 'Contract sent for signature.'); this.renderAll(); alert('Contract has been sent for signing!'); } }, activateSigning(id) { this.renderSigningPortal(id); this.changeTab(2); }, signContract(id) { const agreeCheckbox = document.getElementById('agree-checkbox'); if (!agreeCheckbox || !agreeCheckbox.checked) { alert('You must agree to the terms before signing.'); return; } const contract = this.contracts.find(c => c.id === id); if (contract) { contract.status = 'Fully Executed'; contract.signed = new Date().toISOString().split('T')[0]; this.addLog(id, `Contract signed and fully executed by ${contract.counterparty}.`); this.renderAll(); this.dom.signingPortalContent.innerHTML = `

Contract Successfully Signed!

You can now return to the dashboard.

`; } }, addLog(contractId, action) { this.logs.push({ timestamp: new Date(), contractId, action }); }, // --- NAVIGATION --- changeTab(tabIndex) { this.dom.tabButtons[this.currentTab].classList.remove('active'); this.dom.tabContents[this.currentTab].classList.remove('active'); this.currentTab = tabIndex; this.dom.tabButtons[this.currentTab].classList.add('active'); this.dom.tabContents[this.currentTab].classList.add('active'); this.updateNavButtons(); }, navigateTabs(direction) { const newTab = direction === 'next' ? this.currentTab + 1 : this.currentTab - 1; if (newTab >= 0 && newTab < this.dom.tabButtons.length) { this.changeTab(newTab); } }, updateNavButtons() { this.dom.prevBtn.style.visibility = this.currentTab === 0 ? 'hidden' : 'visible'; this.dom.nextBtn.style.visibility = this.currentTab === this.dom.tabButtons.length - 1 ? 'hidden' : 'visible'; this.dom.pdfSection.style.display = this.currentTab === 0 ? 'block' : 'none'; }, // --- PDF GENERATION --- generatePdf() { const { jsPDF } = window.jspdf; const content = this.dom.dashboardContent; html2canvas(content, { scale: 2 }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'landscape', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgWidth = canvas.width; const imgHeight = canvas.height; const ratio = imgWidth / imgHeight; let finalImgWidth = pdfWidth - 40; let finalImgHeight = finalImgWidth / ratio; pdf.setFontSize(20); pdf.text("Contract Compliance Dashboard Report", pdfWidth / 2, 30, { align: 'center' }); pdf.addImage(imgData, 'PNG', 20, 50, finalImgWidth, finalImgHeight); pdf.save('Contract-Dashboard-Report.pdf'); }); }, // --- UTILITIES --- createTable(headers, rows) { let headHtml = headers.map(h => `${h}`).join(''); let bodyHtml = rows.map(row => `${row.map(cell => `${cell}`).join('')}`).join(''); if (rows.length === 0) { bodyHtml = `No data available.`; } return ` ${headHtml}${bodyHtml}
`; }, }; window.app = { changeTab: app.changeTab.bind(app), navigateTabs: app.navigateTabs.bind(app), sendForSigning: app.sendForSigning.bind(app), activateSigning: app.activateSigning.bind(app), signContract: app.signContract.bind(app), }; app.init(); });
Scroll to Top