<div class="page-title">
    <h2><i class="bi bi-list-check"></i> Activity Logs</h2>
</div>

<div class="card">
    <div class="card-body">
        <div class="table-responsive">
            <table class="table table-hover table-sm">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>User</th>
                        <th>Action</th>
                        <th>Module</th>
                        <th>Description</th>
                        <th>IP Address</th>
                        <th>Date/Time</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if (!empty($logs)): ?>
                        <?php foreach ($logs as $log): ?>
                            <tr>
                                <td><?= $log->id ?></td>
                                <td><?= $log->username ?? 'System' ?></td>
                                <td><span class="badge bg-info"><?= $log->action ?></span></td>
                                <td><?= $log->module ?></td>
                                <td><?= $log->description ?></td>
                                <td><?= $log->ip_address ?></td>
                                <td><?= date('M d, Y h:i A', strtotime($log->created_at)) ?></td>
                            </tr>
                        <?php endforeach; ?>
                    <?php else: ?>
                        <tr>
                            <td colspan="7" class="text-center">No logs found</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
