Filtro solicitudes por Agencia Aduanal

This commit is contained in:
2025-06-30 12:01:39 -06:00
parent 55be3d85c9
commit b0291a6685
5 changed files with 193 additions and 35 deletions

View File

@@ -46,6 +46,7 @@
<thead>
<tr>
<th>#</th>
<th>Agencia</th>
<th>Nombre</th>
<th>RFC</th>
<th>Teléfono</th>
@@ -59,12 +60,18 @@
<?php foreach ($vinculaciones as $v): ?>
<tr>
<td><?= htmlspecialchars($v['id_relacion'] ?? '') ?></td>
<td><?= htmlspecialchars($v['id_agencia'] ?? '') ?></td>
<td><?= htmlspecialchars(decrypt($v['nombre_agencia'] ?? '')) ?></td>
<td><?= htmlspecialchars($v['rfc_agencia'] ?? '') ?></td>
<td><?= htmlspecialchars($v['telefono'] ?? '') ?></td>
<td><?= htmlspecialchars($v['direccion'] ?? '') ?></td>
<td><?= !empty($v['fecha_vinculacion']) ? $v['fecha_vinculacion']->format('Y-m-d H:i') : '' ?></td>
<td>
<?php if ($v['id_agencia'] == ($_SESSION['id_agencia_en_uso'] ?? null)): ?>
<span class="badge bg-secondary">En uso</span>
<?php else: ?>
<a href="/IMPORTADORES/importadores/cambiarAgenciaActiva?id=<?= $v['id_agencia'] ?>" class="btn btn-sm btn-success">Usar Agencia</a>
<?php endif; ?>
<a href="/IMPORTADORES/importadores/desvincularUsuario?id=<?= $v['id_relacion'] ?>" class="btn btn-sm btn-danger">Desvincular</a>
</td>
</tr>
@@ -93,6 +100,10 @@
Swal.fire({ icon: 'success', title: 'Usuario desvinculado',
text: 'El usuario se ha desvinculado correctamente.',
confirmButtonColor: '#198754' });
<?php elseif ($_GET['success'] === 'agency_changed'): ?>
Swal.fire({ icon: 'success', title: 'Agencia cambiada',
text: 'La agencia activa se ha cambiado correctamente.',
confirmButtonColor: '#198754' });
<?php endif; ?>
</script>
<?php endif; ?>
@@ -103,6 +114,12 @@
Swal.fire({ icon: 'error', title: 'Desvinculación fallida', text: 'No se ha podido desvincular el usuario.', confirmButtonColor: '#dc3545' });
<?php elseif ($_GET['error'] === 'invalid_id'): ?>
Swal.fire({ icon: 'error', title: 'ID inválido', text: 'El identificador de la relación no es válido.', confirmButtonColor: '#dc3545' });
<?php elseif ($_GET['error'] === 'invalid_agency'): ?>
Swal.fire({ icon: 'error', title: 'Agencia inválida', text: 'El ID de agencia proporcionado no es válido.', confirmButtonColor: '#dc3545' });
<?php elseif ($_GET['error'] === 'fetch_failed'): ?>
Swal.fire({ icon: 'error', title: 'Error al cargar agencias', text: 'No se han podido cargar las agencias.', confirmButtonColor: '#dc3545' });
<?php elseif ($_GET['error'] === 'agency_change_failed'): ?>
Swal.fire({ icon: 'error', title: 'Error al cambiar agencia', text: 'No se ha podido cambiar la agencia activa.', confirmButtonColor: '#dc3545' });
<?php endif; ?>
</script>
<?php endif; ?>