<% if(locals.success_msg && success_msg.length > 0) { %> <% } %> <% if(locals.error_msg && error_msg.length > 0) { %> <% } %>
Filter Komentar
Daftar Komentar
<% if (userRole === 'author') { %>
Informasi: Sebagai penulis, Anda hanya dapat melihat dan menyetujui komentar pada artikel yang Anda tulis. Anda tidak memiliki akses untuk menandai komentar sebagai spam atau menghapus komentar.
<% } %> <% if (comments && comments.length > 0) { %>
<% comments.forEach(comment => { %> <% }); %>
Penulis Komentar Artikel Tanggal Status Aksi
<%= comment.author %>
<%= comment.email %>
<%= comment.content %>
<% const post = posts.find(p => p.id === comment.postId); %> <% if (post) { %> <%= post.title %> <% } else { %> Artikel tidak ditemukan <% } %>
<% const date = new Date(comment.date); const formattedDate = date.toLocaleDateString('id-ID', { day: 'numeric', month: 'long', year: 'numeric', hour: '2-digit', minute: '2-digit' }); %> <%= formattedDate %>
<% let statusClass = ''; if (comment.status === 'approved') { statusClass = 'status-approved'; } else if (comment.status === 'pending') { statusClass = 'status-pending'; } else if (comment.status === 'spam') { statusClass = 'status-spam'; } %> <% if (comment.status === 'approved') { %> Disetujui <% } else if (comment.status === 'pending') { %> Menunggu <% } else if (comment.status === 'spam') { %> Spam <% } %>
<% if (comment.status !== 'approved') { %> <% } %> <% if (userRole !== 'author' && comment.status !== 'spam') { %> <% } %> <% if (userRole !== 'author') { %> <% } %>
<% } else { %>

Belum ada komentar

Komentar dari pembaca artikel akan muncul di sini.

<% } %>