Same-Day Delivery Cost Estimator

Same-Day Delivery Cost Estimator

Get instant cost estimates for your local deliveries.

How far is the delivery?

10 miles

Delivery Cost Estimate

Disclaimer: Costs are estimates based on a simulated model and do not represent quotes from actual carriers. Prices may vary based on traffic, time of day, and specific locations.

${r.name}

${r.isCheapest ? '

Best Value

' : ''}

$${r.cost}

`).join(''); } // --- Tab & Navigation Logic --- function switchTab(targetTabId) { currentTab = targetTabId; tabs.forEach(tab => tab.classList.toggle('active', tab.dataset.tab === currentTab)); tabContents.forEach(content => content.classList.toggle('active', content.id === currentTab)); updateNavButtons(); } tabs.forEach(tab => { tab.addEventListener('click', () => { const target = tab.dataset.tab; if (target === 'estimate') { const data = calculateCosts(); renderResults(data); } switchTab(target); }); }); nextBtn.addEventListener('click', () => { const data = calculateCosts(); renderResults(data); switchTab('estimate'); }); prevBtn.addEventListener('click', () => { switchTab('details'); }); function updateNavButtons() { if (currentTab === 'details') { prevBtn.style.display = 'none'; nextBtn.style.display = 'inline-flex'; pdfButtonContainer.style.display = 'none'; } else { // estimate tab prevBtn.style.display = 'inline-flex'; nextBtn.style.display = 'none'; pdfButtonContainer.style.display = 'block'; } } // --- PDF Download --- downloadPdfBtn.addEventListener('click', async () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const content = document.getElementById('pdf-content'); // Temporarily add a white background for PDF capture content.classList.add('bg-white'); doc.setFont('helvetica', 'bold'); doc.setFontSize(18); doc.text('Same-Day Delivery Estimate', 14, 22); doc.setFontSize(11); doc.setTextColor(100); doc.text(`Generated on: ${new Date().toLocaleDateString()}`, 14, 28); await new Promise(resolve => setTimeout(resolve, 0)); // Allow render const canvas = await html2canvas(content, { scale: 2 }); const imgData = canvas.toDataURL('image/jpeg', 1.0); const imgProps = doc.getImageProperties(imgData); const pdfWidth = doc.internal.pageSize.getWidth() - 28; const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; doc.addImage(imgData, 'JPEG', 14, 40, pdfWidth, pdfHeight); doc.save(`SameDay-Delivery-Estimate-${new Date().toISOString().slice(0,10)}.pdf`); // Remove the temporary background class content.classList.remove('bg-white'); }); // --- Initial Load --- switchTab('details'); });
Scroll to Top