Landlord-Tenant Dispute Resolution Tool

Landlord-Tenant Dispute Resolution Tool

Describe the Dispute

General Information & Rights (USA Focus)

Generated Communication Template

Dispute Summary

Please select an issue category to see relevant information.

`; }, renderCommunicationTemplate() { const role = this.disputeDetails.role.toLowerCase(); const category = this.disputeDetails.category; const templateKey = `${category}_${role}`; let template = this.communicationTemplates[templateKey] || `[Date]\n\n[Recipient Name]\n[Recipient Address]\n\nRe: Issue Regarding Your Tenancy/Property at [Address]\n\nDear [Recipient Name],\n\nThis letter is to formally address the following issue:\n\n[DISPUTE_DESCRIPTION]\n\nTo resolve this matter, I propose the following:\n\n[DESIRED_RESOLUTION]\n\nPlease respond within [Number] days to discuss a solution.\n\nSincerely,\n[Your Name]`; template = template.replace(/\[DISPUTE_DESCRIPTION\]/g, this.disputeDetails.description || '[Describe the issue here]'); template = template.replace(/\[DESIRED_RESOLUTION\]/g, this.disputeDetails.resolution || '[State your desired outcome]'); this.dom.communicationTemplate.value = template; }, renderSummary() { const details = this.disputeDetails; this.dom.summaryContent.innerHTML = `

Dispute Summary

Your Role:

${details.role}

Issue Category:

${details.category.charAt(0).toUpperCase() + details.category.slice(1)}

Issue Description:

${details.description.replace(/\n/g, '
')}

Desired Resolution:

${details.resolution}

Generated Communication

${this.dom.communicationTemplate.value}
`; }, // --- NAVIGATION --- changeTab(tabIndex) { if (tabIndex > this.currentTab) { this.updateDisputeDetails(); if (this.currentTab === 0 && (!this.disputeDetails.description || !this.disputeDetails.resolution)) { alert("Please fill out the description and desired resolution to continue."); return; } } if (tabIndex === 1) this.renderInfoContent(); if (tabIndex === 2) this.renderCommunicationTemplate(); if (tabIndex === 3) this.renderSummary(); 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'; }, // --- PDF GENERATION --- generatePdf() { const { jsPDF } = window.jspdf; const content = document.getElementById('pdf-content'); if (!content) return; html2canvas(content, { scale: 2 }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgProps= pdf.getImageProperties(imgData); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('Dispute-Resolution-Summary.pdf'); }); }, }; window.app = { changeTab: app.changeTab.bind(app), navigateTabs: app.navigateTabs.bind(app), }; app.init(); });
Scroll to Top