<%- include('../partials/app-start') %>
<header class="topbar"><div><p class="kicker">Monthly reporting</p><h1>Employee summary</h1><p class="muted">Actual attendance and effective work totals for each employee.</p></div></header>
<section class="panel filter-panel"><form class="filters" method="get"><label>Month<input type="month" name="month" value="<%= month %>"></label><button class="btn btn-secondary">Apply month</button></form></section>
<section class="panel table-panel"><div class="table-wrap"><table><thead><tr><th>Employee</th><th>Attendance days</th><th>Session time</th><th>Lunch</th><th>Breaks</th><th>Break count</th><th>Effective work</th><th>Avg work/day</th><th>Open sessions</th></tr></thead><tbody>
<% rows.forEach(r=>{ const session=Number(r.session_seconds||0), lunch=Number(r.lunch_seconds||0), brk=Number(r.break_seconds||0), work=Math.max(0,session-lunch-brk), days=Number(r.attendance_days||0); %>
<tr><td><div class="person"><div class="avatar sm"><%= r.name.slice(0,1) %></div><div><strong><%= r.name %></strong><small><%= r.email %></small></div></div></td><td><strong><%= days %></strong></td><td><%= fmtDuration(session) %></td><td><%= fmtDuration(lunch) %></td><td><%= fmtDuration(brk) %></td><td><%= r.break_count || 0 %></td><td><strong><%= fmtDuration(work) %></strong></td><td><%= fmtDuration(days ? work/days : 0) %></td><td><span class="badge <%= Number(r.open_sessions||0) ? 'warn':'good' %>"><%= r.open_sessions || 0 %></span></td></tr>
<% }) %>
</tbody></table></div></section>
<%- include('../partials/app-end') %>
