Auto-Reply for Customer Comments

Auto-Reply for Customer Comments

Generate smart, customizable replies to customer feedback instantly.

Enter Customer Comment

Generated Reply

Your generated reply will appear here.

${baseReply.replace(/\n/g, '
')}

`; replyOutput.className = `p-4 rounded-lg reply-${type}`; pdfButtonContainer.style.display = 'block'; }; // --- Rendering Functions --- const renderConfig = () => { templatePositiveInput.value = state.templates.positive; templateNegativeInput.value = state.templates.negative; templateInquiryInput.value = state.templates.inquiry; templateDefaultInput.value = state.templates.default; }; // --- Tab & Navigation Logic --- function switchTab(targetTabId) { if (currentTab === 'config') { saveConfig(); } currentTab = targetTabId; tabs.forEach(tab => tab.classList.toggle('active', tab.dataset.tab === currentTab)); tabContents.forEach(content => content.classList.toggle('active', content.id === currentTab)); updateNavButtons(); } function updateNavButtons() { if (currentTab === 'dashboard') { nextBtn.textContent = 'Manage Templates'; prevBtn.style.display = 'none'; } else { nextBtn.textContent = 'Go to Generator'; prevBtn.style.display = 'inline-flex'; } } // --- Event Handlers --- generateReplyBtn.addEventListener('click', generateReply); tabs.forEach(tab => tab.addEventListener('click', () => switchTab(tab.dataset.tab))); nextBtn.addEventListener('click', () => currentTab === 'dashboard' ? switchTab('config') : switchTab('dashboard')); prevBtn.addEventListener('click', () => currentTab === 'config' ? switchTab('dashboard') : switchTab('dashboard')); // --- PDF Download --- downloadPdfBtn.addEventListener('click', async () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const originalComment = customerCommentInput.value; const generatedReply = replyOutput.innerText; doc.setFontSize(16); doc.setFont('helvetica', 'bold'); doc.text('Customer Comment & Generated Reply', 14, 22); doc.setFontSize(11); doc.setFont('helvetica', 'bold'); doc.text('Original Comment:', 14, 40); doc.setFont('helvetica', 'normal'); const commentLines = doc.splitTextToSize(originalComment, 180); doc.text(commentLines, 14, 46); const replyY = 46 + (commentLines.length * 5) + 10; doc.setFont('helvetica', 'bold'); doc.text('Generated Reply:', 14, replyY); doc.setFont('helvetica', 'normal'); const replyLines = doc.splitTextToSize(generatedReply, 180); doc.text(replyLines, 14, replyY + 6); doc.save(`Customer-Reply-${new Date().toISOString().slice(0,10)}.pdf`); }); // --- Initial Load --- renderConfig(); updateNavButtons(); });
Scroll to Top