<%= title %>

Detailed audit log information

Audit Information
<%= auditLog.model %>
<% let actionStyle = 'background-color: var(--primary-color); color: white;'; if (auditLog.action.includes('CREATE')) actionStyle = 'background-color: #28a745; color: white;'; else if (auditLog.action.includes('UPDATE')) actionStyle = 'background-color: #ffc107; color: #212529;'; else if (auditLog.action.includes('DELETE')) actionStyle = 'background-color: #dc3545; color: white;'; %> <%= auditLog.action %>
<%= auditLog.documentId %>
<%= new Date(auditLog.createdAt).toLocaleDateString() %> <%= new Date(auditLog.createdAt).toLocaleTimeString() %>
<% if (auditLog.performedBy) { %> <%= auditLog.performedBy.username %>
<%= auditLog.performedBy.email %> <% } else { %> System <% } %>
<%= auditLog.ipAddress %>
<% if (auditLog.userAgent) { %>
<%= auditLog.userAgent %>
<% } %>
<% if (auditLog.changes && auditLog.changes.length > 0) { %>
Field Changes <%= auditLog.changes.length %>
<% if (user && (user.role === 'admin' || user.role === 'superadmin')) { %>
<% auditLog.changes.forEach((change, index) => { %> <% }); %>
Field Before After
<%= change.field %>
<% if (change.before === null || change.before === undefined) { %> null <% } else if (typeof change.before === 'object') { %>
<%= JSON.stringify(change.before, null, 2) %>
<% } else { %> <%= change.before %> <% } %>
<% if (change.after === null || change.after === undefined) { %> null <% } else if (typeof change.after === 'object') { %>
<%= JSON.stringify(change.after, null, 2) %>
<% } else { %> <%= change.after %> <% } %>
<% } else { %>
Summary View: Detailed field values are restricted to administrators.
<% auditLog.changes.forEach((change, index) => { %> <% }); %>
Field Status
<%= change.field %> Modified
<% } %>
<% } %>
Summary
<%= auditLog.changes ? auditLog.changes.length : 0 %>
Fields Changed
<%= new Date(auditLog.createdAt).toLocaleDateString() === new Date().toLocaleDateString() ? 'Today' : 'Past' %>
Timing