Smart In-Store Pickup Coordination Tool

Smart In-Store Pickup Coordination Tool

Manage and track customer pickup orders efficiently.

Today's Pickup Orders

Order ID Customer Name Pickup Slot Status

Manage Pickup Orders

Order ID Customer Name Pickup Slot Action

${pending}

Ready for Pickup

${ready}

Completed

${completed}

`; } // --- Tab & Navigation Logic --- function switchTab(targetTabId) { if (targetTabId === 'dashboard') { const success = runAnalysisAndUpdateDashboard(); if (!success) return; } 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', () => switchTab(tab.dataset.tab)); }); nextBtn.addEventListener('click', () => { if (currentTab === 'dashboard') switchTab('config'); else if (currentTab === 'config') switchTab('dashboard'); }); prevBtn.addEventListener('click', () => { if (currentTab === 'config') switchTab('dashboard'); else if (currentTab === 'dashboard') switchTab('config'); }); function updateNavButtons() { if (currentTab === 'dashboard') { nextBtn.textContent = 'Manage Orders'; prevBtn.style.display = 'none'; pdfButtonContainer.style.display = 'block'; } else { // config tab nextBtn.textContent = 'Update Dashboard'; prevBtn.style.display = 'inline-flex'; pdfButtonContainer.style.display = 'none'; } } // --- PDF Download --- downloadPdfBtn.addEventListener('click', async () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); // Temporarily replace selects with text for clean PDF const statusSelects = document.querySelectorAll('#dashboard-table .status-select'); statusSelects.forEach(select => { const status = select.value.replace(/([A-Z])/g, ' $1').trim(); const statusClass = `status-${status.toLowerCase().replace(' for ', '-').replace(' ', '-')}`; const badge = `${status}`; const textSpan = document.createElement('span'); textSpan.innerHTML = badge; textSpan.dataset.pdfRevert = 'true'; select.style.display = 'none'; select.parentNode.appendChild(textSpan); }); const content = document.getElementById('pdf-content'); doc.setFont('helvetica', 'bold'); doc.setFontSize(18); doc.text('In-Store Pickup Daily Report', 14, 22); doc.setFontSize(11); doc.setTextColor(100); doc.text(`Report for: ${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(`Pickup-Report-${new Date().toISOString().slice(0,10)}.pdf`); // Revert selects document.querySelectorAll('[data-pdf-revert="true"]').forEach(el => el.remove()); statusSelects.forEach(select => select.style.display = 'block'); }); // --- Initial Load --- populateSampleData(); runAnalysisAndUpdateDashboard(); switchTab('dashboard'); });
Scroll to Top