Now add the delete button cell in the thread rows:


Edit

${formatDate(thread.last_date)}

            `;
        });

        html += '

';
        container.innerHTML = html;

        renderPagination('emails-pagination', data.pagination, (p) => loadEmails(p));

${formatDate(thread.last_date)}

                        <button class="btn btn-sm" style="color:#ef4444;border:1px solid #ef4444;background:none;" onclick="deleteThread('${escapeHtml(thread.thread_id)}', '${escapeHtml(thread.subject || '(No Subject)').replace(/'/g, "\\'")}');" title="Delete thread">
                            Del
                        </button>

            `;
        });

        html += '

';
        container.innerHTML = html;

        renderPagination('emails-pagination', data.pagination, (p) => loadEmails(p));