<?php $title = 'Attendance - Ghana Anaesthesiologists Society'; ?>
<div class="d-sm-flex align-items-center justify-content-between mb-4">
    <h1 class="h3 mb-0 text-white font-weight-bold"><i class="fas fa-clipboard-check mr-2"></i>Attendance Records</h1>
</div>
<div class="glass-table">
    <table class="table">
        <thead><tr><th>Event</th><th>Date</th><th>Status</th><th>Registered</th></tr></thead>
        <tbody>
            <?php if (!empty($attendance)): ?>
                <?php foreach ($attendance as $a): ?>
                <tr>
                    <td><?= htmlspecialchars($a->event_title ?? 'N/A') ?></td>
                    <td><?= isset($a->start_datetime) ? date('M d, Y', strtotime($a->start_datetime)) : 'N/A' ?></td>
                    <td><span class="glass-badge badge-<?= $a->status === 'attended' ? 'success' : ($a->status === 'registered' ? 'info' : ($a->status === 'absent' ? 'danger' : 'warning')) ?>"><?= htmlspecialchars($a->status) ?></span></td>
                    <td><?= date('M d, Y H:i', strtotime($a->registered_at ?? $a->created_at)) ?></td>
                </tr>
                <?php endforeach; ?>
            <?php else: ?>
                <tr><td colspan="4" class="text-center" style="color: rgba(255,255,255,0.5);">No attendance records</td></tr>
            <?php endif; ?>
        </tbody>
    </table>
</div>
