This commit is contained in:
2025-07-17 13:31:55 -06:00
parent 1960a52c36
commit 1900091b99
15 changed files with 2250 additions and 1292 deletions

View File

@@ -89,7 +89,7 @@
<td><?= htmlspecialchars($v['telefono']) ?></td>
<td><?= isset($v['fecha_vinculacion']) && $v['fecha_vinculacion'] instanceof DateTime ? $v['fecha_vinculacion']->format('Y-m-d H:i') : '' ?></td>
<td>
<a href="/IMPORTADORES/agentes/desvincularAgente?id=<?= $v['id_relacion'] ?>" class="btn btn-sm btn-danger mt-auto w-auto btn-animated">Desvincular</a>
<a href="#" onclick="confirmUnlink(<?= $v['id_relacion'] ?>)" class="btn btn-sm btn-danger mt-auto w-auto btn-animated">Desvincular</a>
</td>
</tr>
<?php endforeach; ?>
@@ -108,6 +108,21 @@
}
});
});
function confirmUnlink(id) {
Swal.fire({
title: '¿Estás seguro?',
text: 'Esta acción no se puede deshacer.',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Sí, desvincular',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
window.location.href = `/IMPORTADORES/agentes/desvincularAgente?id=${id}`;
}
});
}
</script>
<?php if (isset($_GET['success'])): ?>

View File

@@ -94,10 +94,10 @@
<td><?= htmlspecialchars(ucfirst($v['tipo_vinculacion'] ?? '')) ?></td>
<td><?= !empty($v['fecha_vinculacion']) ? $v['fecha_vinculacion']->format('Y-m-d H:i') : '' ?></td>
<td>
<?php if (in_array($v['tipo_usuario_sistema'], ['importador', 'agente_aduanal'])): ?>
<a href="/IMPORTADORES/vinculaciones/desvincularAgencia?id=<?= $v['id_relacion'] ?>&tipo=<?= $v['tipo_vinculacion'] ?>" class="btn btn-sm btn-danger mt-auto w-auto btn-animated">
Desvincular
</a>
<?php if ($v['tipo_usuario_sistema'] === 'importador'): ?>
<button onclick="confirmUnlink(<?= $v['id_relacion'] ?>, 'importador')" class="btn btn-sm btn-danger mt-auto w-auto btn-animated">Desvincular</button>
<?php elseif ($v['tipo_usuario_sistema'] === 'agente_aduanal'): ?>
<button onclick="confirmUnlink(<?= $v['id_relacion'] ?>, 'agente')" class="btn btn-sm btn-danger mt-auto w-auto btn-animated">Desvincular</button>
<?php else: ?>
<span class="text-muted small">N/A</span>
<?php endif; ?>
@@ -120,6 +120,21 @@
}
});
});
function confirmUnlink(id, tipo) {
Swal.fire({
title: '¿Estás seguro?',
text: 'Esta acción no se puede deshacer.',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Sí, desvincular',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
window.location.href = `/IMPORTADORES/vinculaciones/desvincularAgencia?id=${id}&tipo=${tipo}`;
}
});
}
</script>
<?php if (isset($_GET['success'])): ?>

View File

@@ -103,7 +103,7 @@
<?php else: ?>
<a href="/IMPORTADORES/importadores/cambiarAgenciaActiva?id=<?= $v['id_agencia'] ?>" class="btn btn-sm btn-success mt-auto w-auto btn-animated">Usar Agencia</a>
<?php endif; ?>
<a href="/IMPORTADORES/importadores/desvincularUsuario?id=<?= $v['id_relacion'] ?>" class="btn btn-sm btn-danger mt-auto w-auto btn-animated">Desvincular</a>
<button onclick="confirmUnlink(<?= $v['id_relacion'] ?>)" class="btn btn-sm btn-danger mt-auto w-auto btn-animated">Desvincular</button>
</td>
</tr>
<?php endforeach; ?>
@@ -123,6 +123,21 @@
}
});
});
function confirmUnlink(id) {
Swal.fire({
title: '¿Estás seguro?',
text: 'Esta acción no se puede deshacer.',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Sí, desvincular',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
window.location.href = `/IMPORTADORES/importadores/desvincularUsuario?id=${id}`;
}
});
}
</script>
<?php if (isset($_GET['success'])): ?>