<%- include('partials/header', { title: 'Dashboard', scripts: ['https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.0/chart.min.js', '/js/dashboard.js'] }) %>

Welcome, <%= user.full_name || user.username %>

<% if (user.role === 'admin') { %> Administrator <% } else if (user.role === 'manager') { %> Manager <% } else { %> Auditor <% } %>

Quick Actions

New Audit My Audits <% if (user.role === 'admin' || user.role === 'manager') { %> Pending Reviews <% } %> My Profile

Performance Overview

<%= stats.total_audits %>
Total Audits
<%= stats.compliance_rate %>%
Compliance Rate
<%= stats.pending_audits %>
Pending
<%= stats.days_since_last_activity %>
Days Since Last Activity

Audits by Status

Compliance Trend

Recent Activity

<% if (recentActivity.length === 0) { %>

No recent activity found

<% } else { %> <% recentActivity.forEach(activity => { %>
<% if (activity.action === 'create') { %> <% } else if (activity.action === 'update') { %> <% } else if (activity.action === 'submit') { %> <% } else if (activity.action === 'approve') { %> <% } else if (activity.action === 'reject') { %> <% } else { %> <% } %>
<%= activity.message %>
<%= new Date(activity.timestamp).toLocaleString() %> <% if (activity.establishment_name) { %> <%= activity.establishment_name %> <% } %>
<% if (activity.audit_id) { %> <% } %>
<% }); %> <% } %>
<%- include('partials/footer') %>