Senior Living Facility Cost Comparison Tool

Senior Living Facility Cost Comparison Tool

Compare monthly and annual costs of different senior living options.

Add a Facility to Compare

$
$
$
$
$
$

Comparison Dashboard

No facilities added

Add a facility in the Data Configuration tab to start comparing.

${item.name}

${item.careType}

${formatCurrency(item.baseFee)} ${formatCurrency(item.additionalFees)} ${formatCurrency(item.totalMonthly)} ${formatCurrency(item.totalAnnual)} `; comparisonTableBody.appendChild(row); }); } function addFacility() { const name = getVal('facilityName').trim(); const baseFee = getNum('baseFee'); if (!name || baseFee <= 0) { showCustomMessage('Invalid Input', 'Please enter a facility name and a valid base fee.', 'error'); return; } const additionalFees = getNum('levelOfCareFee') + getNum('medicationFee') + getNum('incontinenceFee') + getNum('otherFees'); const totalMonthly = baseFee + additionalFees; const totalAnnual = totalMonthly * 12 + getNum('oneTimeFee'); comparisonList.push({ id: Date.now(), name, careType: getVal('careType'), baseFee, additionalFees, totalMonthly, totalAnnual, oneTimeFee: getNum('oneTimeFee') }); // Clear input fields ['facilityName', 'baseFee', 'levelOfCareFee', 'medicationFee', 'incontinenceFee', 'otherFees', 'oneTimeFee'].forEach(id => document.getElementById(id).value = ''); document.getElementById('facilityName').focus(); showCustomMessage('Success', `"${name}" added to comparison.`, 'success'); renderTable(); } function updateTabView() { Object.values(tabButtons).forEach(b => b.classList.remove('active')); Object.values(tabContents).forEach(c => c.classList.remove('active')); tabButtons[currentTab].classList.add('active'); tabContents[currentTab].classList.add('active'); prevBtn.style.visibility = currentTab === 1 ? 'hidden' : 'visible'; nextBtn.textContent = currentTab === 1 ? 'Compare' : 'Next'; nextBtn.style.visibility = currentTab === 2 ? 'hidden' : 'visible'; } function goToTab(tabNumber) { if (tabNumber > currentTab && currentTab === 1) { renderTable(); } currentTab = tabNumber; updateTabView(); } function downloadPdf() { if(comparisonList.length === 0) { showCustomMessage('No Data', 'Please add facilities to generate a PDF.', 'warning'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFontSize(22); doc.setFont('helvetica', 'bold'); doc.text("Senior Living Cost Comparison", 105, 20, { align: 'center' }); const tableData = [...comparisonList] .sort((a, b) => a.totalMonthly - b.totalMonthly) .map(item => [ `${item.name}\n(${item.careType})`, formatCurrency(item.baseFee), formatCurrency(item.additionalFees), formatCurrency(item.totalMonthly), formatCurrency(item.totalAnnual) ]); doc.autoTable({ startY: 30, head: [['Facility', 'Base Fee', 'Add\'l Fees', 'Total Monthly', 'Total Annual']], body: tableData, theme: 'grid', headStyles: { fillColor: [37, 99, 235] }, didDrawCell: (data) => { if (data.section === 'body' && data.row.index === 0) { doc.setFont('helvetica', 'bold'); } } }); doc.save('Senior_Living_Comparison.pdf'); } function showCustomMessage(title, body, type) { const box = document.getElementById('message-box'), titleEl = document.getElementById('message-title'), bodyEl = document.getElementById('message-body'), iconContainer = document.getElementById('message-icon-container'); if(!box || !titleEl || !bodyEl || !iconContainer) return; titleEl.textContent = title; bodyEl.textContent = body; let iconSvg = ''; switch (type) { case 'success': iconSvg = ``; break; case 'error': iconSvg = ``; break; case 'warning': iconSvg = ``; break; } iconContainer.innerHTML = iconSvg; box.classList.add('show'); setTimeout(() => { box.classList.remove('show'); }, 4000); } prevBtn.addEventListener('click', () => goToTab(1)); nextBtn.addEventListener('click', () => goToTab(2)); addFacilityBtn.addEventListener('click', addFacility); pdfDownloadBtn.addEventListener('click', downloadPdf); clearBtn.addEventListener('click', () => { comparisonList = []; renderTable(); showCustomMessage('Cleared', 'All facilities have been removed.', 'success'); }); comparisonTableBody.addEventListener('click', (e) => { const removeBtn = e.target.closest('.remove-btn'); if (removeBtn) { const idToRemove = parseInt(removeBtn.dataset.id, 10); comparisonList = comparisonList.filter(item => item.id !== idToRemove); renderTable(); } }); updateTabView(); renderTable(); });
Scroll to Top