Best Beach Destination Score Calculator Best Beach Destination Score Calculator Find your perfect beach getaway by rating what's important to you. 1. Data Configuration 2. Destination Dashboard Rate Your Preferences Slide to indicate the importance of each factor for your ideal vacation. Your Top Beach Destinations Download PDF Previous Next Match Score ${dest.score}% ${dest.description} `; }); } 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 ? 'Find My Beach' : 'Next'; nextBtn.style.visibility = currentTab === 2 ? 'hidden' : 'visible'; } function goToTab(tabNumber) { if (tabNumber > currentTab && currentTab === 1) { displayResults(); } currentTab = tabNumber; updateTabView(); } function downloadPdf() { if (!calculationResults) { showCustomMessage('No Data', 'Please calculate scores first.', 'warning'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFontSize(22); doc.setFont('helvetica', 'bold'); doc.text("Your Beach Destination Report", 105, 20, { align: 'center' }); const tableData = calculationResults.map(dest => [dest.name, `${dest.score}%`, dest.description]); doc.autoTable({ startY: 30, head: [['Destination', 'Match Score', 'Description']], body: tableData, theme: 'grid', headStyles: { fillColor: [37, 99, 235] }, columnStyles: { 2: { cellWidth: 80 } } }); doc.save('Beach_Destination_Scores.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)); pdfDownloadBtn.addEventListener('click', downloadPdf); populatePreferences(); updateTabView(); });