Automated Dropshipping Supplier Negotiation Assistant

Automated Dropshipping Supplier Negotiation Assistant

Generate professional negotiation emails to secure better pricing.

Adjust Tone:

`; // Attach event listeners to newly created elements document.getElementById('copy-email-btn').addEventListener('click', copyEmailToClipboard); document.getElementById('download-pdf-btn').addEventListener('click', handlePdfDownload); document.querySelectorAll('input[name="email-tone"]').forEach(radio => { radio.addEventListener('change', generateEmail); }); lucide.createIcons(); } function copyEmailToClipboard() { const textarea = document.getElementById('email-textarea'); if(!textarea) return; textarea.select(); textarea.setSelectionRange(0, 99999); // For mobile devices document.execCommand('copy'); const btn = document.getElementById('copy-email-btn'); btn.innerHTML = ` Copied!`; lucide.createIcons(); setTimeout(() => { btn.innerHTML = ` Copy to Clipboard`; lucide.createIcons(); }, 2000); } async function handlePdfDownload() { if (!lastGeneratedEmail) return; const { jsPDF } = window.jspdf; document.getElementById('pdf-report-date').textContent = new Date().toLocaleDateString(); document.getElementById('pdf-email-body').textContent = lastGeneratedEmail; try { const canvas = await html2canvas(document.getElementById('pdf-content'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgProps = pdf.getImageProperties(imgData); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('Negotiation_Email_Draft.pdf'); } catch(e) { console.error("PDF generation failed:", e); alert("An error occurred generating the PDF.") } } // --- Event Listeners --- tabs.forEach((tab, index) => tab.btn.addEventListener('click', () => switchTab(index))); prevBtn.addEventListener('click', () => switchTab(currentTab - 1)); nextBtn.addEventListener('click', () => switchTab(currentTab + 1)); generateEmailBtn.addEventListener('click', generateEmail); // --- Initialization --- updateNavButtons(); lucide.createIcons(); });
Scroll to Top