Bitácoras
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-registros-agencias">
|
||||
<thead>
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nombre</th>
|
||||
@@ -53,9 +53,9 @@
|
||||
<?php foreach ($registros as $r): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($r['id_agencia'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre_agencia'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars($r['accion'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['realizado_por'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars($r['fecha'] ? $r['fecha']->format('Y-m-d H:i:s') : '') ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-logins">
|
||||
<thead>
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nombre</th>
|
||||
|
||||
@@ -35,8 +35,52 @@
|
||||
<body>
|
||||
|
||||
<div class="content">
|
||||
<h4 class="mb-4">👥 Acceso de Usuarios</h4>
|
||||
<h4 class="mb-4">👥 Mi Actividad</h4>
|
||||
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-logins-usuario">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nombre</th>
|
||||
<th>Correo</th>
|
||||
<th>IP</th>
|
||||
<th>Fecha</th>
|
||||
<th>Estatus</th>
|
||||
<th>Detalles</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($registros as $r): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($r['id'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars($r['email'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars($r['ip'] ?? '') ?></td>
|
||||
<td><?= $r['fecha']->format('Y-m-d H:i:s') ?></td>
|
||||
<td>
|
||||
<?= $r['exito'] == 1 ? 'Éxito' : 'Fallido' ?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($r['detalle']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#tabla-logins-usuario').DataTable({
|
||||
order: [],
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -33,7 +33,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="content">
|
||||
<h4 class="mb-4">🛠️ Cambios de Usuario</h4>
|
||||
|
||||
|
||||
@@ -33,6 +33,52 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="content">
|
||||
<h4 class="mb-4">🔗 Vinculaciones</h4>
|
||||
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped align-middle" id="tabla-bitacora-vinculaciones">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Usuario</th>
|
||||
<th>Acción</th>
|
||||
<th>Aprobado por</th>
|
||||
<th>Fecha</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($registros as $r): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($r['id_relacion']) ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre_importador'])) ?></td>
|
||||
<td>
|
||||
<span class="badge bg-<?= $r['accion'] === 'Vinculación' ? 'success' : 'danger' ?>">
|
||||
<?= $r['accion'] ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre_aprobador'] ?? '')) ?></td>
|
||||
<td><?= $r['fecha'] instanceof DateTime ? $r['fecha']->format('Y-m-d H:i') : htmlspecialchars($r['fecha']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#tabla-bitacora-vinculaciones').DataTable({
|
||||
order: [],
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -123,10 +123,20 @@
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card shadow-sm p-3">
|
||||
<h5 class="text-success">Mi actividad</h5>
|
||||
<h5 class="text-success">Registro de vinculaciones</h5>
|
||||
<p>Ver las vinculaciones de mi agencia.</p>
|
||||
<a href="/IMPORTADORES/bitacoras/vinculaciones"
|
||||
class="btn btn-success btn-sm mt-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/bitacoras/vinculaciones' ? 'active' : '' ?>">
|
||||
Ver actividad
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card shadow-sm p-3">
|
||||
<h5 class="text-info">Mi actividad</h5>
|
||||
<p>Ver mi actividad en la plataforma.</p>
|
||||
<a href="/IMPORTADORES/bitacoras/miAcceso"
|
||||
class="btn btn-success btn-sm mt-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/bitacoras/miAcceso' ? 'active' : '' ?>">
|
||||
class="btn btn-info btn-sm mt-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/bitacoras/miAcceso' ? 'active' : '' ?>">
|
||||
Ver mis accesos
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -33,6 +33,54 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="content">
|
||||
<h4 class="mb-4">👥 Acceso de Usuarios</h4>
|
||||
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-logins">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nombre</th>
|
||||
<th>Correo</th>
|
||||
<th>IP</th>
|
||||
<th>Fecha</th>
|
||||
<th>Estatus</th>
|
||||
<th>Detalles</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($registros as $r): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($r['id_usuario'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre'] ?? '')) ?></td>
|
||||
<td><?= htmlspecialchars($r['email'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars($r['ip'] ?? '') ?></td>
|
||||
<td><?= $r['fecha']->format('Y-m-d H:i:s') ?></td>
|
||||
<td>
|
||||
<?= $r['exito'] == 1 ? 'Éxito' : 'Fallido' ?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($r['detalle']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#tabla-logins').DataTable({
|
||||
order: [],
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -33,6 +33,52 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="content">
|
||||
<h4 class="mb-4">🔗 Vinculaciones</h4>
|
||||
|
||||
<div class="card p-3 shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped align-middle" id="tabla-vinculaciones-usuario">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Agencia</th>
|
||||
<th>Acción</th>
|
||||
<th>Aprobado por</th>
|
||||
<th>Fecha</th> <!-- vinculación // desvinculación -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($registros as $r): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($r['id_relacion']) ?></td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre_agencia'])) ?></td>
|
||||
<td>
|
||||
<span class="badge bg-<?= $r['accion'] === 'Vinculación' ? 'success' : 'danger' ?>">
|
||||
<?= $r['accion'] ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= htmlspecialchars(decrypt($r['nombre_aprobador'] ?? '')) ?></td>
|
||||
<td><?= $r['fecha'] instanceof DateTime ? $r['fecha']->format('Y-m-d H:i') : htmlspecialchars($r['fecha']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#tabla-vinculaciones-usuario').DataTable({
|
||||
order: [],
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -233,32 +233,33 @@
|
||||
</div>
|
||||
<?php elseif (isset($datos['tipo_usuario']) && $datos['tipo_usuario'] === 'super_admin'): ?>
|
||||
<div class="card shadow-sm p-4 mb-4 bg-white">
|
||||
<div class="section-header">🔧 Información de Super Administrador</div>
|
||||
<div class="section-header">🔧 Información del Administrador</div>
|
||||
<form>
|
||||
<div class="row mb-3">
|
||||
<label class="col-md-1 col-form-label">Nombre:</label>
|
||||
<div class="col-md-4">
|
||||
<!-- Para super_admin, NO desencriptar - usar directamente -->
|
||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['nombre'] ?? '') ?>" disabled>
|
||||
<input type="text" class="form-control" value="<?= htmlspecialchars(decrypt($datos['nombre'] ?? '')) ?>" disabled>
|
||||
</div>
|
||||
<label class="col-md-2 col-form-label">Tipo de Usuario:</label>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3"></div>
|
||||
<label class="col-md-1 col-form-label">Tipo de Usuario:</label>
|
||||
<div class="col-md-3">
|
||||
<input type="text" class="form-control" value="Super Administrador" disabled>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-md-2 col-form-label">Correo:</label>
|
||||
<div class="col-md-10">
|
||||
<label class="col-md-1 col-form-label">Correo:</label>
|
||||
<div class="col-md-11">
|
||||
<!-- Para super_admin, NO desencriptar - usar directamente -->
|
||||
<input type="email" class="form-control" value="<?= htmlspecialchars($datos['correo'] ?? '') ?>" disabled>
|
||||
<input type="email" class="form-control" value="<?= htmlspecialchars(decrypt($datos['correo'] ?? '')) ?>" disabled>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Información adicional específica de super_admin -->
|
||||
<div class="row mb-3">
|
||||
<label class="col-md-2 col-form-label">Privilegios:</label>
|
||||
<div class="col-md-10">
|
||||
<label class="col-md-1 col-form-label">Privilegios:</label>
|
||||
<div class="col-md-11">
|
||||
<textarea class="form-control" rows="2" disabled>Acceso completo al sistema - Gestión de usuarios, agencias, importadores y configuración general</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -43,6 +43,7 @@ $permisos = [
|
||||
'seguridad' => true,
|
||||
'bitacoras' => [
|
||||
'acceso_usuarios_agencia' => true,
|
||||
'registro_vinculaciones' => true,
|
||||
'mi_actividad' => true
|
||||
],
|
||||
],
|
||||
@@ -83,13 +84,13 @@ $cantidadBitacoras = contarBitacorasDisponibles($permisosBitacoras);
|
||||
// Función para obtener el texto descriptivo según el permiso
|
||||
function obtenerTextoPermiso($permiso, $tipoUsuario) {
|
||||
$textos = [
|
||||
'registro_accesos' => ($tipoUsuario === 'super_admin') ? 'Registro de accesos' : null,
|
||||
'registro_usuarios' => ($tipoUsuario === 'super_admin') ? 'Registro de cambios de usuarios' : null,
|
||||
'registro_agencias' => ($tipoUsuario === 'super_admin') ? 'Registro de agencias' : null,
|
||||
'acceso_usuarios_agencias' => ($tipoUsuario === 'admin_agencia' || $tipoUsuario === 'agente_aduanal') ? 'Registros de accesos' : null,
|
||||
'registro_vinculaciones' => ($tipoUsuario === 'admin_agencia' || $tipoUsuario === 'agente_aduanal') ? 'Vinculaciones (Agencia)' : null,
|
||||
'mi_actividad' => in_array($tipoUsuario, ['super_admin', 'admin_agencia', 'agente_aduanal', 'importador']) ? 'Mi actividad' : null,
|
||||
'vinculaciones_usuario' => ($tipoUsuario === 'importador') ? 'Mis vinculaciones' : null,
|
||||
'registro_accesos' => ($tipoUsuario === 'super_admin') ? 'Registro de accesos' : null,
|
||||
'registro_usuarios' => ($tipoUsuario === 'super_admin') ? 'Cambios de usuarios' : null,
|
||||
'registro_agencias' => ($tipoUsuario === 'super_admin') ? 'Registro de agencias' : null,
|
||||
'acceso_usuarios_agencia' => ($tipoUsuario === 'admin_agencia' || $tipoUsuario === 'agente_aduanal') ? 'Registro de accesos' : null,
|
||||
'registro_vinculaciones' => ($tipoUsuario === 'admin_agencia' || $tipoUsuario === 'agente_aduanal') ? 'Vinculaciones (Agencia)' : null,
|
||||
'mi_actividad' => in_array($tipoUsuario, ['super_admin', 'admin_agencia', 'agente_aduanal', 'importador']) ? 'Mi actividad' : null,
|
||||
'vinculaciones_usuario' => ($tipoUsuario === 'importador') ? 'Mis vinculaciones' : null,
|
||||
];
|
||||
|
||||
return $textos[$permiso] ?? ucfirst(str_replace('_', ' ', $permiso));
|
||||
@@ -113,14 +114,13 @@ function obtenerIconoPermiso($permiso) {
|
||||
// Función para obtener la URL según el permiso
|
||||
function obtenerUrlPermiso($permiso) {
|
||||
$urls = [
|
||||
'registro_accesos' => '/IMPORTADORES/bitacoras/sistema',
|
||||
'registro_usuarios' => '/IMPORTADORES/bitacoras/usuarios',
|
||||
'registro_agencias' => '/IMPORTADORES/bitacoras/agencias',
|
||||
'acceso_usuarios_agencia' => '/IMPORTADORES/bitacoras/sistemaAgencia',
|
||||
'registro_vinculaciones' => '/IMPORTADORES/bitacoras/vinculaciones',
|
||||
'mis_vinculaciones' => '/IMPORTADORES/bitacoras/misVinculaciones',
|
||||
'mi_actividad' => '/IMPORTADORES/bitacoras/miAcceso',
|
||||
'vinculaciones_usuario' => '/IMPORTADORES/bitacoras/vinculacionesUsuario'
|
||||
'registro_accesos' => '/IMPORTADORES/bitacoras/sistema', // ✅
|
||||
'registro_usuarios' => '/IMPORTADORES/bitacoras/usuarios', // ✅
|
||||
'registro_agencias' => '/IMPORTADORES/bitacoras/agencias', // ✅
|
||||
'acceso_usuarios_agencia' => '/IMPORTADORES/bitacoras/sistemaAgencia', // ✅
|
||||
'registro_vinculaciones' => '/IMPORTADORES/bitacoras/vinculaciones', // ✅
|
||||
'mi_actividad' => '/IMPORTADORES/bitacoras/miAcceso', // ✅
|
||||
'vinculaciones_usuario' => '/IMPORTADORES/bitacoras/vinculacionesUsuario' //
|
||||
];
|
||||
|
||||
return $urls[$permiso] ?? '/IMPORTADORES/bitacoras/index';
|
||||
|
||||
Reference in New Issue
Block a user