Warehouse Storage Optimization System

Warehouse Storage Optimization System

Visualize and optimize your product placement for maximum efficiency.

${utilization}%

Total Bins

${totalBins}

Unplaced Items

${unplacedItems.reduce((s,i) => s + i.quantity, 0)}

Wasted Space (cu in)

${formatNumber(wastedSpace)}

Optimized Warehouse Layout

A-Items B-Items C-Items Empty
${warehouseHtml}
`; document.getElementById('download-pdf-btn').addEventListener('click', generatePdf); }; const renderConfig = () => { const configContent = document.getElementById('content-configuration'); if (!configContent) return; const productsHtml = appData.products.map((p, i) => ` `).join(''); configContent.innerHTML = `
Warehouse Layout
Product SKUs
${productsHtml}
NameW(in)D(in)H(in)QtyVelocity
`; attachConfigListeners(); }; const attachConfigListeners = () => { document.getElementById('add-product-btn').addEventListener('click', () => { appData.products.push({ id: Date.now(), name: '', w: 0, d: 0, h: 0, velocity: 'C', quantity: 0 }); renderConfig(); lucide.createIcons(); }); document.getElementById('products-container').addEventListener('click', e => { const removeBtn = e.target.closest('.remove-product-btn'); if (removeBtn) { appData.products.splice(parseInt(removeBtn.dataset.index), 1); renderConfig(); lucide.createIcons(); } }); document.getElementById('update-btn').addEventListener('click', handleConfigUpdate); }; const handleConfigUpdate = () => { appData.warehouse = { aisles: parseInt(document.getElementById('wh-aisles').value) || 1, racksPerAisle: parseInt(document.getElementById('wh-racks').value) || 1, shelvesPerRack: parseInt(document.getElementById('wh-shelves').value) || 1, binCapacity: parseInt(document.getElementById('wh-capacity').value) || 1, }; appData.products = Array.from(document.querySelectorAll('.product-row')).map((row, i) => ({ id: appData.products[i].id, name: row.querySelector('[data-field="name"]').value, w: parseInt(row.querySelector('[data-field="w"]').value) || 0, d: parseInt(row.querySelector('[data-field="d"]').value) || 0, h: parseInt(row.querySelector('[data-field="h"]').value) || 0, quantity: parseInt(row.querySelector('[data-field="quantity"]').value) || 0, velocity: row.querySelector('[data-field="velocity"]').value })); optimizationResult = null; renderDashboard(); alert('Configuration saved and optimization re-run!'); switchTab(0); }; const generatePdf = () => { if (!optimizationResult) return; loadingOverlay.style.display = 'flex'; const { jsPDF } = window.jspdf; const pdfContent = document.getElementById('pdf-content-area'); const pdfHeader = document.getElementById('pdf-header'); pdfHeader.classList.remove('hidden'); html2canvas(pdfContent, { scale: 2, useCORS: true, logging: false }) .then(canvas => { pdfHeader.classList.add('hidden'); const imgData = canvas.toDataURL('image/jpeg', 0.95); const pdf = new jsPDF({ orientation: 'landscape', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgProps = pdf.getImageProperties(imgData); const imgHeight = (imgProps.height * pdfWidth) / imgProps.width; pdf.addImage(imgData, 'JPEG', 0, 0, pdfWidth, imgHeight); pdf.save('Warehouse-Optimization-Report.pdf'); loadingOverlay.style.display = 'none'; }).catch(err => { console.error("PDF generation failed:", err); pdfHeader.classList.add('hidden'); loadingOverlay.style.display = 'none'; alert('An error occurred generating the PDF.'); }); }; // --- TAB NAVIGATION & INITIALIZATION --- const switchTab = (tabIndex) => { activeTabIndex = tabIndex; document.querySelectorAll('.tab-btn').forEach((btn, i) => btn.classList.toggle('active', i === tabIndex)); document.querySelectorAll('.tab-content').forEach((content, i) => content.classList.toggle('hidden', i !== tabIndex)); updateNavButtons(); }; const updateNavButtons = () => { prevTabBtn.disabled = activeTabIndex === 0; nextTabBtn.disabled = activeTabIndex === tabIdentifiers.length - 1; }; const initializeUI = () => { const tabs = [ { name: 'Optimization Dashboard', id: 'dashboard' }, { name: 'Configuration', id: 'configuration' } ]; tabIdentifiers = tabs.map(t => t.id); tabsContainer.innerHTML = tabs.map(tab => ``).join(''); mainContent.innerHTML = tabs.map(tab => `
`).join(''); tabs.forEach((tab, index) => document.getElementById(`tab-${tab.id}`).addEventListener('click', () => switchTab(index))); renderDashboard(); renderConfig(); switchTab(0); lucide.createIcons(); }; initializeUI(); prevTabBtn.addEventListener('click', () => { if (activeTabIndex > 0) switchTab(activeTabIndex - 1); }); nextTabBtn.addEventListener('click', () => { if (activeTabIndex < tabIdentifiers.length - 1) switchTab(activeTabIndex + 1); }); });
Scroll to Top