<?php include __DIR__ . '/../includes/header.php'; require_admin(); ?>
<div class="table-wrap"><div class="d-flex justify-content-between align-items-center mb-3"><div><h4 class="mb-0">Auditoría del sistema</h4><div class="text-muted small">Últimos cambios realizados por los usuarios.</div></div></div><div class="table-responsive"><table class="table table-bordered table-hover align-middle"><thead><tr><th>Fecha</th><th>Usuario</th><th>Acción</th><th>Tabla</th><th>Registro</th><th>Detalle</th></tr></thead><tbody><?php foreach (db()->query("SELECT a.*, u.full_name FROM audit_logs a LEFT JOIN users u ON u.id=a.user_id ORDER BY a.id DESC LIMIT 300") as $row): ?><tr><td><?= e($row['created_at']) ?></td><td><?= e($row['full_name']) ?></td><td><?= e($row['action_type']) ?></td><td><?= e($row['table_name']) ?></td><td><?= e($row['record_id']) ?></td><td><?= e($row['details']) ?></td></tr><?php endforeach; ?></tbody></table></div></div>
<?php include __DIR__ . '/../includes/footer.php'; ?>
