Online Smart Dropshipping Supplier Finder

Online Smart Dropshipping Supplier Finder

Filter and discover dropshipping suppliers tailored to your business needs.

Try adjusting your filters.

`; lucide.createIcons(); return; } resultsContainer.innerHTML = filteredSuppliers.map(s => `

${s.name}

${s.rating}

${s.description}

Category: ${s.category}

Ships From: ${s.shipsFrom}

Integrations: ${s.integrations.join(', ')}

`).join(''); lucide.createIcons(); }; const renderConfiguration = () => { const configContent = document.getElementById('content-config'); if (!configContent) return; configContent.innerHTML = `

Manage Suppliers

`; renderSuppliersList(); document.getElementById('add-supplier-btn').addEventListener('click', () => renderSupplierForm()); }; const renderSuppliersList = () => { const listContainer = document.getElementById('suppliers-list'); if(!listContainer) return; listContainer.innerHTML = appData.suppliers.map(s => `

${s.name}

${s.category} | Rating: ${s.rating}

`).join(''); lucide.createIcons(); listContainer.addEventListener('click', e => { const btn = e.target.closest('button'); if (!btn) return; const id = parseInt(btn.closest('[data-id]').dataset.id); if (btn.classList.contains('edit-btn')) renderSupplierForm(id); if (btn.classList.contains('remove-btn')) { appData.suppliers = appData.suppliers.filter(s => s.id !== id); renderConfiguration(); } }); }; const renderSupplierForm = (id = null) => { const supplier = id ? appData.suppliers.find(s => s.id === id) : {}; const isNew = !id; document.getElementById('supplier-form-container').innerHTML = `

${isNew ? 'Add New' : 'Edit'} Supplier

`; document.getElementById('supplier-form').addEventListener('submit', handleSaveSupplier); document.getElementById('cancel-form').addEventListener('click', () => document.getElementById('supplier-form-container').innerHTML = ''); }; const handleSaveSupplier = (e) => { e.preventDefault(); const id = parseInt(document.getElementById('supplier-id').value); const data = { name: document.getElementById('supplier-name').value, category: document.getElementById('supplier-category').value, shipsFrom: document.getElementById('supplier-location').value, rating: parseFloat(document.getElementById('supplier-rating').value), description: document.getElementById('supplier-desc').value, integrations: document.getElementById('supplier-integrations').value.split(',').map(s => s.trim()) }; if (!data.name || isNaN(data.rating)) { alert('Please enter a valid name and rating.'); return; } if (id) { const index = appData.suppliers.findIndex(s => s.id === id); appData.suppliers[index] = { ...appData.suppliers[index], ...data }; } else { const newId = Math.max(0, ...appData.suppliers.map(s => s.id)) + 1; appData.suppliers.push({ id: newId, ...data }); } renderConfiguration(); }; const generatePdf = () => { loadingOverlay.style.display = 'flex'; const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); let y = 40; pdf.setFontSize(18).setFont('helvetica', 'bold').text('Dropshipping Supplier Report', pdf.internal.pageSize.getWidth() / 2, y, { align: 'center' }); y += 30; pdf.autoTable({ startY: y, head: [['Name', 'Category', 'Ships From', 'Rating', 'Integrations']], body: filteredSuppliers.map(s => [s.name, s.category, s.shipsFrom, s.rating, s.integrations.join(', ')]), theme: 'grid', headStyles: { fillColor: [37, 99, 235] } }); pdf.save(`Supplier-Report.pdf`); loadingOverlay.style.display = 'none'; }; 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: 'Supplier Finder', id: 'finder' }, { name: 'Manage Suppliers', id: 'config' } ]; 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)); }); renderFinder(); renderConfiguration(); 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