Cruise Cabin Selection Tool

Cruise Cabin Selection Tool

Compare cabin options to find the perfect room for your voyage.

Add a Cabin to Compare

Comparison Dashboard

No cabins added

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

${item.line.charAt(0).toUpperCase() + item.line.slice(1)} Line

    ${item.pros.map(p => `
  • ${p}
  • `).join('')}
    ${item.cons.map(c => `
  • ${c}
  • `).join('')}
${item.priceIndex}x `; comparisonTableBody.appendChild(row); }); } 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 cabins to generate a PDF.', 'warning'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFontSize(22); doc.setFont('helvetica', 'bold'); doc.text("Cruise Cabin Comparison Report", 105, 20, { align: 'center' }); const tableData = [...comparisonList] .sort((a, b) => a.priceIndex - b.priceIndex) .map(item => [ `${item.name}\n(${item.line} Line)`, item.pros.join('\n'), item.cons.join('\n'), `${item.priceIndex}x` ]); doc.autoTable({ startY: 30, head: [['Cabin Option', 'Pros', 'Cons', 'Price Index']], body: tableData, theme: 'grid', headStyles: { fillColor: [37, 99, 235] }, styles: { cellPadding: 2, fontSize: 8, valign: 'top' } }); doc.save('Cruise_Cabin_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)); addCabinBtn.addEventListener('click', addCabin); pdfDownloadBtn.addEventListener('click', downloadPdf); clearBtn.addEventListener('click', () => { comparisonList = []; renderTable(); showCustomMessage('Cleared', 'All cabins 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