<%- include('../partials/app-start') %>
<header class="topbar"><div><p class="kicker">My records</p><h1>Attendance history</h1><p class="muted">Your recent work sessions and calculated totals.</p></div></header>
<section class="panel table-panel"><div class="table-wrap"><table><thead><tr><th>Date</th><th>Clock in</th><th>Clock out</th><th>Lunch</th><th>Breaks</th><th>Count</th><th>Effective work</th></tr></thead><tbody>
<% if (!rows.length) { %><tr><td colspan="7"><div class="empty">No attendance history yet.</div></td></tr><% } %>
<% rows.forEach(r => { const session = r.clock_out ? (new Date(r.clock_out)-new Date(r.clock_in))/1000 : (Date.now()-new Date(r.clock_in))/1000; const work=Math.max(0,session-r.lunch_seconds-r.break_seconds); %>
<tr><td><strong><%= r.attendance_date %></strong></td><td><%= fmtTime(r.clock_in) %></td><td><%= fmtTime(r.clock_out) %></td><td><%= fmtDuration(r.lunch_seconds) %></td><td><%= fmtDuration(r.break_seconds) %></td><td><%= r.break_count %></td><td><strong><%= fmtDuration(work) %></strong></td></tr><% }) %>
</tbody></table></div></section>
<%- include('../partials/app-end') %>
