Online Smart Email Attachment Organizer

Online Smart Email Attachment Organizer

Step 1: Upload Attachments

Staged Files:

  • No files selected.

No matching attachments found.

'; } else { const ul = document.createElement('ul'); ul.className = 'space-y-2'; results.forEach(att => { const li = document.createElement('li'); li.className = 'p-2 bg-white rounded border flex justify-between items-center'; li.innerHTML = `

${att.name}

${att.category}

${(att.size / 1024).toFixed(2)} KB `; ul.appendChild(li); }); searchResultsEl.appendChild(ul); } }; const generatePdf = () => { if (typeof window.jspdf === 'undefined') { console.error("jsPDF library is not loaded."); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFontSize(18); doc.text('Email Attachment Report', 14, 22); doc.setFontSize(11); doc.setTextColor(100); doc.text(`Generated on: ${new Date().toLocaleDateString('en-US')}`, 14, 30); let startY = 40; const sortedCategories = Object.keys(organizerState.categories).sort(); sortedCategories.forEach(category => { const attachments = organizerState.categories[category]; const tableBody = attachments.map(att => [ att.name, `${(att.size / 1024).toFixed(2)} KB`, att.type || 'N/A' ]); doc.autoTable({ startY: startY, head: [[{ content: category, colSpan: 3, styles: { fillColor: [30, 144, 255] } }]], body: [['File Name', 'Size', 'Type']], foot: tableBody, theme: 'grid', didParseCell: function(data) { if (data.section === 'head' && data.row.index === 1) { // The header row under the main category title data.cell.styles.fillColor = '#f3f4f6'; data.cell.styles.textColor = '#111827'; data.cell.styles.fontStyle = 'bold'; } } }); startY = doc.autoTable.previous.finalY + 10; }); doc.save('attachment-organizer-report.pdf'); }; // --- EVENT LISTENERS --- fileUploadEl?.addEventListener('change', handleFileSelection); processFilesBtn?.addEventListener('click', processFiles); searchInputEl?.addEventListener('input', performSearch); categoryFilterEl?.addEventListener('change', performSearch); downloadPdfBtn?.addEventListener('click', generatePdf); prevBtn?.addEventListener('click', () => changeTab(currentTab - 1)); nextBtn?.addEventListener('click', () => changeTab(currentTab + 1)); // --- INITIALIZATION --- updateNavButtons(); });
Scroll to Top