Best Family Vacation Planner Best Family Vacation Planner Create a customized itinerary based on your family's interests and budget. 1. Data Configuration 2. Your Vacation Plan Trip Details Destination Type Beach Getaway City Adventure National Park Exploration Theme Park Fun Trip Duration (Days) Travel Style / Budget Budget-Friendly Mid-Range Comfort Luxury Experience Family Interests Your Custom Vacation Plan Download PDF Previous Next ${currentPlan.destinations} Accommodation Ideas${currentPlan.accommodation} Sample Itinerary${currentPlan.itinerary} `; currentTab = 2; updateTabView(); } 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 ? 'Generate Plan' : 'Next'; nextBtn.style.visibility = currentTab === 2 ? 'hidden' : 'visible'; } function goToTab(tabNumber) { if (tabNumber > currentTab && currentTab === 1) { generatePlan(); } else { currentTab = tabNumber; updateTabView(); } } function downloadPdf() { if (!currentPlan) { showCustomMessage('No Data', 'Please generate a plan first.', 'warning'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFontSize(22); doc.setFont('helvetica', 'bold'); doc.text("Your Family Vacation Plan", 105, 20, { align: 'center' }); doc.setFontSize(11); doc.setFont('helvetica', 'normal'); doc.text(currentPlan.summary, 105, 28, { align: 'center' }); let yPos = 40; const addSection = (title, content) => { if (yPos > 260) { doc.addPage(); yPos = 20; } doc.setFontSize(14); doc.setFont('helvetica', 'bold'); doc.text(title, 14, yPos); yPos += 7; doc.setFontSize(10); doc.setFont('helvetica', 'normal'); const lines = doc.splitTextToSize(content, 180); doc.text(lines, 14, yPos); yPos += (lines.length * 5) + 8; }; addSection("Suggested Destinations", currentPlan.destinations); addSection("Accommodation Ideas", currentPlan.accommodation); addSection("Sample Itinerary", currentPlan.pdfItinerary.replace(/Day (\d+)/g, '\nDay $1:\n').replace(/Morning:/g,'- Morning:').replace(/Afternoon:/g,'- Afternoon:')); doc.save('Family_Vacation_Plan.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); populateInterests(); updateTabView(); });