<% if (auditLogs && auditLogs.length > 0) { %>
| Date / Time |
Model |
Action |
User |
Changes |
IP Address |
Details |
<% auditLogs.forEach(log => { %>
|
<%= new Date(log.createdAt).toLocaleDateString('en-GB') %>
<%= new Date(log.createdAt).toLocaleTimeString() %>
|
<%= log.model %> |
<%
let badgeClass = 'badge-soft-primary';
if (log.action.includes('CREATE')) badgeClass = 'bg-soft-success';
else if (log.action.includes('UPDATE')) badgeClass = 'bg-soft-warning';
else if (log.action.includes('DELETE')) badgeClass = 'bg-soft-danger';
%>
<%= log.action %>
|
<% if (log.performedBy) { %>
<%= log.performedBy.username %>
<%= log.performedBy.email %>
<% } else { %>
System
<% } %>
|
<% if (log.changes && log.changes.length > 0) { %>
<%= log.changes.length %> field<%= log.changes.length > 1 ? 's' : '' %>
<% log.changes.slice(0, 2).forEach(change => { %>
<%= change.field %>
<% }); %>
<% if (log.changes.length > 2) { %>
+<%= log.changes.length - 2 %> more
<% } %>
<% } else { %>
—
<% } %>
|
<%= log.ipAddress %> |
|
<% }); %>
<% if (pagination && pagination.total > 1) { %>
Showing <%= ((pagination.current - 1) * pagination.limit) + 1 %>–<%= Math.min(pagination.current * pagination.limit, pagination.totalCount) %> of <%= pagination.totalCount %>
<% } %>
<% } else { %>
No audit logs found
No activity matches your current filters.
Clear Filters
<% } %>