Real Estate Market Cycle Indicator
Select the option that best describes the current conditions for each indicator below to estimate the current real estate market cycle phase.
Market Phase:
Please determine the market phase first.
'; modalContainer.appendChild(modalContent); document.body.appendChild(modalContainer); modalContent.querySelector('button').onclick = () => { document.body.removeChild(modalContainer); }; return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); const selections = window.currentMarketCycleSelections; const phase = window.currentMarketCyclePhase; doc.setFontSize(18); doc.setTextColor(59, 130, 246); // Blue doc.text("Real Estate Market Cycle Indicator Summary", 105, 20, null, null, "center"); doc.setFontSize(10); doc.setTextColor(0,0,0); doc.text(`Date: ${new Date().toLocaleDateString()}`, 105, 28, null, null, "center"); doc.setFontSize(14); doc.setFont(undefined, 'bold'); doc.setTextColor(31, 41, 55); // gray-800 doc.text("User Selections:", 15, 40); const tableColumnStyles = { 0: { cellWidth: 70 }, // Indicator 1: { cellWidth: 'auto'}, // Selection }; const tableBody = selections.map(s => [s.indicator.replace(/^\d+\.\s*/, ''), s.selectionText]); doc.autoTable({ startY: 45, head: [['Indicator', 'Selected Condition']], body: tableBody, theme: 'striped', headStyles: { fillColor: [59, 130, 246] }, // Blue header columnStyles: tableColumnStyles, didDrawPage: function (data) { // Footer if needed } }); let finalY = doc.lastAutoTable.finalY || 45; // Get Y position after table finalY += 15; if (finalY > 260) { doc.addPage(); finalY = 20; } // New page if needed doc.setFontSize(16); doc.setFont(undefined, 'bold'); // Set color for phase name based on its class if (phase.className.includes('expansion')) doc.setTextColor(16, 185, 129); // green else if (phase.className.includes('peak')) doc.setTextColor(245, 158, 11); // amber else if (phase.className.includes('contraction')) doc.setTextColor(239, 68, 68); // red else if (phase.className.includes('trough')) doc.setTextColor(107, 114, 128); // gray else doc.setTextColor(31, 41, 55); // default gray doc.text(`Determined Market Phase: ${phase.name}`, 15, finalY); finalY += 8; doc.setFontSize(10); doc.setFont(undefined, 'normal'); doc.setTextColor(75, 85, 99); // gray-600 const descriptionLines = doc.splitTextToSize(phase.description, 180); // 180mm width doc.text(descriptionLines, 15, finalY); doc.save("RealEstate_MarketCycle_Summary.pdf"); }); } });