Patentes - Agentes Aduanales
This commit is contained in:
@@ -265,516 +265,4 @@ function bitacora()
|
|||||||
}
|
}
|
||||||
|
|
||||||
include __DIR__ . '/../../views/agentes/bitacora.php';
|
include __DIR__ . '/../../views/agentes/bitacora.php';
|
||||||
}
|
|
||||||
|
|
||||||
function lista()
|
|
||||||
{
|
|
||||||
$conn = getConnection();
|
|
||||||
$locaciones = [];
|
|
||||||
|
|
||||||
// CONSULTA CORREGIDA - Agregamos abreviatura e iso2
|
|
||||||
$sql = "
|
|
||||||
SELECT
|
|
||||||
p.id_pais, p.nombre AS nombre_pais, p.iso2, p.iso3,
|
|
||||||
e.id_estado, e.nombre AS nombre_estado, e.abreviatura,
|
|
||||||
c.id_ciudad, c.nombre AS nombre_ciudad
|
|
||||||
FROM paises p
|
|
||||||
LEFT JOIN estados e ON p.id_pais = e.pais_id
|
|
||||||
LEFT JOIN ciudades c ON e.id_estado = c.estado_id
|
|
||||||
ORDER BY p.id_pais, e.id_estado, c.id_ciudad
|
|
||||||
";
|
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn, $sql);
|
|
||||||
|
|
||||||
if (!$stmt) {
|
|
||||||
$errors = sqlsrv_errors();
|
|
||||||
error_log("Error en consulta lista(): " . print_r($errors, true));
|
|
||||||
die("Error en la consulta");
|
|
||||||
}
|
|
||||||
|
|
||||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
|
||||||
$locaciones[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Obtener países para los selects del modal
|
|
||||||
$sql_paises_select = "SELECT id_pais, nombre FROM paises ORDER BY nombre";
|
|
||||||
$stmt_paises_select = sqlsrv_query($conn, $sql_paises_select);
|
|
||||||
$paises = [];
|
|
||||||
while ($row = sqlsrv_fetch_array($stmt_paises_select, SQLSRV_FETCH_ASSOC)) {
|
|
||||||
$paises[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
include __DIR__ . '/../../views/locaciones/gestion_locaciones.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
function alta()
|
|
||||||
{
|
|
||||||
$conn = getConnection();
|
|
||||||
// 1) Cargar países
|
|
||||||
$sql = "SELECT id_pais, nombre FROM paises ORDER BY nombre";
|
|
||||||
$stmt = sqlsrv_query($conn, $sql);
|
|
||||||
$paises = [];
|
|
||||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
|
||||||
$paises[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
include __DIR__ . '/../../views/locaciones/alta_locaciones.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
// AJAX: devuelve los estados de un país dado
|
|
||||||
function estados() {
|
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
|
||||||
$pais = $_GET['pais'] ?? '';
|
|
||||||
$conn = getConnection();
|
|
||||||
$sql = "SELECT id_estado, nombre FROM estados WHERE pais_id = ? ORDER BY nombre";
|
|
||||||
$stmt = sqlsrv_query($conn, $sql, [$pais]);
|
|
||||||
$out = [];
|
|
||||||
while ($r = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
|
||||||
$out[] = $r;
|
|
||||||
}
|
|
||||||
echo json_encode($out);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Guardar nuevo estado
|
|
||||||
function guardarEstado() {
|
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Debug: Verificar qué se está recibiendo
|
|
||||||
error_log("POST data: " . print_r($_POST, true));
|
|
||||||
|
|
||||||
$pais_id = $_POST['pais'] ?? '';
|
|
||||||
$entidad = trim($_POST['entidad'] ?? '');
|
|
||||||
|
|
||||||
// Debug: Verificar valores específicos
|
|
||||||
error_log("pais_id: '$pais_id', entidad: '$entidad'");
|
|
||||||
|
|
||||||
// Validaciones más específicas
|
|
||||||
if (empty($pais_id)) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Debe seleccionar un país']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($entidad)) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Debe ingresar el nombre del estado']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn = getConnection();
|
|
||||||
|
|
||||||
// Verificar que el país existe
|
|
||||||
$sql_pais = "SELECT COUNT(*) as count FROM paises WHERE id_pais = ?";
|
|
||||||
$stmt_pais = sqlsrv_query($conn, $sql_pais, [$pais_id]);
|
|
||||||
$pais_exists = sqlsrv_fetch_array($stmt_pais, SQLSRV_FETCH_ASSOC);
|
|
||||||
|
|
||||||
if ($pais_exists['count'] == 0) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'El país seleccionado no existe']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verificar si ya existe el estado en ese país
|
|
||||||
$sql_check = "SELECT COUNT(*) as count FROM estados WHERE pais_id = ? AND nombre = ?";
|
|
||||||
$stmt_check = sqlsrv_query($conn, $sql_check, [$pais_id, $entidad]);
|
|
||||||
$exists = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
|
||||||
|
|
||||||
if ($exists['count'] > 0) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Este estado ya existe en el país seleccionado']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insertar nuevo estado
|
|
||||||
// Primero obtenemos el siguiente ID disponible
|
|
||||||
$sql_max = "SELECT ISNULL(MAX(id_estado), 0) + 1 as next_id FROM estados";
|
|
||||||
$stmt_max = sqlsrv_query($conn, $sql_max);
|
|
||||||
$next_id_row = sqlsrv_fetch_array($stmt_max, SQLSRV_FETCH_ASSOC);
|
|
||||||
$next_id = $next_id_row['next_id'];
|
|
||||||
|
|
||||||
$sql = "INSERT INTO estados (id_estado, pais_id, nombre) VALUES (?, ?, ?)";
|
|
||||||
$stmt = sqlsrv_query($conn, $sql, [$next_id, $pais_id, $entidad]);
|
|
||||||
|
|
||||||
if ($stmt) {
|
|
||||||
echo json_encode(['success' => true, 'message' => 'Estado registrado exitosamente']);
|
|
||||||
} else {
|
|
||||||
// Obtener el error específico de SQL Server
|
|
||||||
$errors = sqlsrv_errors();
|
|
||||||
$errorMessage = 'Error al registrar el estado';
|
|
||||||
if ($errors) {
|
|
||||||
$errorMessage .= ': ' . $errors[0]['message'];
|
|
||||||
}
|
|
||||||
error_log("Error SQL: " . print_r($errors, true));
|
|
||||||
echo json_encode(['success' => false, 'message' => $errorMessage]);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Guardar nueva ciudad
|
|
||||||
function guardarCiudad() {
|
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$estado_id = $_POST['entidad'] ?? '';
|
|
||||||
$ciudad = trim($_POST['ciudad'] ?? '');
|
|
||||||
|
|
||||||
// Validaciones
|
|
||||||
if (empty($estado_id) || empty($ciudad)) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Todos los campos son obligatorios']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn = getConnection();
|
|
||||||
|
|
||||||
// Verificar si ya existe la ciudad en ese estado
|
|
||||||
$sql_check = "SELECT COUNT(*) as count FROM ciudades WHERE estado_id = ? AND nombre = ?";
|
|
||||||
$stmt_check = sqlsrv_query($conn, $sql_check, [$estado_id, $ciudad]);
|
|
||||||
$exists = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
|
||||||
|
|
||||||
if ($exists['count'] > 0) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Esta ciudad ya existe en el estado seleccionado']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insertar nueva ciudad
|
|
||||||
$sql = "INSERT INTO ciudades (estado_id, nombre) VALUES (?, ?)";
|
|
||||||
$stmt = sqlsrv_query($conn, $sql, [$estado_id, $ciudad]);
|
|
||||||
|
|
||||||
if ($stmt) {
|
|
||||||
echo json_encode(['success' => true, 'message' => 'Ciudad registrada exitosamente']);
|
|
||||||
} else {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error al registrar la ciudad']);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Función para obtener país por estado (necesaria para el modal de edición de ciudades)
|
|
||||||
function obtenerPaisPorEstado() {
|
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$estado_id = $_GET['estado'] ?? '';
|
|
||||||
|
|
||||||
if (empty($estado_id)) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'ID de estado requerido']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn = getConnection();
|
|
||||||
$sql = "SELECT pais_id FROM estados WHERE id_estado = ?";
|
|
||||||
$stmt = sqlsrv_query($conn, $sql, [$estado_id]);
|
|
||||||
|
|
||||||
if ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
|
||||||
echo json_encode(['success' => true, 'pais_id' => $row['pais_id']]);
|
|
||||||
} else {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Estado no encontrado']);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCIÓN DISPATCHER PARA EDICIÓN
|
|
||||||
function editar() {
|
|
||||||
$tipo = $_POST['tipo'] ?? '';
|
|
||||||
|
|
||||||
// Log para debugging
|
|
||||||
error_log("Función editar llamada con tipo: " . $tipo);
|
|
||||||
error_log("POST data: " . print_r($_POST, true));
|
|
||||||
|
|
||||||
switch ($tipo) {
|
|
||||||
case 'pais':
|
|
||||||
actualizarPais();
|
|
||||||
break;
|
|
||||||
case 'estado':
|
|
||||||
actualizarEstado();
|
|
||||||
break;
|
|
||||||
case 'ciudad':
|
|
||||||
actualizarCiudad();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Tipo de elemento no válido: ' . $tipo]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCIÓN ESPECÍFICA PARA ACTUALIZAR PAÍSES
|
|
||||||
function actualizarPais() {
|
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$id = $_POST['id'] ?? '';
|
|
||||||
$nombre = trim($_POST['nombre'] ?? '');
|
|
||||||
$iso2 = trim($_POST['iso2'] ?? '');
|
|
||||||
$iso3 = trim($_POST['iso3'] ?? '');
|
|
||||||
|
|
||||||
// Validaciones
|
|
||||||
if (empty($id) || empty($nombre)) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'ID y nombre del país son obligatorios']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn = getConnection();
|
|
||||||
if (!$conn) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error de conexión a la base de datos']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verificar duplicados
|
|
||||||
$sql_check = "SELECT COUNT(*) as count FROM paises WHERE nombre = ? AND id_pais != ?";
|
|
||||||
$stmt_check = sqlsrv_query($conn, $sql_check, [$nombre, $id]);
|
|
||||||
|
|
||||||
if (!$stmt_check) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error al verificar duplicados']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$exists = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
|
||||||
if ($exists['count'] > 0) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Ya existe otro país con este nombre']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actualizar
|
|
||||||
$iso2_val = empty($iso2) ? null : $iso2;
|
|
||||||
$iso3_val = empty($iso3) ? null : $iso3;
|
|
||||||
|
|
||||||
$sql = "UPDATE paises SET nombre = ?, iso2 = ?, iso3 = ? WHERE id_pais = ?";
|
|
||||||
$params = [$nombre, $iso2_val, $iso3_val, $id];
|
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn, $sql, $params);
|
|
||||||
|
|
||||||
if ($stmt && sqlsrv_rows_affected($stmt) > 0) {
|
|
||||||
echo json_encode(['success' => true, 'message' => 'País actualizado exitosamente']);
|
|
||||||
} else {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'No se pudo actualizar el país']);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCIÓN ESPECÍFICA PARA ACTUALIZAR ESTADOS
|
|
||||||
function actualizarEstado() {
|
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$id = $_POST['id'] ?? '';
|
|
||||||
$nombre = trim($_POST['nombre'] ?? '');
|
|
||||||
$abreviatura = trim($_POST['abreviatura'] ?? '');
|
|
||||||
$pais_id = $_POST['pais_id'] ?? '';
|
|
||||||
|
|
||||||
// Validaciones
|
|
||||||
if (empty($id) || empty($nombre) || empty($pais_id)) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'ID, nombre del estado y país son obligatorios']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn = getConnection();
|
|
||||||
if (!$conn) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error de conexión a la base de datos']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verificar duplicados
|
|
||||||
$sql_check = "SELECT COUNT(*) as count FROM estados WHERE nombre = ? AND pais_id = ? AND id_estado != ?";
|
|
||||||
$stmt_check = sqlsrv_query($conn, $sql_check, [$nombre, $pais_id, $id]);
|
|
||||||
|
|
||||||
if (!$stmt_check) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error al verificar duplicados']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$exists = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
|
||||||
if ($exists['count'] > 0) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Ya existe otro estado con este nombre en el país seleccionado']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actualizar
|
|
||||||
$abreviatura_val = empty($abreviatura) ? null : $abreviatura;
|
|
||||||
|
|
||||||
$sql = "UPDATE estados SET nombre = ?, abreviatura = ?, pais_id = ? WHERE id_estado = ?";
|
|
||||||
$params = [$nombre, $abreviatura_val, $pais_id, $id];
|
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn, $sql, $params);
|
|
||||||
|
|
||||||
if ($stmt && sqlsrv_rows_affected($stmt) > 0) {
|
|
||||||
echo json_encode(['success' => true, 'message' => 'Estado actualizado exitosamente']);
|
|
||||||
} else {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'No se pudo actualizar el estado']);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCIÓN ESPECÍFICA PARA ACTUALIZAR CIUDADES
|
|
||||||
function actualizarCiudad() {
|
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$id = $_POST['id'] ?? '';
|
|
||||||
$nombre = trim($_POST['nombre'] ?? '');
|
|
||||||
$estado_id = $_POST['estado_id'] ?? '';
|
|
||||||
|
|
||||||
// Validaciones
|
|
||||||
if (empty($id) || empty($nombre) || empty($estado_id)) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'ID, nombre de la ciudad y estado son obligatorios']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn = getConnection();
|
|
||||||
if (!$conn) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error de conexión a la base de datos']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verificar duplicados
|
|
||||||
$sql_check = "SELECT COUNT(*) as count FROM ciudades WHERE nombre = ? AND estado_id = ? AND id_ciudad != ?";
|
|
||||||
$stmt_check = sqlsrv_query($conn, $sql_check, [$nombre, $estado_id, $id]);
|
|
||||||
|
|
||||||
if (!$stmt_check) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error al verificar duplicados']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$exists = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
|
||||||
if ($exists['count'] > 0) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Ya existe otra ciudad con este nombre en el estado seleccionado']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actualizar
|
|
||||||
$sql = "UPDATE ciudades SET nombre = ?, estado_id = ? WHERE id_ciudad = ?";
|
|
||||||
$params = [$nombre, $estado_id, $id];
|
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn, $sql, $params);
|
|
||||||
|
|
||||||
if ($stmt && sqlsrv_rows_affected($stmt) > 0) {
|
|
||||||
echo json_encode(['success' => true, 'message' => 'Ciudad actualizada exitosamente']);
|
|
||||||
} else {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'No se pudo actualizar la ciudad']);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Función para eliminar locaciones (países, estados, ciudades)
|
|
||||||
function eliminar() {
|
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Obtener datos del JSON enviado
|
|
||||||
$input = json_decode(file_get_contents('php://input'), true);
|
|
||||||
$tipo = $input['tipo'] ?? '';
|
|
||||||
$id = $input['id'] ?? '';
|
|
||||||
|
|
||||||
if (empty($tipo) || empty($id)) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Datos incompletos']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn = getConnection();
|
|
||||||
|
|
||||||
switch ($tipo) {
|
|
||||||
case 'pais':
|
|
||||||
// Verificar si el país tiene estados asociados
|
|
||||||
$sql_check = "SELECT COUNT(*) as count FROM estados WHERE pais_id = ?";
|
|
||||||
$stmt_check = sqlsrv_query($conn, $sql_check, [$id]);
|
|
||||||
$has_estados = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
|
||||||
|
|
||||||
if ($has_estados['count'] > 0) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'No se puede eliminar el país porque tiene estados asociados']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Eliminar país
|
|
||||||
$sql = "DELETE FROM paises WHERE id_pais = ?";
|
|
||||||
$stmt = sqlsrv_query($conn, $sql, [$id]);
|
|
||||||
|
|
||||||
if ($stmt) {
|
|
||||||
echo json_encode(['success' => true, 'message' => 'País eliminado exitosamente']);
|
|
||||||
} else {
|
|
||||||
$errors = sqlsrv_errors();
|
|
||||||
$errorMessage = 'Error al eliminar el país';
|
|
||||||
if ($errors) {
|
|
||||||
$errorMessage .= ': ' . $errors[0]['message'];
|
|
||||||
}
|
|
||||||
echo json_encode(['success' => false, 'message' => $errorMessage]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'estado':
|
|
||||||
// Verificar si el estado tiene ciudades asociadas
|
|
||||||
$sql_check = "SELECT COUNT(*) as count FROM ciudades WHERE estado_id = ?";
|
|
||||||
$stmt_check = sqlsrv_query($conn, $sql_check, [$id]);
|
|
||||||
$has_ciudades = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
|
||||||
|
|
||||||
if ($has_ciudades['count'] > 0) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'No se puede eliminar el estado porque tiene ciudades asociadas']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Eliminar estado
|
|
||||||
$sql = "DELETE FROM estados WHERE id_estado = ?";
|
|
||||||
$stmt = sqlsrv_query($conn, $sql, [$id]);
|
|
||||||
|
|
||||||
if ($stmt) {
|
|
||||||
echo json_encode(['success' => true, 'message' => 'Estado eliminado exitosamente']);
|
|
||||||
} else {
|
|
||||||
$errors = sqlsrv_errors();
|
|
||||||
$errorMessage = 'Error al eliminar el estado';
|
|
||||||
if ($errors) {
|
|
||||||
$errorMessage .= ': ' . $errors[0]['message'];
|
|
||||||
}
|
|
||||||
echo json_encode(['success' => false, 'message' => $errorMessage]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'ciudad':
|
|
||||||
// Verificar si la ciudad está siendo utilizada en alguna relación
|
|
||||||
// (aquí puedes agregar más verificaciones según tu modelo de datos)
|
|
||||||
|
|
||||||
// Eliminar ciudad
|
|
||||||
$sql = "DELETE FROM ciudades WHERE id_ciudad = ?";
|
|
||||||
$stmt = sqlsrv_query($conn, $sql, [$id]);
|
|
||||||
|
|
||||||
if ($stmt) {
|
|
||||||
echo json_encode(['success' => true, 'message' => 'Ciudad eliminada exitosamente']);
|
|
||||||
} else {
|
|
||||||
$errors = sqlsrv_errors();
|
|
||||||
$errorMessage = 'Error al eliminar la ciudad';
|
|
||||||
if ($errors) {
|
|
||||||
$errorMessage .= ': ' . $errors[0]['message'];
|
|
||||||
}
|
|
||||||
echo json_encode(['success' => false, 'message' => $errorMessage]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Tipo de elemento no válido']);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
9
app/controllers/automatizaciones.php
Normal file
9
app/controllers/automatizaciones.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../helpers/session.php';
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
require_once __DIR__ . '/../helpers/crypto.php';
|
||||||
|
|
||||||
|
function index()
|
||||||
|
{
|
||||||
|
include __DIR__ . '/../../views/automatizaciones/automatizaciones.php';
|
||||||
|
}
|
||||||
@@ -167,9 +167,7 @@ function editar() {
|
|||||||
include __DIR__ . '/../../views/choferes/editar.php';
|
include __DIR__ . '/../../views/choferes/editar.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Procesa la actualización de un chofer **/
|
||||||
* Procesa la actualización de un chofer
|
|
||||||
*/
|
|
||||||
function actualizar() {
|
function actualizar() {
|
||||||
if (!($_SESSION['usuario_id'] ?? false)) {
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
die("⚠️ No autorizado.");
|
die("⚠️ No autorizado.");
|
||||||
@@ -274,9 +272,7 @@ function actualizar() {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** “Soft-delete” (status = 0) de un chofer **/
|
||||||
* “Soft-delete” (status = 0) de un chofer
|
|
||||||
*/
|
|
||||||
function eliminar() {
|
function eliminar() {
|
||||||
if (!($_SESSION['usuario_id'] ?? false)) {
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
header('Location: /IMPORTADORES/login');
|
header('Location: /IMPORTADORES/login');
|
||||||
@@ -302,4 +298,4 @@ function eliminar() {
|
|||||||
|
|
||||||
header('Location: /IMPORTADORES/choferes/lista?deleted=ok');
|
header('Location: /IMPORTADORES/choferes/lista?deleted=ok');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -164,9 +164,4 @@ function guardar()
|
|||||||
sqlsrv_rollback($conn);
|
sqlsrv_rollback($conn);
|
||||||
die("Error al actualizar datos: " . $e->getMessage());
|
die("Error al actualizar datos: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function automatizaciones()
|
|
||||||
{
|
|
||||||
include __DIR__ . '/../../views/configuracion/automatizaciones.php';
|
|
||||||
}
|
}
|
||||||
520
app/controllers/locaciones.php
Normal file
520
app/controllers/locaciones.php
Normal file
@@ -0,0 +1,520 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../helpers/session.php';
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
require_once __DIR__ . '/../helpers/crypto.php';
|
||||||
|
require_once __DIR__ . '/../helpers/bitacoras.php';
|
||||||
|
require_once __DIR__ . '/../helpers/env.php';
|
||||||
|
|
||||||
|
function lista()
|
||||||
|
{
|
||||||
|
$conn = getConnection();
|
||||||
|
$locaciones = [];
|
||||||
|
|
||||||
|
// CONSULTA CORREGIDA - Agregamos abreviatura e iso2
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
p.id_pais, p.nombre AS nombre_pais, p.iso2, p.iso3,
|
||||||
|
e.id_estado, e.nombre AS nombre_estado, e.abreviatura,
|
||||||
|
c.id_ciudad, c.nombre AS nombre_ciudad
|
||||||
|
FROM paises p
|
||||||
|
LEFT JOIN estados e ON p.id_pais = e.pais_id
|
||||||
|
LEFT JOIN ciudades c ON e.id_estado = c.estado_id
|
||||||
|
ORDER BY p.id_pais, e.id_estado, c.id_ciudad
|
||||||
|
";
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
|
||||||
|
if (!$stmt) {
|
||||||
|
$errors = sqlsrv_errors();
|
||||||
|
error_log("Error en consulta lista(): " . print_r($errors, true));
|
||||||
|
die("Error en la consulta");
|
||||||
|
}
|
||||||
|
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$locaciones[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtener países para los selects del modal
|
||||||
|
$sql_paises_select = "SELECT id_pais, nombre FROM paises ORDER BY nombre";
|
||||||
|
$stmt_paises_select = sqlsrv_query($conn, $sql_paises_select);
|
||||||
|
$paises = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt_paises_select, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$paises[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/locaciones/gestion_locaciones.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
function alta()
|
||||||
|
{
|
||||||
|
$conn = getConnection();
|
||||||
|
// 1) Cargar países
|
||||||
|
$sql = "SELECT id_pais, nombre FROM paises ORDER BY nombre";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
$paises = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$paises[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/locaciones/alta_locaciones.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// AJAX: devuelve los estados de un país dado
|
||||||
|
function estados() {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
$pais = $_GET['pais'] ?? '';
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "SELECT id_estado, nombre FROM estados WHERE pais_id = ? ORDER BY nombre";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$pais]);
|
||||||
|
$out = [];
|
||||||
|
while ($r = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$out[] = $r;
|
||||||
|
}
|
||||||
|
echo json_encode($out);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Guardar nuevo estado
|
||||||
|
function guardarEstado() {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Debug: Verificar qué se está recibiendo
|
||||||
|
error_log("POST data: " . print_r($_POST, true));
|
||||||
|
|
||||||
|
$pais_id = $_POST['pais'] ?? '';
|
||||||
|
$entidad = trim($_POST['entidad'] ?? '');
|
||||||
|
|
||||||
|
// Debug: Verificar valores específicos
|
||||||
|
error_log("pais_id: '$pais_id', entidad: '$entidad'");
|
||||||
|
|
||||||
|
// Validaciones más específicas
|
||||||
|
if (empty($pais_id)) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Debe seleccionar un país']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($entidad)) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Debe ingresar el nombre del estado']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// Verificar que el país existe
|
||||||
|
$sql_pais = "SELECT COUNT(*) as count FROM paises WHERE id_pais = ?";
|
||||||
|
$stmt_pais = sqlsrv_query($conn, $sql_pais, [$pais_id]);
|
||||||
|
$pais_exists = sqlsrv_fetch_array($stmt_pais, SQLSRV_FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($pais_exists['count'] == 0) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'El país seleccionado no existe']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verificar si ya existe el estado en ese país
|
||||||
|
$sql_check = "SELECT COUNT(*) as count FROM estados WHERE pais_id = ? AND nombre = ?";
|
||||||
|
$stmt_check = sqlsrv_query($conn, $sql_check, [$pais_id, $entidad]);
|
||||||
|
$exists = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($exists['count'] > 0) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Este estado ya existe en el país seleccionado']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insertar nuevo estado
|
||||||
|
// Primero obtenemos el siguiente ID disponible
|
||||||
|
$sql_max = "SELECT ISNULL(MAX(id_estado), 0) + 1 as next_id FROM estados";
|
||||||
|
$stmt_max = sqlsrv_query($conn, $sql_max);
|
||||||
|
$next_id_row = sqlsrv_fetch_array($stmt_max, SQLSRV_FETCH_ASSOC);
|
||||||
|
$next_id = $next_id_row['next_id'];
|
||||||
|
|
||||||
|
$sql = "INSERT INTO estados (id_estado, pais_id, nombre) VALUES (?, ?, ?)";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$next_id, $pais_id, $entidad]);
|
||||||
|
|
||||||
|
if ($stmt) {
|
||||||
|
echo json_encode(['success' => true, 'message' => 'Estado registrado exitosamente']);
|
||||||
|
} else {
|
||||||
|
// Obtener el error específico de SQL Server
|
||||||
|
$errors = sqlsrv_errors();
|
||||||
|
$errorMessage = 'Error al registrar el estado';
|
||||||
|
if ($errors) {
|
||||||
|
$errorMessage .= ': ' . $errors[0]['message'];
|
||||||
|
}
|
||||||
|
error_log("Error SQL: " . print_r($errors, true));
|
||||||
|
echo json_encode(['success' => false, 'message' => $errorMessage]);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Guardar nueva ciudad
|
||||||
|
function guardarCiudad() {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$estado_id = $_POST['entidad'] ?? '';
|
||||||
|
$ciudad = trim($_POST['ciudad'] ?? '');
|
||||||
|
|
||||||
|
// Validaciones
|
||||||
|
if (empty($estado_id) || empty($ciudad)) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Todos los campos son obligatorios']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// Verificar si ya existe la ciudad en ese estado
|
||||||
|
$sql_check = "SELECT COUNT(*) as count FROM ciudades WHERE estado_id = ? AND nombre = ?";
|
||||||
|
$stmt_check = sqlsrv_query($conn, $sql_check, [$estado_id, $ciudad]);
|
||||||
|
$exists = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($exists['count'] > 0) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Esta ciudad ya existe en el estado seleccionado']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insertar nueva ciudad
|
||||||
|
$sql = "INSERT INTO ciudades (estado_id, nombre) VALUES (?, ?)";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$estado_id, $ciudad]);
|
||||||
|
|
||||||
|
if ($stmt) {
|
||||||
|
echo json_encode(['success' => true, 'message' => 'Ciudad registrada exitosamente']);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error al registrar la ciudad']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Función para obtener país por estado (necesaria para el modal de edición de ciudades)
|
||||||
|
function obtenerPaisPorEstado() {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$estado_id = $_GET['estado'] ?? '';
|
||||||
|
|
||||||
|
if (empty($estado_id)) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'ID de estado requerido']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "SELECT pais_id FROM estados WHERE id_estado = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$estado_id]);
|
||||||
|
|
||||||
|
if ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
echo json_encode(['success' => true, 'pais_id' => $row['pais_id']]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Estado no encontrado']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCIÓN DISPATCHER PARA EDICIÓN
|
||||||
|
function editar() {
|
||||||
|
$tipo = $_POST['tipo'] ?? '';
|
||||||
|
|
||||||
|
// Log para debugging
|
||||||
|
error_log("Función editar llamada con tipo: " . $tipo);
|
||||||
|
error_log("POST data: " . print_r($_POST, true));
|
||||||
|
|
||||||
|
switch ($tipo) {
|
||||||
|
case 'pais':
|
||||||
|
actualizarPais();
|
||||||
|
break;
|
||||||
|
case 'estado':
|
||||||
|
actualizarEstado();
|
||||||
|
break;
|
||||||
|
case 'ciudad':
|
||||||
|
actualizarCiudad();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Tipo de elemento no válido: ' . $tipo]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCIÓN ESPECÍFICA PARA ACTUALIZAR PAÍSES
|
||||||
|
function actualizarPais() {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$id = $_POST['id'] ?? '';
|
||||||
|
$nombre = trim($_POST['nombre'] ?? '');
|
||||||
|
$iso2 = trim($_POST['iso2'] ?? '');
|
||||||
|
$iso3 = trim($_POST['iso3'] ?? '');
|
||||||
|
|
||||||
|
// Validaciones
|
||||||
|
if (empty($id) || empty($nombre)) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'ID y nombre del país son obligatorios']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
if (!$conn) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error de conexión a la base de datos']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verificar duplicados
|
||||||
|
$sql_check = "SELECT COUNT(*) as count FROM paises WHERE nombre = ? AND id_pais != ?";
|
||||||
|
$stmt_check = sqlsrv_query($conn, $sql_check, [$nombre, $id]);
|
||||||
|
|
||||||
|
if (!$stmt_check) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error al verificar duplicados']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$exists = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
||||||
|
if ($exists['count'] > 0) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Ya existe otro país con este nombre']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actualizar
|
||||||
|
$iso2_val = empty($iso2) ? null : $iso2;
|
||||||
|
$iso3_val = empty($iso3) ? null : $iso3;
|
||||||
|
|
||||||
|
$sql = "UPDATE paises SET nombre = ?, iso2 = ?, iso3 = ? WHERE id_pais = ?";
|
||||||
|
$params = [$nombre, $iso2_val, $iso3_val, $id];
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
|
||||||
|
if ($stmt && sqlsrv_rows_affected($stmt) > 0) {
|
||||||
|
echo json_encode(['success' => true, 'message' => 'País actualizado exitosamente']);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'No se pudo actualizar el país']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCIÓN ESPECÍFICA PARA ACTUALIZAR ESTADOS
|
||||||
|
function actualizarEstado() {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$id = $_POST['id'] ?? '';
|
||||||
|
$nombre = trim($_POST['nombre'] ?? '');
|
||||||
|
$abreviatura = trim($_POST['abreviatura'] ?? '');
|
||||||
|
$pais_id = $_POST['pais_id'] ?? '';
|
||||||
|
|
||||||
|
// Validaciones
|
||||||
|
if (empty($id) || empty($nombre) || empty($pais_id)) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'ID, nombre del estado y país son obligatorios']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
if (!$conn) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error de conexión a la base de datos']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verificar duplicados
|
||||||
|
$sql_check = "SELECT COUNT(*) as count FROM estados WHERE nombre = ? AND pais_id = ? AND id_estado != ?";
|
||||||
|
$stmt_check = sqlsrv_query($conn, $sql_check, [$nombre, $pais_id, $id]);
|
||||||
|
|
||||||
|
if (!$stmt_check) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error al verificar duplicados']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$exists = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
||||||
|
if ($exists['count'] > 0) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Ya existe otro estado con este nombre en el país seleccionado']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actualizar
|
||||||
|
$abreviatura_val = empty($abreviatura) ? null : $abreviatura;
|
||||||
|
|
||||||
|
$sql = "UPDATE estados SET nombre = ?, abreviatura = ?, pais_id = ? WHERE id_estado = ?";
|
||||||
|
$params = [$nombre, $abreviatura_val, $pais_id, $id];
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
|
||||||
|
if ($stmt && sqlsrv_rows_affected($stmt) > 0) {
|
||||||
|
echo json_encode(['success' => true, 'message' => 'Estado actualizado exitosamente']);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'No se pudo actualizar el estado']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCIÓN ESPECÍFICA PARA ACTUALIZAR CIUDADES
|
||||||
|
function actualizarCiudad() {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$id = $_POST['id'] ?? '';
|
||||||
|
$nombre = trim($_POST['nombre'] ?? '');
|
||||||
|
$estado_id = $_POST['estado_id'] ?? '';
|
||||||
|
|
||||||
|
// Validaciones
|
||||||
|
if (empty($id) || empty($nombre) || empty($estado_id)) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'ID, nombre de la ciudad y estado son obligatorios']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
if (!$conn) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error de conexión a la base de datos']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verificar duplicados
|
||||||
|
$sql_check = "SELECT COUNT(*) as count FROM ciudades WHERE nombre = ? AND estado_id = ? AND id_ciudad != ?";
|
||||||
|
$stmt_check = sqlsrv_query($conn, $sql_check, [$nombre, $estado_id, $id]);
|
||||||
|
|
||||||
|
if (!$stmt_check) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error al verificar duplicados']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$exists = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
||||||
|
if ($exists['count'] > 0) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Ya existe otra ciudad con este nombre en el estado seleccionado']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actualizar
|
||||||
|
$sql = "UPDATE ciudades SET nombre = ?, estado_id = ? WHERE id_ciudad = ?";
|
||||||
|
$params = [$nombre, $estado_id, $id];
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
|
||||||
|
if ($stmt && sqlsrv_rows_affected($stmt) > 0) {
|
||||||
|
echo json_encode(['success' => true, 'message' => 'Ciudad actualizada exitosamente']);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'No se pudo actualizar la ciudad']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Función para eliminar locaciones (países, estados, ciudades)
|
||||||
|
function eliminar() {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Obtener datos del JSON enviado
|
||||||
|
$input = json_decode(file_get_contents('php://input'), true);
|
||||||
|
$tipo = $input['tipo'] ?? '';
|
||||||
|
$id = $input['id'] ?? '';
|
||||||
|
|
||||||
|
if (empty($tipo) || empty($id)) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Datos incompletos']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
switch ($tipo) {
|
||||||
|
case 'pais':
|
||||||
|
// Verificar si el país tiene estados asociados
|
||||||
|
$sql_check = "SELECT COUNT(*) as count FROM estados WHERE pais_id = ?";
|
||||||
|
$stmt_check = sqlsrv_query($conn, $sql_check, [$id]);
|
||||||
|
$has_estados = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($has_estados['count'] > 0) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'No se puede eliminar el país porque tiene estados asociados']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Eliminar país
|
||||||
|
$sql = "DELETE FROM paises WHERE id_pais = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$id]);
|
||||||
|
|
||||||
|
if ($stmt) {
|
||||||
|
echo json_encode(['success' => true, 'message' => 'País eliminado exitosamente']);
|
||||||
|
} else {
|
||||||
|
$errors = sqlsrv_errors();
|
||||||
|
$errorMessage = 'Error al eliminar el país';
|
||||||
|
if ($errors) {
|
||||||
|
$errorMessage .= ': ' . $errors[0]['message'];
|
||||||
|
}
|
||||||
|
echo json_encode(['success' => false, 'message' => $errorMessage]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'estado':
|
||||||
|
// Verificar si el estado tiene ciudades asociadas
|
||||||
|
$sql_check = "SELECT COUNT(*) as count FROM ciudades WHERE estado_id = ?";
|
||||||
|
$stmt_check = sqlsrv_query($conn, $sql_check, [$id]);
|
||||||
|
$has_ciudades = sqlsrv_fetch_array($stmt_check, SQLSRV_FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($has_ciudades['count'] > 0) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'No se puede eliminar el estado porque tiene ciudades asociadas']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Eliminar estado
|
||||||
|
$sql = "DELETE FROM estados WHERE id_estado = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$id]);
|
||||||
|
|
||||||
|
if ($stmt) {
|
||||||
|
echo json_encode(['success' => true, 'message' => 'Estado eliminado exitosamente']);
|
||||||
|
} else {
|
||||||
|
$errors = sqlsrv_errors();
|
||||||
|
$errorMessage = 'Error al eliminar el estado';
|
||||||
|
if ($errors) {
|
||||||
|
$errorMessage .= ': ' . $errors[0]['message'];
|
||||||
|
}
|
||||||
|
echo json_encode(['success' => false, 'message' => $errorMessage]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ciudad':
|
||||||
|
// Verificar si la ciudad está siendo utilizada en alguna relación
|
||||||
|
// (aquí puedes agregar más verificaciones según tu modelo de datos)
|
||||||
|
|
||||||
|
// Eliminar ciudad
|
||||||
|
$sql = "DELETE FROM ciudades WHERE id_ciudad = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$id]);
|
||||||
|
|
||||||
|
if ($stmt) {
|
||||||
|
echo json_encode(['success' => true, 'message' => 'Ciudad eliminada exitosamente']);
|
||||||
|
} else {
|
||||||
|
$errors = sqlsrv_errors();
|
||||||
|
$errorMessage = 'Error al eliminar la ciudad';
|
||||||
|
if ($errors) {
|
||||||
|
$errorMessage .= ': ' . $errors[0]['message'];
|
||||||
|
}
|
||||||
|
echo json_encode(['success' => false, 'message' => $errorMessage]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Tipo de elemento no válido']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
@@ -306,7 +306,7 @@ function enviarCodigo()
|
|||||||
|
|
||||||
$emailEncrypted = encrypt($email);
|
$emailEncrypted = encrypt($email);
|
||||||
|
|
||||||
$sql = "SELECT id_usuario FROM usuarios_sistema WHERE email = ?";
|
$sql = "SELECT id_usuario, activo FROM usuarios_sistema WHERE email = ?";
|
||||||
$stmt = sqlsrv_query($conn, $sql, [$emailEncrypted]);
|
$stmt = sqlsrv_query($conn, $sql, [$emailEncrypted]);
|
||||||
|
|
||||||
if (!$stmt || !($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC))) {
|
if (!$stmt || !($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC))) {
|
||||||
@@ -314,6 +314,13 @@ function enviarCodigo()
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$id_usuario = $row['id_usuario'];
|
$id_usuario = $row['id_usuario'];
|
||||||
|
$activo = $row['activo'];
|
||||||
|
|
||||||
|
// Validación del estado de la cuenta
|
||||||
|
if ($activo != 1) {
|
||||||
|
echo json_encode(['success' => false, 'message' => '❌ Tu cuenta está inactiva. Contacta a tu Agente Aduanal.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$now = (new DateTime())->format('Y-m-d H:i:s');
|
$now = (new DateTime())->format('Y-m-d H:i:s');
|
||||||
$sqlCheck = "SELECT COUNT(*) AS total FROM recuperacion_password
|
$sqlCheck = "SELECT COUNT(*) AS total FROM recuperacion_password
|
||||||
@@ -374,7 +381,7 @@ function enviarCodigo()
|
|||||||
<p>Este código expirará en 10 minutos.</p>
|
<p>Este código expirará en 10 minutos.</p>
|
||||||
</div>
|
</div>
|
||||||
<div style='background: #e9ecef; text-align: center; padding: 15px; font-size: 13px; color: #666;'>
|
<div style='background: #e9ecef; text-align: center; padding: 15px; font-size: 13px; color: #666;'>
|
||||||
© " . date('Y') . " SIIH · Desarrollado por AduanaSoft
|
© " . date('Y') . " SIIH · Sistema Integral para Importadores de Hidrocarburos
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>";
|
</div>";
|
||||||
@@ -433,7 +440,7 @@ function enviarCorreoRespaldo($conn, $id_usuario, $codigo)
|
|||||||
<p>Si no lo solicitaste, ignora este mensaje.</p>
|
<p>Si no lo solicitaste, ignora este mensaje.</p>
|
||||||
</div>
|
</div>
|
||||||
<div style='background: #e9ecef; text-align: center; padding: 15px; font-size: 13px; color: #666;'>
|
<div style='background: #e9ecef; text-align: center; padding: 15px; font-size: 13px; color: #666;'>
|
||||||
© " . date('Y') . " SIIH · Desarrollado por AduanaSoft
|
© " . date('Y') . " SIIH · Sistema Integral para Importadores de Hidrocarburos
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>";
|
</div>";
|
||||||
@@ -1094,7 +1101,7 @@ function cambiarPassword()
|
|||||||
<p>Si tú no realizaste esta acción, te recomendamos restablecer tu contraseña inmediatamente o contactar al área de soporte.</p>
|
<p>Si tú no realizaste esta acción, te recomendamos restablecer tu contraseña inmediatamente o contactar al área de soporte.</p>
|
||||||
</div>
|
</div>
|
||||||
<div style='background: #e9ecef; text-align: center; padding: 15px; font-size: 13px; color: #666;'>
|
<div style='background: #e9ecef; text-align: center; padding: 15px; font-size: 13px; color: #666;'>
|
||||||
© " . date('Y') . " SIIH · Desarrollado por AduanaSoft
|
© " . date('Y') . " SIIH · Sistema Integral para Importadores de Hidrocarburos
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>";
|
</div>";
|
||||||
|
|||||||
310
app/controllers/patente.php
Normal file
310
app/controllers/patente.php
Normal file
@@ -0,0 +1,310 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../helpers/session.php';
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
require_once __DIR__ . '/../helpers/crypto.php';
|
||||||
|
require_once __DIR__ . '/../helpers/bitacoras.php';
|
||||||
|
require_once __DIR__ . '/../helpers/env.php';
|
||||||
|
|
||||||
|
function dashboard()
|
||||||
|
{
|
||||||
|
include __DIR__ . '/../../views/patente/dashboard_patente.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
function lista()
|
||||||
|
{
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
aa.*
|
||||||
|
FROM dbo.agentes_aduanales aa
|
||||||
|
JOIN dbo.usuarios_sistema u
|
||||||
|
ON aa.id_usuario = u.id_usuario
|
||||||
|
WHERE u.id_usuario = ?
|
||||||
|
AND aa.activo = 1
|
||||||
|
ORDER BY aa.creado_en DESC
|
||||||
|
";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$usr]);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("Error en lista(): " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
$agentes_aduanales = [];
|
||||||
|
while ($r = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$agentes_aduanales[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/patente/lista.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
function alta()
|
||||||
|
{
|
||||||
|
include __DIR__ . '/../../views/patente/alta_patente.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
function guardar()
|
||||||
|
{
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// Capturar campos del formulario - Datos generales
|
||||||
|
$aduana = trim($_POST['aduana'] ?? '');
|
||||||
|
$patente = trim($_POST['patente'] ?? '');
|
||||||
|
$agente_aduanal = trim($_POST['agente_aduanal'] ?? '');
|
||||||
|
$rfc = trim($_POST['rfc'] ?? '');
|
||||||
|
$curp = trim($_POST['curp'] ?? '');
|
||||||
|
$razon_social = trim($_POST['razon_social'] ?? '');
|
||||||
|
$id_usuario = $_SESSION['usuario_id'];
|
||||||
|
|
||||||
|
$mf_nombre = trim($_POST['mf_nombre'] ?? '');
|
||||||
|
$mf_paterno = trim($_POST['mf_paterno'] ?? '');
|
||||||
|
$mf_materno = trim($_POST['mf_materno'] ?? '');
|
||||||
|
|
||||||
|
$vp_inicio = (int)($_POST['vp_inicio'] ?? 0);
|
||||||
|
$vp_final = (int)($_POST['vp_final'] ?? 0);
|
||||||
|
$vp_siguiente = (int)($_POST['vp_siguiente'] ?? 0);
|
||||||
|
|
||||||
|
$vpe_inicio = (int)($_POST['vpe_inicio'] ?? 0);
|
||||||
|
$vpe_final = (int)($_POST['vpe_final'] ?? 0);
|
||||||
|
$vpe_siguiente = (int)($_POST['vpe_siguiente'] ?? 0);
|
||||||
|
|
||||||
|
$vat_pb_inicio = (int)($_POST['vat_pb_inicio'] ?? 0);
|
||||||
|
$vat_pb_final = (int)($_POST['vat_pb_final'] ?? 0);
|
||||||
|
$vat_pb_siguiente = (int)($_POST['vat_pb_siguiente'] ?? 0);
|
||||||
|
|
||||||
|
$vcc_inicio = (int)($_POST['vcc_inicio'] ?? 0);
|
||||||
|
$vcc_final = (int)($_POST['vcc_final'] ?? 0);
|
||||||
|
$vcc_siguiente = (int)($_POST['vcc_siguiente'] ?? 0);
|
||||||
|
|
||||||
|
$vae_inicio = (int)($_POST['vae_inicio'] ?? 0);
|
||||||
|
$vae_final = (int)($_POST['vae_final'] ?? 0);
|
||||||
|
$vae_siguiente = (int)($_POST['vae_siguiente'] ?? 0);
|
||||||
|
|
||||||
|
// Validaciones generales
|
||||||
|
if (empty($aduana) || empty($patente) || empty($agente_aduanal) || empty($rfc) || empty($curp) || empty($razon_social)) {
|
||||||
|
die("❌ Todos los campos obligatorios deben ser completados.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_numeric($aduana) || strlen($aduana) > 3) die("❌ La aduana debe ser numérica y máximo 3 dígitos.");
|
||||||
|
if (!is_numeric($patente) || strlen($patente) > 4) die("❌ La patente debe ser numérica y máximo 4 dígitos.");
|
||||||
|
if (strlen($rfc) > 13) die("❌ El RFC no puede exceder 13 caracteres.");
|
||||||
|
if (strlen($curp) > 18) die("❌ El CURP no puede exceder 18 caracteres.");
|
||||||
|
|
||||||
|
// Validar duplicado para este usuario
|
||||||
|
$sqlCheck = "SELECT COUNT(*) as count FROM dbo.agentes_aduanales WHERE aduana = ? AND patente = ? AND id_usuario = ?";
|
||||||
|
$stmtCheck = sqlsrv_query($conn, $sqlCheck, [$aduana, $patente, $id_usuario]);
|
||||||
|
|
||||||
|
if ($stmtCheck === false) die("❌ Error al verificar duplicados: " . print_r(sqlsrv_errors(), true));
|
||||||
|
|
||||||
|
$row = sqlsrv_fetch_array($stmtCheck, SQLSRV_FETCH_ASSOC);
|
||||||
|
if ($row['count'] > 0) die("❌ Ya existe un agente aduanal con esta combinación de aduana y patente.");
|
||||||
|
|
||||||
|
sqlsrv_free_stmt($stmtCheck);
|
||||||
|
|
||||||
|
// Insertar registro
|
||||||
|
$sql = "INSERT INTO dbo.agentes_aduanales
|
||||||
|
(aduana, patente, agente_aduanal, rfc, curp, razon_social, id_usuario, activo,
|
||||||
|
mf_nombre, mf_paterno, mf_materno,
|
||||||
|
vp_inicio, vp_final, vp_siguiente,
|
||||||
|
vpe_inicio, vpe_final, vpe_siguiente,
|
||||||
|
vat_pb_inicio, vat_pb_final, vat_pb_siguiente,
|
||||||
|
vcc_inicio, vcc_final, vcc_siguiente,
|
||||||
|
vae_inicio, vae_final, vae_siguiente)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
$aduana, $patente, $agente_aduanal, $rfc, $curp, $razon_social, $id_usuario,
|
||||||
|
$mf_nombre, $mf_paterno, $mf_materno,
|
||||||
|
$vp_inicio, $vp_final, $vp_siguiente,
|
||||||
|
$vpe_inicio, $vpe_final, $vpe_siguiente,
|
||||||
|
$vat_pb_inicio, $vat_pb_final, $vat_pb_siguiente,
|
||||||
|
$vcc_inicio, $vcc_final, $vcc_siguiente,
|
||||||
|
$vae_inicio, $vae_final, $vae_siguiente
|
||||||
|
];
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
if ($stmt === false) die("❌ Error al guardar agente aduanal.");
|
||||||
|
|
||||||
|
sqlsrv_free_stmt($stmt);
|
||||||
|
sqlsrv_close($conn);
|
||||||
|
|
||||||
|
header("Location: /IMPORTADORES/patente/lista?success=1");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editar()
|
||||||
|
{
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT aa.*
|
||||||
|
FROM dbo.agentes_aduanales aa
|
||||||
|
WHERE aa.id_agente = ?
|
||||||
|
AND aa.id_usuario = ?
|
||||||
|
";
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [(int)$id, $_SESSION['usuario_id']]);
|
||||||
|
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("Error en editar(): " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
$agente = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (!$agente) {
|
||||||
|
die("❌ Agente no encontrado o no autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/patente/editar.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
function actualizar()
|
||||||
|
{
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$id_agente = (int)($_POST['id_agente'] ?? 0);
|
||||||
|
$aduana = trim($_POST['aduana'] ?? '');
|
||||||
|
$patente = trim($_POST['patente'] ?? '');
|
||||||
|
$agente_aduanal = trim($_POST['agente_aduanal'] ?? '');
|
||||||
|
$rfc = trim($_POST['rfc'] ?? '');
|
||||||
|
$curp = trim($_POST['curp'] ?? '');
|
||||||
|
$razon_social = trim($_POST['razon_social'] ?? '');
|
||||||
|
$id_usuario = $_SESSION['usuario_id'];
|
||||||
|
|
||||||
|
$mf_nombre = trim($_POST['mf_nombre'] ?? '');
|
||||||
|
$mf_paterno = trim($_POST['mf_paterno'] ?? '');
|
||||||
|
$mf_materno = trim($_POST['mf_materno'] ?? '');
|
||||||
|
|
||||||
|
$vp_inicio = (int)($_POST['vp_inicio'] ?? 0);
|
||||||
|
$vp_final = (int)($_POST['vp_final'] ?? 0);
|
||||||
|
$vp_siguiente = (int)($_POST['vp_siguiente'] ?? 0);
|
||||||
|
|
||||||
|
$vpe_inicio = (int)($_POST['vpe_inicio'] ?? 0);
|
||||||
|
$vpe_final = (int)($_POST['vpe_final'] ?? 0);
|
||||||
|
$vpe_siguiente = (int)($_POST['vpe_siguiente'] ?? 0);
|
||||||
|
|
||||||
|
$vat_pb_inicio = (int)($_POST['vat_pb_inicio'] ?? 0);
|
||||||
|
$vat_pb_final = (int)($_POST['vat_pb_final'] ?? 0);
|
||||||
|
$vat_pb_siguiente = (int)($_POST['vat_pb_siguiente'] ?? 0);
|
||||||
|
|
||||||
|
$vcc_inicio = (int)($_POST['vcc_inicio'] ?? 0);
|
||||||
|
$vcc_final = (int)($_POST['vcc_final'] ?? 0);
|
||||||
|
$vcc_siguiente = (int)($_POST['vcc_siguiente'] ?? 0);
|
||||||
|
|
||||||
|
$vae_inicio = (int)($_POST['vae_inicio'] ?? 0);
|
||||||
|
$vae_final = (int)($_POST['vae_final'] ?? 0);
|
||||||
|
$vae_siguiente = (int)($_POST['vae_siguiente'] ?? 0);
|
||||||
|
|
||||||
|
if (!$id_agente || empty($aduana) || empty($patente) || empty($agente_aduanal) || empty($rfc) || empty($curp) || empty($razon_social)) {
|
||||||
|
die("❌ Datos inválidos o incompletos.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_numeric($aduana) || strlen($aduana) > 3) die("❌ La aduana debe ser numérica y máximo 3 dígitos.");
|
||||||
|
if (!is_numeric($patente) || strlen($patente) > 4) die("❌ La patente debe ser numérica y máximo 4 dígitos.");
|
||||||
|
if (strlen($rfc) > 13) die("❌ El RFC no puede exceder 13 caracteres.");
|
||||||
|
if (strlen($curp) > 18) die("❌ El CURP no puede exceder 18 caracteres.");
|
||||||
|
|
||||||
|
// Validar duplicado (excepto el propio id)
|
||||||
|
$sqlCheck = "SELECT COUNT(*) as count FROM dbo.agentes_aduanales
|
||||||
|
WHERE aduana = ? AND patente = ? AND id_usuario = ? AND id_agente != ?";
|
||||||
|
$stmtCheck = sqlsrv_query($conn, $sqlCheck, [$aduana, $patente, $id_usuario, $id_agente]);
|
||||||
|
|
||||||
|
if ($stmtCheck === false) die("❌ Error al verificar duplicados.");
|
||||||
|
|
||||||
|
$row = sqlsrv_fetch_array($stmtCheck, SQLSRV_FETCH_ASSOC);
|
||||||
|
if ($row['count'] > 0) die("❌ Ya existe un agente aduanal con esta combinación de aduana y patente.");
|
||||||
|
|
||||||
|
sqlsrv_free_stmt($stmtCheck);
|
||||||
|
|
||||||
|
// UPDATE
|
||||||
|
$sql = "UPDATE dbo.agentes_aduanales SET
|
||||||
|
aduana = ?, patente = ?, agente_aduanal = ?, rfc = ?, curp = ?, razon_social = ?,
|
||||||
|
mf_nombre = ?, mf_paterno = ?, mf_materno = ?,
|
||||||
|
vp_inicio = ?, vp_final = ?, vp_siguiente = ?,
|
||||||
|
vpe_inicio = ?, vpe_final = ?, vpe_siguiente = ?,
|
||||||
|
vat_pb_inicio = ?, vat_pb_final = ?, vat_pb_siguiente = ?,
|
||||||
|
vcc_inicio = ?, vcc_final = ?, vcc_siguiente = ?,
|
||||||
|
vae_inicio = ?, vae_final = ?, vae_siguiente = ?
|
||||||
|
WHERE id_agente = ? AND id_usuario = ?";
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
$aduana, $patente, $agente_aduanal, $rfc, $curp, $razon_social,
|
||||||
|
$mf_nombre, $mf_paterno, $mf_materno,
|
||||||
|
$vp_inicio, $vp_final, $vp_siguiente,
|
||||||
|
$vpe_inicio, $vpe_final, $vpe_siguiente,
|
||||||
|
$vat_pb_inicio, $vat_pb_final, $vat_pb_siguiente,
|
||||||
|
$vcc_inicio, $vcc_final, $vcc_siguiente,
|
||||||
|
$vae_inicio, $vae_final, $vae_siguiente,
|
||||||
|
$id_agente, $id_usuario
|
||||||
|
];
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
if ($stmt === false) die("❌ Error al actualizar agente aduanal.");
|
||||||
|
|
||||||
|
sqlsrv_free_stmt($stmt);
|
||||||
|
sqlsrv_close($conn);
|
||||||
|
|
||||||
|
header("Location: /IMPORTADORES/patente/lista?updated=ok");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Borrar de un chofer **/
|
||||||
|
function eliminar()
|
||||||
|
{
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// Verificar que el transportista exista y pertenezca al usuario
|
||||||
|
$sqlChk = "SELECT COUNT(*) AS cnt
|
||||||
|
FROM dbo.agentes_aduanales
|
||||||
|
WHERE id_agente = ? AND id_usuario = ?";
|
||||||
|
$stmtChk = sqlsrv_query($conn, $sqlChk, [$id, $usr]);
|
||||||
|
$rowChk = sqlsrv_fetch_array($stmtChk, SQLSRV_FETCH_ASSOC);
|
||||||
|
if ($rowChk['cnt'] == 0) {
|
||||||
|
die("❌ Agente no encontrado o no autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE dbo.agentes_aduanales SET activo = 0 WHERE id_agente = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [(int)$id]);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("❌ Error en eliminar(): " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: /IMPORTADORES/patente/lista?deleted=ok');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
@@ -185,6 +185,28 @@ function modificarCorreoExtra()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function eliminarCorreoExtra()
|
||||||
|
{
|
||||||
|
if (!isset($_SESSION['usuario_id']) || ($_SESSION['pendiente_confirmacion'] ?? false)) {
|
||||||
|
echo "Error: no se ha iniciado sesión o sesión incompleta.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id_usuario = $_SESSION['usuario_id'];
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$query = "DELETE FROM correo_extra WHERE id_usuario = ?";
|
||||||
|
$stmt = sqlsrv_prepare($conn, $query, [$id_usuario]);
|
||||||
|
|
||||||
|
if ($stmt && sqlsrv_execute($stmt)) {
|
||||||
|
$_SESSION['config_success'] = 'Correo adicional eliminado correctamente.';
|
||||||
|
header('Location: /IMPORTADORES/seguridad/index');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
echo "Error al eliminar el correo adicional.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function correoRespaldo()
|
function correoRespaldo()
|
||||||
{
|
{
|
||||||
// CORRIGIDO: Cambiar id_usuario por usuario_id y verificar confirmación
|
// CORRIGIDO: Cambiar id_usuario por usuario_id y verificar confirmación
|
||||||
@@ -253,6 +275,28 @@ function modificarCorreoRspaldo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function eliminarCorreoRespaldo()
|
||||||
|
{
|
||||||
|
if (!isset($_SESSION['usuario_id']) || ($_SESSION['pendiente_confirmacion'] ?? false)) {
|
||||||
|
echo "Error: no se ha iniciado sesión o sesión incompleta.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id_usuario = $_SESSION['usuario_id'];
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$query = "DELETE FROM correo_respaldo WHERE id_usuario = ?";
|
||||||
|
$stmt = sqlsrv_prepare($conn, $query, [$id_usuario]);
|
||||||
|
|
||||||
|
if ($stmt && sqlsrv_execute($stmt)) {
|
||||||
|
$_SESSION['config_success'] = 'Correo de respaldo eliminado correctamente.';
|
||||||
|
header('Location: /IMPORTADORES/seguridad/index');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
echo "Error al eliminar el correo de respaldo.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function obtenerCorreos($conn, $id_usuario)
|
function obtenerCorreos($conn, $id_usuario)
|
||||||
{
|
{
|
||||||
$correos = [
|
$correos = [
|
||||||
|
|||||||
@@ -462,7 +462,6 @@ function actualizar()
|
|||||||
}
|
}
|
||||||
|
|
||||||
function eliminar() {
|
function eliminar() {
|
||||||
session_start();
|
|
||||||
if (!($_SESSION['usuario_id'] ?? false)) {
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
header('Location: /IMPORTADORES/login');
|
header('Location: /IMPORTADORES/login');
|
||||||
exit;
|
exit;
|
||||||
@@ -486,7 +485,7 @@ function eliminar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ELIMINACIÓN REAL - DELETE en lugar de UPDATE
|
// ELIMINACIÓN REAL - DELETE en lugar de UPDATE
|
||||||
$sqlDel = "DELETE FROM dbo.transportistas WHERE id_transportista = ?";
|
$sqlDel = "UPDATE dbo.transportistas SET activo = 0 WHERE id_transportista = ?";
|
||||||
$stmtDel = sqlsrv_query($conn, $sqlDel, [$id]);
|
$stmtDel = sqlsrv_query($conn, $sqlDel, [$id]);
|
||||||
if ($stmtDel === false) {
|
if ($stmtDel === false) {
|
||||||
die("❌ Error al eliminar: " . print_r(sqlsrv_errors(), true));
|
die("❌ Error al eliminar: " . print_r(sqlsrv_errors(), true));
|
||||||
|
|||||||
31
patentes.txt
Normal file
31
patentes.txt
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
CREATE TABLE agentes_aduanales (
|
||||||
|
id_agente INT IDENTITY(1,1) PRIMARY KEY,
|
||||||
|
aduana VARCHAR(3),
|
||||||
|
patente VARCHAR(4),
|
||||||
|
agente_aduanal NVARCHAR(100),
|
||||||
|
rfc VARCHAR(13),
|
||||||
|
curp VARCHAR(18),
|
||||||
|
razon_social NVARCHAR(100),
|
||||||
|
id_usuario INT,
|
||||||
|
activo BIT DEFAULT 0,
|
||||||
|
creado_en DATETIME DEFAULT GETDATE(),
|
||||||
|
mf_nombre VARCHAR(50),
|
||||||
|
mf_paterno VARCHAR(50),
|
||||||
|
mf_materno VARCHAR(50),
|
||||||
|
vp_inicio INT DEFAULT 0,
|
||||||
|
vp_final INT DEFAULT 0,
|
||||||
|
vp_siguiente INT DEFAULT 0,
|
||||||
|
vpe_inicio INT DEFAULT 0,
|
||||||
|
vpe_final INT DEFAULT 0,
|
||||||
|
vpe_siguiente INT DEFAULT 0,
|
||||||
|
vat_pb_inicio INT DEFAULT 0,
|
||||||
|
vat_pb_final INT DEFAULT 0,
|
||||||
|
vat_pb_siguiente INT DEFAULT 0,
|
||||||
|
vcc_inicio INT DEFAULT 0,
|
||||||
|
vcc_final INT DEFAULT 0,
|
||||||
|
vcc_siguiente INT DEFAULT 0,
|
||||||
|
vae_inicio INT DEFAULT 0,
|
||||||
|
vae_final INT DEFAULT 0,
|
||||||
|
vae_siguiente INT DEFAULT 0
|
||||||
|
FOREIGN KEY (id_usuario) REFERENCES usuarios_sistema(id_usuario)
|
||||||
|
)
|
||||||
@@ -31,146 +31,133 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h4 class="mb-4">ℹ️ Información General</h4>
|
<h4 class="mb-4">ℹ️ Información General</h4>
|
||||||
<div class="card shadow-sm p-4 mb-4 bg-white">
|
<div class="card shadow-sm p-4 mb-4 bg-white">
|
||||||
<form>
|
<form>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-md-2 col-form-label">Clave:</label>
|
<label class="col-md-2 col-form-label">Clave:</label>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['clave'] ?? '') ?>" disabled>
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['clave'] ?? '') ?>" disabled>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3"></div>
|
<div class="col-md-3"></div>
|
||||||
|
<label class="col-md-2 col-form-label">Tipo de identificador:</label>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<select name="tipo_identificador" class="form-control" disabled>
|
||||||
|
<option value="">-- Selecciona una opción --</option>
|
||||||
|
<option value="1" <?= ($datos['tipo_identificador'] ?? '') == '1' ? 'selected' : '' ?>>1 - RFC</option>
|
||||||
|
<option value="2" <?= ($datos['tipo_identificador'] ?? '') == '2' ? 'selected' : '' ?>>2 - CURP</option>
|
||||||
|
<option value="3" <?= ($datos['tipo_identificador'] ?? '') == '3' ? 'selected' : '' ?>>3 - SIN TAX ID</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label class="col-md-2 col-form-label">Tipo de identificador:</label>
|
<div class="row mb-3">
|
||||||
<div class="col-md-2">
|
<label class="col-md-2 col-form-label">Nombre:</label>
|
||||||
<select name="tipo_identificador" class="form-control" disabled>
|
<div class="col-md-10">
|
||||||
<option value="">-- Selecciona una opción --</option>
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['nombre'] ?? '') ?>" disabled>
|
||||||
<option value="1" <?= ($datos['tipo_identificador'] ?? '') == '1' ? 'selected' : '' ?>>1 - RFC</option>
|
</div>
|
||||||
<option value="2" <?= ($datos['tipo_identificador'] ?? '') == '2' ? 'selected' : '' ?>>2 - CURP</option>
|
</div>
|
||||||
<option value="3" <?= ($datos['tipo_identificador'] ?? '') == '3' ? 'selected' : '' ?>>3 - SIN TAX ID</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-md-2 col-form-label">Nombre:</label>
|
<label class="col-md-2 col-form-label">RFC:</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-3">
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['nombre'] ?? '') ?>" disabled>
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['rfc'] ?? '') ?>" disabled>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-md-1"></div>
|
||||||
|
<label class="col-md-1 col-form-label">CURP:</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['curp'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Calle:</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['calle'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-md-2 col-form-label">RFC:</label>
|
<label class="col-md-2 col-form-label">Núm. Exterior:</label>
|
||||||
<div class="col-md-3">
|
<div class="col-md-2">
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['rfc'] ?? '') ?>" disabled>
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['num_exterior'] ?? '') ?>" disabled>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-4"></div>
|
||||||
|
<label class="col-md-2 col-form-label">Núm. Interior:</label>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['num_interior'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-1"></div>
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Ciudad / Localidad:</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['ciudad'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label class="col-md-1 col-form-label">Colonia:</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['colonia'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label class="col-md-1 col-form-label">CURP:</label>
|
<div class="row mb-3">
|
||||||
<div class="col-md-5">
|
<label class="col-md-2 col-form-label">País:</label>
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['curp'] ?? '') ?>" disabled>
|
<div class="col-md-3">
|
||||||
</div>
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['pais'] ?? '') ?>" disabled>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-3"></div>
|
||||||
|
<label class="col-md-2 col-form-label">Código Postal:</label>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['codigo_postal'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-md-2 col-form-label">Calle:</label>
|
<label class="col-md-2 col-form-label">Municipio:</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-4">
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['calle'] ?? '') ?>" disabled>
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['municipio'] ?? '') ?>" disabled>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-md-1"></div>
|
||||||
|
<label class="col-md-1 col-form-label">Estado:</label>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['estado'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-md-2 col-form-label">Núm. Exterior:</label>
|
<label class="col-md-2 col-form-label">Teléfono:</label>
|
||||||
<div class="col-md-2">
|
<div class="col-md-5">
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['num_exterior'] ?? '') ?>" disabled>
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['telefono'] ?? '') ?>" disabled>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label class="col-md-1 col-form-label">Fax:</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['fax'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4"></div>
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Correo:</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input type="email" class="form-control" value="<?= htmlspecialchars($datos['correo'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label class="col-md-2 col-form-label">Núm. Interior:</label>
|
<div class="row mb-3">
|
||||||
<div class="col-md-2">
|
<label class="col-md-2 col-form-label">Observaciones:</label>
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['num_interior'] ?? '') ?>" disabled>
|
<div class="col-md-10">
|
||||||
</div>
|
<textarea class="form-control" rows="3" disabled><?= htmlspecialchars($datos['observaciones'] ?? '') ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row mb-3">
|
<div style="display: flex; justify-content: right;">
|
||||||
<label class="col-md-2 col-form-label">Ciudad / Localidad:</label>
|
<a href="/IMPORTADORES/configuracion/editar" class="btn btn-success mb-3">✏️ Editar Información</a>
|
||||||
<div class="col-md-3">
|
</div>
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['ciudad'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-1"></div>
|
|
||||||
|
|
||||||
<label class="col-md-1 col-form-label">Colonia:</label>
|
|
||||||
<div class="col-md-5">
|
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['colonia'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">País:</label>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['pais'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-3"></div>
|
|
||||||
|
|
||||||
<label class="col-md-2 col-form-label">Código Postal:</label>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['codigo_postal'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Municipio:</label>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['municipio'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-1"></div>
|
|
||||||
|
|
||||||
<label class="col-md-1 col-form-label">Estado:</label>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['estado'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Teléfono:</label>
|
|
||||||
<div class="col-md-5">
|
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['telefono'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-1"></div>
|
|
||||||
|
|
||||||
<label class="col-md-1 col-form-label">Fax:</label>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['fax'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Correo:</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input type="email" class="form-control" value="<?= htmlspecialchars($datos['correo'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Observaciones:</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<textarea class="form-control" rows="3" disabled><?= htmlspecialchars($datos['observaciones'] ?? '') ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex; justify-content: right;">
|
|
||||||
<a href="/IMPORTADORES/configuracion/editar" class="btn btn-success mb-3">✏️ Editar Información</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -32,193 +32,171 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h4 class="mb-4">✏️ Editar Información</h4>
|
<h4 class="mb-4">✏️ Editar Información</h4>
|
||||||
<div class="card shadow-sm p-4 mb-4 bg-white">
|
<div class="card shadow-sm p-4 mb-4 bg-white">
|
||||||
<form id="form-edicion" method="POST" action="/IMPORTADORES/configuracion/guardar">
|
<form id="form-edicion" method="POST" action="/IMPORTADORES/configuracion/guardar">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-md-2 col-form-label">Clave:</label>
|
<label class="col-md-2 col-form-label">Clave:</label>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<input type="text" name="clave" maxlength="8"
|
<input type="text" name="clave" maxlength="8" class="form-control" value="<?= htmlspecialchars($datos['clave'] ?? '') ?>" disabled>
|
||||||
class="form-control" value="<?= htmlspecialchars($datos['clave'] ?? '') ?>" disabled>
|
</div>
|
||||||
</div>
|
<div class="col-md-3"></div>
|
||||||
|
<label class="col-md-2 col-form-label">Tipo de identificador:</label>
|
||||||
<div class="col-md-3"></div>
|
<div class="col-md-2">
|
||||||
|
<select name="tipo_identificador" class="form-control" required>
|
||||||
<label class="col-md-2 col-form-label">Tipo de identificador:</label>
|
<option value="">-- Selecciona una opción --</option>
|
||||||
<div class="col-md-2">
|
<option value="1" <?= ($datos['tipo_identificador'] ?? '') == '1' ? 'selected' : '' ?>>1 - RFC</option>
|
||||||
<select name="tipo_identificador" class="form-control" required>
|
<option value="2" <?= ($datos['tipo_identificador'] ?? '') == '2' ? 'selected' : '' ?>>2 - CURP</option>
|
||||||
<option value="">-- Selecciona una opción --</option>
|
<option value="3" <?= ($datos['tipo_identificador'] ?? '') == '3' ? 'selected' : '' ?>>3 - SIN TAX ID</option>
|
||||||
<option value="1" <?= ($datos['tipo_identificador'] ?? '') == '1' ? 'selected' : '' ?>>1 - RFC</option>
|
</select>
|
||||||
<option value="2" <?= ($datos['tipo_identificador'] ?? '') == '2' ? 'selected' : '' ?>>2 - CURP</option>
|
</div>
|
||||||
<option value="3" <?= ($datos['tipo_identificador'] ?? '') == '3' ? 'selected' : '' ?>>3 - SIN TAX ID</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Nombre:</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['nombre'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">RFC:</label>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['rfc'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-1"></div>
|
|
||||||
|
|
||||||
<label class="col-md-1 col-form-label">CURP:</label>
|
|
||||||
<div class="col-md-5">
|
|
||||||
<input type="text" name="curp" maxlength="18"
|
|
||||||
class="form-control" value="<?= htmlspecialchars($datos['curp'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Calle:</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input type="text" name="calle" class="form-control" value="<?= htmlspecialchars($datos['calle'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Núm. Exterior:</label>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="text" name="num_exterior" class="form-control" value="<?= htmlspecialchars($datos['num_exterior'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-4"></div>
|
|
||||||
|
|
||||||
<label class="col-md-2 col-form-label">Núm. Interior:</label>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="text" name="num_interior" class="form-control" value="<?= htmlspecialchars($datos['num_interior'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Ciudad / Localidad:</label>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" name="ciudad" class="form-control" value="<?= htmlspecialchars($datos['ciudad'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-1"></div>
|
|
||||||
|
|
||||||
<label class="col-md-1 col-form-label">Colonia:</label>
|
|
||||||
<div class="col-md-5">
|
|
||||||
<input type="text" name="colonia" class="form-control" value="<?= htmlspecialchars($datos['colonia'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">País:</label>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" name="pais" class="form-control" value="<?= htmlspecialchars($datos['pais'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-3"></div>
|
|
||||||
|
|
||||||
<label class="col-md-2 col-form-label">Código Postal:</label>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="number" name="codigo_postal" class="form-control" value="<?= htmlspecialchars($datos['codigo_postal'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Municipio:</label>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="text" name="municipio" class="form-control" value="<?= htmlspecialchars($datos['municipio'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-1"></div>
|
|
||||||
|
|
||||||
<label class="col-md-1 col-form-label">Estado:</label>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="text" name="estado" class="form-control" value="<?= htmlspecialchars($datos['estado'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Teléfono:</label>
|
|
||||||
<div class="col-md-5">
|
|
||||||
<input type="text" name="telefono" maxlength="11"
|
|
||||||
class="form-control" value="<?= htmlspecialchars($datos['telefono'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-1"></div>
|
|
||||||
|
|
||||||
<label class="col-md-1 col-form-label">Fax:</label>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" name="fax" maxlength="12"
|
|
||||||
class="form-control" value="<?= htmlspecialchars($datos['fax'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Correo:</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input type="email" class="form-control" value="<?= htmlspecialchars($datos['correo'] ?? '') ?>" disabled>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-2 col-form-label">Observaciones:</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<?php $valor_obs = htmlspecialchars($datos['observaciones'] ?? ''); ?>
|
|
||||||
<textarea name="observaciones" class="form-control" rows="3"><?= $valor_obs ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex; justify-content: right;">
|
|
||||||
<a href="/IMPORTADORES/configuracion/index" class="btn btn-secondary ms-2" style="margin-right: 10px;">Cancelar</a>
|
|
||||||
<button type="submit" class="btn btn-primary">💾 Guardar Cambios</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Nombre:</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['nombre'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">RFC:</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['rfc'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label class="col-md-1 col-form-label">CURP:</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input type="text" name="curp" maxlength="18" class="form-control" value="<?= htmlspecialchars($datos['curp'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Calle:</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input type="text" name="calle" class="form-control" value="<?= htmlspecialchars($datos['calle'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Núm. Exterior:</label>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input type="text" name="num_exterior" class="form-control" value="<?= htmlspecialchars($datos['num_exterior'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4"></div>
|
||||||
|
<label class="col-md-2 col-form-label">Núm. Interior:</label>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input type="text" name="num_interior" class="form-control" value="<?= htmlspecialchars($datos['num_interior'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Ciudad / Localidad:</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input type="text" name="ciudad" class="form-control" value="<?= htmlspecialchars($datos['ciudad'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label class="col-md-1 col-form-label">Colonia:</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input type="text" name="colonia" class="form-control" value="<?= htmlspecialchars($datos['colonia'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">País:</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input type="text" name="pais" class="form-control" value="<?= htmlspecialchars($datos['pais'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3"></div>
|
||||||
|
<label class="col-md-2 col-form-label">Código Postal:</label>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input type="number" name="codigo_postal" class="form-control" value="<?= htmlspecialchars($datos['codigo_postal'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Municipio:</label>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<input type="text" name="municipio" class="form-control" value="<?= htmlspecialchars($datos['municipio'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label class="col-md-1 col-form-label">Estado:</label>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<input type="text" name="estado" class="form-control" value="<?= htmlspecialchars($datos['estado'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Teléfono:</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input type="text" name="telefono" maxlength="11" class="form-control" value="<?= htmlspecialchars($datos['telefono'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label class="col-md-1 col-form-label">Fax:</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input type="text" name="fax" maxlength="12" class="form-control" value="<?= htmlspecialchars($datos['fax'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Correo:</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input type="email" class="form-control" value="<?= htmlspecialchars($datos['correo'] ?? '') ?>" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-2 col-form-label">Observaciones:</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<?php $valor_obs = htmlspecialchars($datos['observaciones'] ?? ''); ?>
|
||||||
|
<textarea name="observaciones" class="form-control" rows="3"><?= $valor_obs ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: right;">
|
||||||
|
<a href="/IMPORTADORES/configuracion/index" class="btn btn-secondary ms-2" style="margin-right: 10px;">Cancelar</a>
|
||||||
|
<button type="submit" class="btn btn-primary">💾 Guardar Cambios</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
<script>
|
<script>
|
||||||
document.getElementById('form-edicion').addEventListener('submit', function (event) {
|
document.getElementById('form-edicion').addEventListener('submit', function (event) {
|
||||||
event.preventDefault(); // Evita que el formulario se envíe
|
event.preventDefault(); // Evita que el formulario se envíe
|
||||||
|
|
||||||
const curp = document.querySelector('[name="curp"]').value.trim();
|
const curp = document.querySelector('[name="curp"]').value.trim();
|
||||||
const telefono = document.querySelector('input[name="telefono"]').value.trim();
|
const telefono = document.querySelector('input[name="telefono"]').value.trim();
|
||||||
const fax = document.querySelector('[name="fax"]').value.trim();
|
const fax = document.querySelector('[name="fax"]').value.trim();
|
||||||
|
|
||||||
let errores = [];
|
let errores = [];
|
||||||
|
|
||||||
// Validación CURP
|
// Validación CURP
|
||||||
if (!/^[A-Z]{4}[0-9]{6}[HM](AS|BC|BS|CC|CL|CM|CS|CH|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS)[A-Z]{3}[A-Z0-9]{2}$/.test(curp)) {
|
if (!/^[A-Z]{4}[0-9]{6}[HM](AS|BC|BS|CC|CL|CM|CS|CH|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS)[A-Z]{3}[A-Z0-9]{2}$/.test(curp)) {
|
||||||
errores.push('La CURP no tiene el formato correcto.');
|
errores.push('La CURP no tiene el formato correcto.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validación Teléfono - Ajustada para permitir diferentes formatos
|
// Validación Teléfono - Ajustada para permitir diferentes formatos
|
||||||
if (telefono !== '' && !/^\d{10,11}$/.test(telefono.replace(/\s/g, ''))) {
|
if (telefono !== '' && !/^\d{10,11}$/.test(telefono.replace(/\s/g, ''))) {
|
||||||
errores.push('El número de teléfono debe tener 10 u 11 dígitos.');
|
errores.push('El número de teléfono debe tener 10 u 11 dígitos.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validación Fax
|
// Validación Fax
|
||||||
if (fax !== '' && !/^\d{3}\s?\d{3}\s?\d{4}$/.test(fax)) {
|
if (fax !== '' && !/^\d{3}\s?\d{3}\s?\d{4}$/.test(fax)) {
|
||||||
errores.push('El número de fax debe tener el formato: 123 456 7890 o 1234567890.');
|
errores.push('El número de fax debe tener el formato: 123 456 7890 o 1234567890.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si hay errores, mostrar alerta y no enviar
|
// Si hay errores, mostrar alerta y no enviar
|
||||||
if (errores.length > 0) {
|
if (errores.length > 0) {
|
||||||
Swal.fire({
|
Swal.fire({icon: 'error', title: 'Errores en el formulario', html: errores.map(e => `<p>${e}</p>`).join('') });
|
||||||
icon: 'error',
|
return; // Evita que el formulario se envíe
|
||||||
title: 'Errores en el formulario',
|
}
|
||||||
html: errores.map(e => `<p>${e}</p>`).join('')
|
|
||||||
});
|
|
||||||
return; // Evita que el formulario se envíe
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si no hay errores, enviar el formulario
|
// Si no hay errores, enviar el formulario
|
||||||
this.submit(); // Esto sí lo envía manualmente
|
this.submit(); // Esto sí lo envía manualmente
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="card shadow-sm p-3">
|
<div class="card shadow-sm p-3">
|
||||||
<h5 class="text-info">Solicitud de Importación</h5>
|
<h5 class="text-info">Solicitudes de Importación</h5>
|
||||||
<p>Inicia nuevas solicitudes de pedimentos.</p>
|
<p>Inicia nuevas solicitudes de pedimentos.</p>
|
||||||
<a href="/IMPORTADORES/solicitud_importacion/crear"
|
<a href="/IMPORTADORES/solicitud_importacion/crear"
|
||||||
class="btn btn-info btn-sm mt-2 <?= str_contains($_SERVER['REQUEST_URI'], '/solicitud_importacion/crear') ? 'active' : '' ?>">
|
class="btn btn-info btn-sm mt-2 <?= str_contains($_SERVER['REQUEST_URI'], '/solicitud_importacion/crear') ? 'active' : '' ?>">
|
||||||
|
|||||||
@@ -43,6 +43,15 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'agente_adu
|
|||||||
<div class="d-none d-md-block bg-dark text-white position-fixed h-100 pt-5" style="width: 250px;">
|
<div class="d-none d-md-block bg-dark text-white position-fixed h-100 pt-5" style="width: 250px;">
|
||||||
<nav class="nav flex-column">
|
<nav class="nav flex-column">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Detecta si estamos en alguna parte de locaciones
|
||||||
|
$esVistaLocaciones = str_contains($_SERVER['REQUEST_URI'], '/locaciones');
|
||||||
|
// Detecta si estamos en alguna parte de agentes
|
||||||
|
$esVistaAgentes = str_contains($_SERVER['REQUEST_URI'], '/agentes');
|
||||||
|
// Detecta si estamos en alguna parte de agente aduanal
|
||||||
|
$esVistaPatente = str_contains($_SERVER['REQUEST_URI'], '/patente');
|
||||||
|
?>
|
||||||
|
|
||||||
<!-- INICIO -->
|
<!-- INICIO -->
|
||||||
<a href="/IMPORTADORES/agentes/dashboard"
|
<a href="/IMPORTADORES/agentes/dashboard"
|
||||||
class="nav-link px-3 py-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/agentes/dashboard' ? 'active' : '' ?>">
|
class="nav-link px-3 py-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/agentes/dashboard' ? 'active' : '' ?>">
|
||||||
@@ -68,30 +77,72 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'agente_adu
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- LOCACIONES -->
|
<!-- LOCACIONES -->
|
||||||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center
|
<?php if ($esVistaLocaciones): ?>
|
||||||
<?= str_contains($_SERVER['REQUEST_URI'], '/agentes') ? 'active' : '' ?>"
|
<?php $enDashboardLocaciones = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/locaciones/lista'; ?>
|
||||||
data-bs-toggle="collapse" href="#submenuLocaciones" role="button" aria-expanded="false">
|
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaLocaciones ? 'active' : '' ?>"
|
||||||
🗺️ Locaciones
|
href="<?= $enDashboardLocaciones ? '#submenuLocaciones' : '/IMPORTADORES/locaciones/lista' ?>"
|
||||||
<span class="badge bg-secondary">2</span>
|
<?= $enDashboardLocaciones ? 'data-bs-toggle="collapse"' : '' ?>
|
||||||
</a>
|
role="button" aria-expanded="true" aria-controls="submenuLocaciones"
|
||||||
<div class="collapse <?= str_contains($_SERVER['REQUEST_URI'], '/agentes') ? 'show' : '' ?>" id="submenuLocaciones">
|
onclick="<?= $enDashboardLocaciones ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/locaciones/lista\';' ?>">
|
||||||
<nav class="nav flex-column ms-3">
|
🗺️ Locaciones
|
||||||
<a href="/IMPORTADORES/agentes/lista"
|
<span class="badge bg-secondary">2</span>
|
||||||
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/agentes/lista' ? 'active' : '' ?>">
|
</a>
|
||||||
• Ver Locaciones
|
<div class="collapse show" id="submenuLocaciones">
|
||||||
</a>
|
<nav class="nav flex-column ms-3">
|
||||||
<a href="/IMPORTADORES/agentes/alta"
|
<a href="/IMPORTADORES/locaciones/lista"
|
||||||
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/agentes/alta') ? 'active' : '' ?>">
|
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/locaciones/lista' ? 'active' : '' ?>">
|
||||||
• Agregar Locaciones
|
• Ver Locaciones
|
||||||
</a>
|
</a>
|
||||||
</nav>
|
<a href="/IMPORTADORES/locaciones/alta"
|
||||||
</div>
|
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/locaciones/alta') ? 'active' : '' ?>">
|
||||||
|
• Agregar Locaciones
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<?php elseif ($esVistaAgentes || $esVistaPatente): ?>
|
||||||
|
<a href="/IMPORTADORES/locaciones/lista"
|
||||||
|
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||||
|
🗺️ Locaciones
|
||||||
|
<span class="badge bg-secondary">2</span>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<!-- Patentes -->
|
||||||
|
<?php if ($esVistaPatente): ?>
|
||||||
|
<?php $enDashboardPatente = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/patente/dashboard'; ?>
|
||||||
|
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaPatente ? 'active' : '' ?>"
|
||||||
|
href="<?= $enDashboardPatente ? '#submenuAgentesAduanales' : 'IMPORTADORES/patente/dashboard' ?>"
|
||||||
|
<?= $enDashboardPatente ? 'data-bs-toggle="collapse"' : '' ?>
|
||||||
|
role="button" aria-expanded="true" aria-controls="submenuAgentesAduanales"
|
||||||
|
onclick="<?= $enDashboardPatente ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/patente/dashboard\';' ?>">
|
||||||
|
📑 Patentes
|
||||||
|
<span class="badge bg-secondary">2</span>
|
||||||
|
</a>
|
||||||
|
<div class="collapse show" id="submenuAgentesAduanales">
|
||||||
|
<nav class="nav flex-column ms-3">
|
||||||
|
<a href="/IMPORTADORES/patente/lista"
|
||||||
|
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/patente/lista' ? 'active' : '' ?>">
|
||||||
|
• Ver Patentes
|
||||||
|
</a>
|
||||||
|
<a href="/IMPORTADORES/patente/alta"
|
||||||
|
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/IMPORTADORES/patente/alta') ? 'active' : '' ?>">
|
||||||
|
• Nueva Patente
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<?php elseif ($esVistaAgentes || $esVistaLocaciones): ?>
|
||||||
|
<a href="/IMPORTADORES/patente/dashboard"
|
||||||
|
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||||
|
📑 Patentes
|
||||||
|
<span class="badge bg-secondary">2</span>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- OFFCANVAS PARA MÓVILES -->
|
<!-- OFFCANVAS PARA MÓVILES -->
|
||||||
<div class="offcanvas offcanvas-start d-md-none" tabindex="-1" id="sidebarMenu" style="top: 75px;">
|
<div class="offcanvas offcanvas-start d-md-none" tabindex="-1" id="sidebarMenu" style="top: 56px;">
|
||||||
<div class="offcanvas-header">
|
<div class="offcanvas-header">
|
||||||
<h5 class="offcanvas-title">Menú</h5>
|
<h5 class="offcanvas-title">Menú</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
|
||||||
@@ -123,24 +174,66 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'agente_adu
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- LOCACIONES -->
|
<!-- LOCACIONES -->
|
||||||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center
|
<?php if ($esVistaLocaciones): ?>
|
||||||
<?= str_contains($_SERVER['REQUEST_URI'], '/agentes') ? 'active' : '' ?>"
|
<?php $enDashboardLocaciones = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/locaciones/lista'; ?>
|
||||||
data-bs-toggle="collapse" href="#submenuLocaciones" role="button" aria-expanded="false">
|
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaLocaciones ? 'active' : '' ?>"
|
||||||
🗺️ Locaciones
|
href="<?= $enDashboardLocaciones ? '#submenuLocaciones' : '/IMPORTADORES/locaciones/lista' ?>"
|
||||||
<span class="badge bg-secondary">2</span>
|
<?= $enDashboardLocaciones ? 'data-bs-toggle="collapse"' : '' ?>
|
||||||
</a>
|
role="button" aria-expanded="true" aria-controls="submenuLocaciones"
|
||||||
<div class="collapse <?= str_contains($_SERVER['REQUEST_URI'], '/agentes') ? 'show' : '' ?>" id="submenuLocaciones">
|
onclick="<?= $enDashboardLocaciones ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/locaciones/lista\';' ?>">
|
||||||
<nav class="nav flex-column ms-3">
|
🗺️ Locaciones
|
||||||
<a href="/IMPORTADORES/agentes/lista"
|
<span class="badge bg-secondary">2</span>
|
||||||
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/agentes/lista' ? 'active' : '' ?>">
|
</a>
|
||||||
• Ver Locaciones
|
<div class="collapse show" id="submenuLocaciones">
|
||||||
</a>
|
<nav class="nav flex-column ms-3">
|
||||||
<a href="/IMPORTADORES/agentes/alta"
|
<a href="/IMPORTADORES/locaciones/lista"
|
||||||
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/agentes/alta') ? 'active' : '' ?>">
|
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/locaciones/lista' ? 'active' : '' ?>">
|
||||||
• Agregar Locaciones
|
• Ver Locaciones
|
||||||
</a>
|
</a>
|
||||||
</nav>
|
<a href="/IMPORTADORES/locaciones/alta"
|
||||||
</div>
|
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/locaciones/alta') ? 'active' : '' ?>">
|
||||||
|
• Agregar Locaciones
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<?php elseif ($esVistaAgentes || $esVistaPatente): ?>
|
||||||
|
<a href="/IMPORTADORES/locaciones/lista"
|
||||||
|
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||||
|
🗺️ Locaciones
|
||||||
|
<span class="badge bg-secondary">2</span>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<!-- Patentes -->
|
||||||
|
<?php if ($esVistaPatente): ?>
|
||||||
|
<?php $enDashboardPatente = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/patente/dashboard'; ?>
|
||||||
|
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaPatente ? 'active' : '' ?>"
|
||||||
|
href="<?= $enDashboardPatente ? '#submenuAgentesAduanales' : 'IMPORTADORES/patente/dashboard' ?>"
|
||||||
|
<?= $enDashboardPatente ? 'data-bs-toggle="collapse"' : '' ?>
|
||||||
|
role="button" aria-expanded="true" aria-controls="submenuAgentesAduanales"
|
||||||
|
onclick="<?= $enDashboardPatente ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/patente/dashboard\';' ?>">
|
||||||
|
📑 Patentes
|
||||||
|
<span class="badge bg-secondary">2</span>
|
||||||
|
</a>
|
||||||
|
<div class="collapse show" id="submenuAgentesAduanales">
|
||||||
|
<nav class="nav flex-column ms-3">
|
||||||
|
<a href="/IMPORTADORES/patente/lista"
|
||||||
|
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/patente/lista' ? 'active' : '' ?>">
|
||||||
|
• Ver Patentes
|
||||||
|
</a>
|
||||||
|
<a href="/IMPORTADORES/patente/alta"
|
||||||
|
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/IMPORTADORES/patente/alta') ? 'active' : '' ?>">
|
||||||
|
• Nueva Patentes
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<?php elseif ($esVistaAgentes || $esVistaLocaciones): ?>
|
||||||
|
<a href="/IMPORTADORES/patente/dashboard"
|
||||||
|
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||||
|
📑 Patentes
|
||||||
|
<span class="badge bg-secondary">2</span>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -48,6 +48,8 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
$esVistaSeguridad = str_contains($_SERVER['REQUEST_URI'], '/seguridad');
|
$esVistaSeguridad = str_contains($_SERVER['REQUEST_URI'], '/seguridad');
|
||||||
// Detecta si estamos en alguna parte de preferencias
|
// Detecta si estamos en alguna parte de preferencias
|
||||||
$esVistaPreferencias = str_contains($_SERVER['REQUEST_URI'], '/preferencias');
|
$esVistaPreferencias = str_contains($_SERVER['REQUEST_URI'], '/preferencias');
|
||||||
|
// Detecta si estamos en alguna parte de automatizaciones
|
||||||
|
$esVistaAutomatizaciones = str_contains($_SERVER['REQUEST_URI'], '/automatizaciones');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- INFORMACIÓN GENERAL -->
|
<!-- INFORMACIÓN GENERAL -->
|
||||||
@@ -57,10 +59,18 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- AUTOMATIZACIONES -->
|
<!-- AUTOMATIZACIONES -->
|
||||||
<a href="/IMPORTADORES/configuracion/automatizaciones"
|
<?php if ($esVistaAutomatizaciones): ?>
|
||||||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/automatizaciones') ? 'active' : '' ?>">
|
<?php $enDashboardAutomatizaciones = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/automatizaciones/index'; ?>
|
||||||
⚙️ Automatizaciones
|
<a href="/IMPORTADORES/automatizaciones/index"
|
||||||
</a>
|
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
|
||||||
|
⚙️ Automatizaciones
|
||||||
|
</a>
|
||||||
|
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias || $esVistaBitacoras): ?>
|
||||||
|
<a href="/IMPORTADORES/automatizaciones/index"
|
||||||
|
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
|
||||||
|
⚙️ Automatizaciones
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- PREFERENCIAS -->
|
<!-- PREFERENCIAS -->
|
||||||
<?php if ($esVistaPreferencias): ?>
|
<?php if ($esVistaPreferencias): ?>
|
||||||
@@ -69,7 +79,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
href="<?= $enDashboardPreferencias ? '#submenuPreferencias' : '/IMPORTADORES/preferencias/index' ?>"
|
href="<?= $enDashboardPreferencias ? '#submenuPreferencias' : '/IMPORTADORES/preferencias/index' ?>"
|
||||||
<?= $enDashboardPreferencias ? 'data-bd-toggle="collapse"' : '' ?>
|
<?= $enDashboardPreferencias ? 'data-bd-toggle="collapse"' : '' ?>
|
||||||
role="button" aria-expanded="true" aria-controls="submenuPreferencias"
|
role="button" aria-expanded="true" aria-controls="submenuPreferencias"
|
||||||
onclick="<? $enDashboardPreferenecias ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/preferencias/index\';' ?>">
|
onclick="<? $enDashboardPreferencias ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/preferencias/index\';' ?>">
|
||||||
✅ Preferencias
|
✅ Preferencias
|
||||||
<span class="badge bg-secondary">1</span>
|
<span class="badge bg-secondary">1</span>
|
||||||
</a>
|
</a>
|
||||||
@@ -81,7 +91,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
</a>
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaSeguridad): ?>
|
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaSeguridad || $esVistaBitacoras): ?>
|
||||||
<a href="/IMPORTADORES/preferencias/index"
|
<a href="/IMPORTADORES/preferencias/index"
|
||||||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||||
✅ Preferencias
|
✅ Preferencias
|
||||||
@@ -108,7 +118,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
</a>
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaPreferencias): ?>
|
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaPreferencias || $esVistaBitacoras): ?>
|
||||||
<a href="/IMPORTADORES/seguridad/index"
|
<a href="/IMPORTADORES/seguridad/index"
|
||||||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||||
👮 Seguridad
|
👮 Seguridad
|
||||||
@@ -136,7 +146,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
</a>
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias): ?>
|
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaSeguridad || $esVistaPreferencias): ?>
|
||||||
<!-- Si estamos en configuración, pero no en bitácoras -->
|
<!-- Si estamos en configuración, pero no en bitácoras -->
|
||||||
<a href="/IMPORTADORES/bitacoras/index"
|
<a href="/IMPORTADORES/bitacoras/index"
|
||||||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||||
@@ -150,19 +160,31 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
|
|
||||||
<!-- OFFCANVAS PARA MÓVILES -->
|
<!-- OFFCANVAS PARA MÓVILES -->
|
||||||
<div class="offcanvas offcanvas-start d-md-none" tabindex="-1" id="sidebarMenu" style="top: 56px;">
|
<div class="offcanvas offcanvas-start d-md-none" tabindex="-1" id="sidebarMenu" style="top: 56px;">
|
||||||
|
<div class="offcanvas-header">
|
||||||
|
<h5 class="offcanvas-title">Menú</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
|
||||||
|
</div>
|
||||||
<div class="offcanvas-body">
|
<div class="offcanvas-body">
|
||||||
|
|
||||||
<!-- INFORMACIÓN GENERAL -->
|
<!-- INFORMACIÓN GENERAL -->
|
||||||
<a href="/IMPORTADORES/configuracion/index"
|
<a href="/IMPORTADORES/configuracion/index"
|
||||||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/dashboard_configuracion') ? 'active' : '' ?>">
|
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/index') ? 'active' : '' ?>">
|
||||||
ℹ️ Información General
|
ℹ️ Información General
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- AUTOMATIZACIONES -->
|
<!-- AUTOMATIZACIONES -->
|
||||||
<a href="/IMPORTADORES/configuracion/automatizaciones"
|
<?php if ($esVistaAutomatizaciones): ?>
|
||||||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/automatizaciones') ? 'active' : '' ?>">
|
<?php $enDashboardAutomatizaciones = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/automatizaciones/index'; ?>
|
||||||
⚙️ Automatizaciones
|
<a href="/IMPORTADORES/automatizaciones/index"
|
||||||
</a>
|
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
|
||||||
|
⚙️ Automatizaciones
|
||||||
|
</a>
|
||||||
|
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias || $esVistaBitacoras): ?>
|
||||||
|
<a href="/IMPORTADORES/automatizaciones/index"
|
||||||
|
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
|
||||||
|
⚙️ Automatizaciones
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- PREFERENCIAS -->
|
<!-- PREFERENCIAS -->
|
||||||
<?php if ($esVistaPreferencias): ?>
|
<?php if ($esVistaPreferencias): ?>
|
||||||
@@ -171,7 +193,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
href="<?= $enDashboardPreferencias ? '#submenuPreferencias' : '/IMPORTADORES/preferencias/index' ?>"
|
href="<?= $enDashboardPreferencias ? '#submenuPreferencias' : '/IMPORTADORES/preferencias/index' ?>"
|
||||||
<?= $enDashboardPreferencias ? 'data-bd-toggle="collapse"' : '' ?>
|
<?= $enDashboardPreferencias ? 'data-bd-toggle="collapse"' : '' ?>
|
||||||
role="button" aria-expanded="true" aria-controls="submenuPreferencias"
|
role="button" aria-expanded="true" aria-controls="submenuPreferencias"
|
||||||
onclick="<? $enDashboardPreferenecias ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/preferencias/index\';' ?>">
|
onclick="<? $enDashboardPreferencias ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/preferencias/index\';' ?>">
|
||||||
✅ Preferencias
|
✅ Preferencias
|
||||||
<span class="badge bg-secondary">1</span>
|
<span class="badge bg-secondary">1</span>
|
||||||
</a>
|
</a>
|
||||||
@@ -183,7 +205,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
</a>
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaSeguridad): ?>
|
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaSeguridad || $esVistaBitacoras): ?>
|
||||||
<a href="/IMPORTADORES/preferencias/index"
|
<a href="/IMPORTADORES/preferencias/index"
|
||||||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||||
✅ Preferencias
|
✅ Preferencias
|
||||||
@@ -210,7 +232,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
</a>
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaPreferencias): ?>
|
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaPreferencias || $esVistaBitacoras): ?>
|
||||||
<a href="/IMPORTADORES/seguridad/index"
|
<a href="/IMPORTADORES/seguridad/index"
|
||||||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||||
👮 Seguridad
|
👮 Seguridad
|
||||||
@@ -238,7 +260,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
|
|||||||
</a>
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias): ?>
|
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaPreferencias || $esVistaSeguridad): ?>
|
||||||
<!-- Si estamos en configuración, pero no en bitácoras -->
|
<!-- Si estamos en configuración, pero no en bitácoras -->
|
||||||
<a href="/IMPORTADORES/bitacoras/index"
|
<a href="/IMPORTADORES/bitacoras/index"
|
||||||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||||||
|
|||||||
436
views/patente/alta_patente.php
Normal file
436
views/patente/alta_patente.php
Normal file
@@ -0,0 +1,436 @@
|
|||||||
|
<?php include __DIR__ . '/../partials/sidebar_agente.php'; ?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Dashboard | Importador</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<!-- SweetAlert2 -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
<style>
|
||||||
|
body { font-family: 'Segoe UI', sans-serif; background-color: #f4f6f9; }
|
||||||
|
.sidebar { width: 220px; height: 100vh; background-color: #343a40; position: fixed; top: 0; left: 0; padding-top: 56px; z-index: 1040; }
|
||||||
|
.sidebar .nav-link { font-weight: bold; color: white; transition: all 0.3s ease; }
|
||||||
|
.sidebar .nav-link:hover,
|
||||||
|
.sidebar .nav-link.active { background-color: #495057; color: #fff; }
|
||||||
|
.content { margin-top: 56px; padding: 40px 20px; position: relative; z-index: 1; background-color: #f4f6f9; transition: margin-left 0.3s ease; }
|
||||||
|
.navbar { position: fixed; top: 0; width: 100%; z-index: 1050; }
|
||||||
|
.btn-indigo { background-color: #6610f2; color: white;}
|
||||||
|
.btn-indigo:hover { background-color: #520dc2; color: white;}
|
||||||
|
.text-indigo { color: orangeRed;}
|
||||||
|
.btn-orange { background-color: orangeRed; color: white;}
|
||||||
|
.btn-orange:hover { background-color: #ff3600; color: white;}
|
||||||
|
.text-orange { color: orangeRed;}
|
||||||
|
/* A partir de dispositivos medianos (>=768px), deja espacio lateral */
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.content { margin-left: 250px; /* Ancho del sidebar */ }
|
||||||
|
.nav-tabs .nav-link { padding: 10px 15px; font-size: 14px; min-width: 120px; }
|
||||||
|
}
|
||||||
|
/* En móviles, sin margen lateral */
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.content { margin-left: 0; }
|
||||||
|
.sidebar .nav-link { font-weight: normal; color: #343a40; background-color: transparent; }
|
||||||
|
.sidebar .nav-link:hover,
|
||||||
|
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
|
||||||
|
}
|
||||||
|
.card { border-radius: 12px; }
|
||||||
|
/* Estilos mejorados para las pestañas */
|
||||||
|
.nav-tabs { border-bottom: 1px solid #dee2e6; margin-bottom: 0; }
|
||||||
|
.nav-tabs .nav-item { margin-bottom: -1px; }
|
||||||
|
.nav-tabs .nav-link { border: 1px solid transparent; border-radius: 0.375rem 0.375rem 0 0; padding: 12px 20px; color: #495057; background-color: #f8f9fa;
|
||||||
|
font-weight: 500; white-space: nowrap; min-width: 150px; text-align: center; transition: all 0.3s ease; }
|
||||||
|
.nav-tabs .nav-link:hover { border-color: #e9ecef #e9ecef #dee2e6; background-color: #e9ecef; color: #212529; }
|
||||||
|
.nav-tabs .nav-link.active { color: #495057; background-color: #fff; border-color: #dee2e6 #dee2e6 #fff; border-bottom: 2px solid #fff; }
|
||||||
|
/* Asegurar que las pestañas sean completamente visibles */
|
||||||
|
.nav-tabs .nav-item:first-child .nav-link { margin-left: 0; }
|
||||||
|
.nav-tabs .nav-item:last-child .nav-link { margin-right: 0; }
|
||||||
|
.tab-content { padding: 5px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<h4>CONFIGURACIÓN ADUANA / PATENTE</h4>
|
||||||
|
<div class="card p-4 shadow-sm bg-white">
|
||||||
|
<!-- Se agrega enctype para subir archivos -->
|
||||||
|
<form action="/IMPORTADORES/patente/guardar" method="POST" id="formAltaPatente">
|
||||||
|
<!-- Pestañas de navegación -->
|
||||||
|
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link active" id="general-tab" data-bs-toggle="tab" data-bs-target="#general"
|
||||||
|
type="button" role="tab" aria-controls="general" aria-selected="true">
|
||||||
|
General
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="validacion-tab" data-bs-toggle="tab" data-bs-target="#validacion"
|
||||||
|
type="button" role="tab" aria-controls="validacion" aria-selected="false">
|
||||||
|
Números de Validación y Folios
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- Contenido de las pestañas -->
|
||||||
|
<div class="tab-content" id="myTabContent">
|
||||||
|
<!-- Pestaña General -->
|
||||||
|
<div class="tab-pane fade show active" id="general" role="tabpanel" aria-labelledby="general-tab">
|
||||||
|
<p style="font-weight: bold;">Datos de la Patente / Aduana</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="aduana" class="col-md-2 col-form-label">Aduana</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input name="aduana" id="aduana" type="text" maxlength="3" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<label for="aduana" class="col-md-2 col-form-label">[ Sin Sección ]</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="patente" class="col-md-2 col-form-label">Patente</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input name="patente" id="patente" type="text" maxlength="4" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="agente_aduanal" class="col-md-2 col-form-label">Agente Aduanal</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input name="agente_aduanal" id="agente_aduanal" type="text" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="rfc" class="col-md-2 col-form-label">RFC</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input name="rfc" id="rfc" type="text" maxlength="13" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="curp" class="col-md-2 col-form-label">CURP</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input name="curp" id="curp" type="text" maxlength="18" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="razon_social" class="col-md-2 col-form-label">Razón Social</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input name="razon_social" id="razon_social" type="text" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
</div><hr><br>
|
||||||
|
|
||||||
|
<div class="col mb-3">
|
||||||
|
<P>Capturar para el llenado de la Manifestación de Valor</P>
|
||||||
|
<p style="font-weight: bold;">Datos del Agente Aduanal:</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="mf_nombre" class="col-md-2 col-form-label">Nombre(s)</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input name="mf_nombre" id="mf_nombre" type="text" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="mf_paterno" class="col-md-2 col-form-label">Apellido Paterno</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input name="mf_paterno" id="mf_paterno" type="text" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="mf_materno" class="col-md-2 col-form-label">Apellido Materno</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input name="mf_materno" id="mf_materno" type="text" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Pestaña Números de Validación y Folios -->
|
||||||
|
<div class="tab-pane fade" id="validacion" role="tabpanel" aria-labelledby="validacion-tab">
|
||||||
|
<p style="font-weight: bold;">Números de Validación y Folios</p>
|
||||||
|
<!-- Pedimentos -->
|
||||||
|
<p>Números de Validación para Pedimentos</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vp_inicio" class="col-md-1 col-form-label">Inicio:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vp_inicio" id="vp_inicio" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vp_final" class="col-md-1 col-form-label">Final:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vp_final" id="vp_final" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vp_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vp_siguiente" id="vp_siguiente" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
</div><hr>
|
||||||
|
|
||||||
|
<!-- Pago Electrónico -->
|
||||||
|
<p>Números de Validación para Pago Electrónico</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vpe_inicio" class="col-md-1 col-form-label">Inicio:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vpe_inicio" id="vpe_inicio" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vpe_final" class="col-md-1 col-form-label">Final:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vpe_final" id="vpe_final" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vpe_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vpe_siguiente" id="vpe_siguiente" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
</div><hr>
|
||||||
|
|
||||||
|
<!-- Avisos Traslado / Plantas-Bodegas -->
|
||||||
|
<p>Números de Validación para Avisos Traslado / Plantas-Bodegas</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vat_pb_inicio" class="col-md-1 col-form-label">Inicio:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vat_pb_inicio" id="vat_pb_inicio" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vat_pb_final" class="col-md-1 col-form-label">Final:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vat_pb_final" id="vat_pb_final" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vat_pb_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vat_pb_siguiente" id="vat_pb_siguiente" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
</div><hr>
|
||||||
|
|
||||||
|
<!-- Validación y Folio de Cartas Cupo -->
|
||||||
|
<p>Números de Validación para Cartas Cupo</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vcc_inicio" class="col-md-1 col-form-label">Inicio:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vcc_inicio" id="vcc_inicio" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vcc_final" class="col-md-1 col-form-label">Final:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vcc_final" id="vcc_final" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vcc_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vcc_siguiente" id="vcc_siguiente" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
</div><hr>
|
||||||
|
|
||||||
|
<!-- Avisos Electrónicos -->
|
||||||
|
<p>Números de Validación para Avisos Electrónicos</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vae_inicio" class="col-md-1 col-form-label">Inicio:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vae_inicio" id="vae_inicio" type="text" maxlength="3" class="form-control" placeholder="000" value="000">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vae_final" class="col-md-1 col-form-label">Final:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vae_final" id="vae_final" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vae_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vae_siguiente" id="vae_siguiente" type="text" maxlength="3" class="form-control" placeholder="000">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: flex; justify-content: right;">
|
||||||
|
<button type="submit" class="btn btn-success">Guardar</button>
|
||||||
|
<a href="/IMPORTADORES/patente/lista" class="btn btn-secondary ms-2">Cancelar</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('formAltaPatente').addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault(); // Prevenir envío por defecto
|
||||||
|
|
||||||
|
// Obtener todos los campos correctamente
|
||||||
|
const aduana = document.getElementById('aduana').value;
|
||||||
|
const patente = document.getElementById('patente').value;
|
||||||
|
const agente_aduanal = document.getElementById('agente_aduanal').value.trim();
|
||||||
|
const rfc = document.getElementById('rfc').value.trim();
|
||||||
|
const curp = document.getElementById('curp').value.trim();
|
||||||
|
const razon_social = document.getElementById('razon_social').value.trim();
|
||||||
|
|
||||||
|
// Expresiones regulares
|
||||||
|
const rfcRegex = /^[A-ZÑ&]{3,4}\d{6}[A-Z0-9]{3}$/;
|
||||||
|
const curpRegex = /^[A-Z]{4}[0-9]{6}[HM](AS|BC|BS|CC|CL|CM|CS|CH|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS)[A-Z]{3}[A-Z0-9]{2}$/;
|
||||||
|
const soloNumerosRegex = /^[0-9]+$/;
|
||||||
|
|
||||||
|
if (!aduana) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La aduana es obligatoria.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('aduana').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(aduana)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Aduana inválida', text: 'La aduana solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('aduana').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!patente) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La patente es obligatoria.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('patente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(patente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Patente inválida', text: 'La patente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('patente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!agente_aduanal) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El agente aduanal es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('agente_aduanal').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!rfc) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El RFC es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('rfc').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!rfcRegex.test(rfc)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'RFC inválido', text: 'El RFC debe tener 12 o 13 caracteres con el formato correcto (ej. ABC123456XYZ).', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('rfc').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!curp) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El CURP es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('curp').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (curp && !curpRegex.test(curp)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'CURP inválido', text: 'El CURP debe tener 18 caracteres con el formato correcto.', confirmButtonColor: '#dc3545'
|
||||||
|
});
|
||||||
|
document.getElementById('curp').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!razon_social) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La razón social es obligatoria.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('razon_social').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const vp_inicio = document.getElementById('vp_inicio').value;
|
||||||
|
const vp_final = document.getElementById('vp_final').value;
|
||||||
|
const vp_siguiente = document.getElementById('vp_siguiente').value;
|
||||||
|
const vpe_inicio = document.getElementById('vpe_inicio').value;
|
||||||
|
const vpe_final = document.getElementById('vpe_final').value;
|
||||||
|
const vpe_siguiente = document.getElementById('vpe_siguiente').value;
|
||||||
|
const vat_pb_inicio = document.getElementById('vat_pb_inicio').value;
|
||||||
|
const vat_pb_final = document.getElementById('vat_pb_final').value;
|
||||||
|
const vat_pb_siguiente = document.getElementById('vat_pb_siguiente').value;
|
||||||
|
const vcc_inicio = document.getElementById('vcc_inicio').value;
|
||||||
|
const vcc_final = document.getElementById('vcc_final').value;
|
||||||
|
const vcc_siguiente = document.getElementById('vcc_siguiente').value;
|
||||||
|
const vae_inicio = document.getElementById('vae_inicio').value;
|
||||||
|
const vae_final = document.getElementById('vae_final').value;
|
||||||
|
const vae_siguiente = document.getElementById('vae_siguiente').value;
|
||||||
|
|
||||||
|
// Validaciones Números de Validación y Folios
|
||||||
|
if (vp_inicio !== '' && !soloNumerosRegex.test(vp_inicio)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vp_inicio').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vp_final !== '' && !soloNumerosRegex.test(vp_final)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vp_final').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vp_siguiente !== '' && !soloNumerosRegex.test(vp_siguiente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vp_siguiente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vpe_inicio !== '' && !soloNumerosRegex.test(vpe_inicio)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vpe_inicio').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vpe_final !== '' && !soloNumerosRegex.test(vpe_final)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vpe_final').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vpe_siguiente !== '' && !soloNumerosRegex.test(vpe_siguiente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vpe_siguiente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vat_pb_inicio !== '' && !soloNumerosRegex.test(vat_pb_inicio)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vat_pb_inicio').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vat_pb_final !== '' && !soloNumerosRegex.test(vat_pb_final)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vat_pb_final').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vat_pb_siguiente !== '' && !soloNumerosRegex.test(vat_pb_siguiente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vat_pb_siguiente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vcc_inicio !== '' && !soloNumerosRegex.test(vcc_inicio)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vcc_inicio').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vcc_final !== '' && !soloNumerosRegex.test(vcc_final)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vcc_final').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vcc_siguiente !== '' && !soloNumerosRegex.test(vcc_siguiente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vcc_siguiente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vae_inicio !== '' && !soloNumerosRegex.test(vae_inicio)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vae_inicio').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vae_final !== '' && !soloNumerosRegex.test(vae_final)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vae_final').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vae_siguiente !== '' && !soloNumerosRegex.test(vae_siguiente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vae_siguiente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ SI TODAS LAS VALIDACIONES PASAN, ENVIAR EL FORMULARIO
|
||||||
|
// Mostrar indicador de carga
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Guardando...', text: 'Por favor espere', allowOutsideClick: false, showConfirmButton: false,
|
||||||
|
willOpen: () => { Swal.showLoading(); }
|
||||||
|
});
|
||||||
|
|
||||||
|
// SI TODAS LAS VALIDACIONES PASAN, ENVIAR EL FORMULARIO
|
||||||
|
this.submit();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
69
views/patente/dashboard_patente.php
Normal file
69
views/patente/dashboard_patente.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php include __DIR__ . '/../partials/sidebar_agente.php'; ?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Dashboard | Importador</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<style>
|
||||||
|
body { font-family: 'Segoe UI', sans-serif; background-color: #f4f6f9; }
|
||||||
|
.sidebar { width: 220px; height: 100vh; background-color: #343a40; position: fixed; top: 0; left: 0; padding-top: 56px; z-index: 1040; }
|
||||||
|
.sidebar .nav-link { font-weight: bold; color: white; transition: all 0.3s ease; }
|
||||||
|
.sidebar .nav-link:hover,
|
||||||
|
.sidebar .nav-link.active { background-color: #495057; color: #fff; }
|
||||||
|
.content { margin-top: 56px; padding: 40px 20px; position: relative; z-index: 1; background-color: #f4f6f9; transition: margin-left 0.3s ease; }
|
||||||
|
.navbar { position: fixed; top: 0; width: 100%; z-index: 1050; }
|
||||||
|
.btn-indigo { background-color: #6610f2; color: white;}
|
||||||
|
.btn-indigo:hover { background-color: #520dc2; color: white;}
|
||||||
|
.text-indigo { color: orangeRed;}
|
||||||
|
.btn-orange { background-color: orangeRed; color: white;}
|
||||||
|
.btn-orange:hover { background-color: #ff3600; color: white;}
|
||||||
|
.text-orange { color: orangeRed;}
|
||||||
|
/* A partir de dispositivos medianos (>=768px), deja espacio lateral */
|
||||||
|
@media (min-width: 768px) { .content { margin-left: 250px; /* Ancho del sidebar */ } }
|
||||||
|
/* En móviles, sin margen lateral */
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.content { margin-left: 0; }
|
||||||
|
.sidebar .nav-link { font-weight: normal; color: #343a40; background-color: transparent; }
|
||||||
|
.sidebar .nav-link:hover,
|
||||||
|
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
|
||||||
|
}
|
||||||
|
.card { border-radius: 12px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<h4 class="mb-4">📦 Panel del Importador</h4>
|
||||||
|
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card shadow-sm p-3">
|
||||||
|
<h5 class="text-primary">Ver patentes</h5>
|
||||||
|
<p>Revisa y gestiona las patentes.</p>
|
||||||
|
<a href="/IMPORTADORES/patente/lista"
|
||||||
|
class="btn btn-primary btn-sm mt-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/transportes/lista' ? 'active' : '' ?>">
|
||||||
|
Ver transportes
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card shadow-sm p-3">
|
||||||
|
<h5 class="text-success">Nueva patente</h5>
|
||||||
|
<p>Agrega nuevas patentes:</p>
|
||||||
|
<a href="/IMPORTADORES/patente/alta"
|
||||||
|
class="btn btn-success btn-sm mt-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/transportistas/lista' ? 'active' : '' ?>">
|
||||||
|
Ver transportistas
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
459
views/patente/editar.php
Normal file
459
views/patente/editar.php
Normal file
@@ -0,0 +1,459 @@
|
|||||||
|
<?php include __DIR__ . '/../partials/sidebar_agente.php'; ?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Dashboard | Importador</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<!-- SweetAlert2 -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
<style>
|
||||||
|
body { font-family: 'Segoe UI', sans-serif; background-color: #f4f6f9; }
|
||||||
|
.sidebar { width: 220px; height: 100vh; background-color: #343a40; position: fixed; top: 0; left: 0; padding-top: 56px; z-index: 1040; }
|
||||||
|
.sidebar .nav-link { font-weight: bold; color: white; transition: all 0.3s ease; }
|
||||||
|
.sidebar .nav-link:hover,
|
||||||
|
.sidebar .nav-link.active { background-color: #495057; color: #fff; }
|
||||||
|
.content { margin-top: 56px; padding: 40px 20px; position: relative; z-index: 1; background-color: #f4f6f9; transition: margin-left 0.3s ease; }
|
||||||
|
.navbar { position: fixed; top: 0; width: 100%; z-index: 1050; }
|
||||||
|
.btn-indigo { background-color: #6610f2; color: white;}
|
||||||
|
.btn-indigo:hover { background-color: #520dc2; color: white;}
|
||||||
|
.text-indigo { color: orangeRed;}
|
||||||
|
.btn-orange { background-color: orangeRed; color: white;}
|
||||||
|
.btn-orange:hover { background-color: #ff3600; color: white;}
|
||||||
|
.text-orange { color: orangeRed;}
|
||||||
|
/* A partir de dispositivos medianos (>=768px), deja espacio lateral */
|
||||||
|
@media (min-width: 768px) { .content { margin-left: 250px; /* Ancho del sidebar */ } }
|
||||||
|
/* En móviles, sin margen lateral */
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.content { margin-left: 0; }
|
||||||
|
.sidebar .nav-link { font-weight: normal; color: #343a40; background-color: transparent; }
|
||||||
|
.sidebar .nav-link:hover,
|
||||||
|
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
|
||||||
|
}
|
||||||
|
.card { border-radius: 12px; }
|
||||||
|
/* Estilos mejorados para las pestañas */
|
||||||
|
.nav-tabs { border-bottom: 1px solid #dee2e6; margin-bottom: 0; }
|
||||||
|
.nav-tabs .nav-item { margin-bottom: -1px; }
|
||||||
|
.nav-tabs .nav-link { border: 1px solid transparent; border-radius: 0.375rem 0.375rem 0 0; padding: 12px 20px; color: #495057; background-color: #f8f9fa;
|
||||||
|
font-weight: 500; white-space: nowrap; min-width: 150px; text-align: center; transition: all 0.3s ease; }
|
||||||
|
.nav-tabs .nav-link:hover { border-color: #e9ecef #e9ecef #dee2e6; background-color: #e9ecef; color: #212529; }
|
||||||
|
.nav-tabs .nav-link.active { color: #495057; background-color: #fff; border-color: #dee2e6 #dee2e6 #fff; border-bottom: 2px solid #fff; }
|
||||||
|
/* Asegurar que las pestañas sean completamente visibles */
|
||||||
|
.nav-tabs .nav-item:first-child .nav-link { margin-left: 0; }
|
||||||
|
.nav-tabs .nav-item:last-child .nav-link { margin-right: 0; }
|
||||||
|
.tab-content { padding: 5px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<h4>CONFIGURACIÓN ADUANA / PATENTE</h4>
|
||||||
|
<div class="card p-4 shadow-sm bg-white">
|
||||||
|
<!-- Se agrega enctype para subir archivos -->
|
||||||
|
<form action="/IMPORTADORES/patente/actualizar" method="POST" id="formEdicionPatente">
|
||||||
|
<!-- Campo oculto para el ID -->
|
||||||
|
<input type="hidden" name="id_agente" value="<?= htmlspecialchars($agente['id_agente'] ?? '') ?>">
|
||||||
|
<!-- Pestañas de navegación -->
|
||||||
|
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link active" id="general-tab" data-bs-toggle="tab" data-bs-target="#general"
|
||||||
|
type="button" role="tab" aria-controls="general" aria-selected="true">
|
||||||
|
General
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="validacion-tab" data-bs-toggle="tab" data-bs-target="#validacion"
|
||||||
|
type="button" role="tab" aria-controls="validacion" aria-selected="false">
|
||||||
|
Números de Validación y Folios
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- Contenido de las pestañas -->
|
||||||
|
<div class="tab-content" id="myTabContent">
|
||||||
|
<!-- Pestaña General -->
|
||||||
|
<div class="tab-pane fade show active" id="general" role="tabpanel" aria-labelledby="general-tab">
|
||||||
|
<p style="font-weight: bold;">Datos de la Patente / Aduana</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="aduana" class="col-md-2 col-form-label">Aduana</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input name="aduana" id="aduana" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($agente['aduana'] ?? '') ?>" required>
|
||||||
|
</div>
|
||||||
|
<label for="aduana" class="col-md-2 col-form-label">[Sin Sección]</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="patente" class="col-md-2 col-form-label">Patente</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input name="patente" id="patente" type="text" maxlength="4" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($agente['patente'] ?? '') ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="agente_aduanal" class="col-md-2 col-form-label">Agente Aduanal</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input name="agente_aduanal" id="agente_aduanal" type="text" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($agente['agente_aduanal'] ?? '') ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="rfc" class="col-md-2 col-form-label">RFC</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input name="rfc" id="rfc" type="text" maxlength="13" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($agente['rfc'] ?? '') ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="curp" class="col-md-2 col-form-label">CURP</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input name="curp" id="curp" type="text" maxlength="18" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($agente['curp'] ?? '') ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="razon_social" class="col-md-2 col-form-label">Razón Social</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input name="razon_social" id="razon_social" type="text" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($agente['razon_social'] ?? '') ?>" required>
|
||||||
|
</div>
|
||||||
|
</div><hr><br>
|
||||||
|
|
||||||
|
<div class="col mb-3">
|
||||||
|
<P>Capturar para el llenado de la Manifestación de Valor</P>
|
||||||
|
<p>Datos del Agente Aduanal:</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="mf_nombre" class="col-md-2 col-form-label">Nombre(s)</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input name="mf_nombre" id="mf_nombre" type="text" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($agente['mf_nombre'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="mf_paterno" class="col-md-2 col-form-label">Apellido Paterno</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input name="mf_paterno" id="mf_paterno" type="text" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($agente['mf_paterno'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="mf_materno" class="col-md-2 col-form-label">Apellido Materno</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input name="mf_materno" id="mf_materno" type="text" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($agente['mf_materno'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Pestaña Números de Validación y Folios -->
|
||||||
|
<div class="tab-pane fade" id="validacion" role="tabpanel" aria-labelledby="validacion-tab">
|
||||||
|
<p style="font-weight: bold;">Números de Validación y Folios</p>
|
||||||
|
<!-- Pedimentos -->
|
||||||
|
<p>Números de Validación para Pedimentos</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vp_inicio" class="col-md-1 col-form-label">Inicio:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vp_inicio" id="vp_inicio" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vp_inicio'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vp_final" class="col-md-1 col-form-label">Final:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vp_final" id="vp_final" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vp_final'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vp_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vp_siguiente" id="vp_siguiente" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vp_siguiente'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
</div><hr>
|
||||||
|
|
||||||
|
<!-- Pago Electrónico -->
|
||||||
|
<p>Números de Validación para Pago Electrónico</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vpe_inicio" class="col-md-1 col-form-label">Inicio:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vpe_inicio" id="vpe_inicio" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vpe_inicio'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vpe_final" class="col-md-1 col-form-label">Final:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vpe_final" id="vpe_final" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vpe_final'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vpe_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vpe_siguiente" id="vpe_siguiente" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vpe_siguiente'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
</div><hr>
|
||||||
|
|
||||||
|
<!-- Avisos Traslado / Plantas-Bodegas -->
|
||||||
|
<p>Números de Validación para Avisos Traslado / Plantas-Bodegas</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vat_pb_inicio" class="col-md-1 col-form-label">Inicio:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vat_pb_inicio" id="vat_pb_inicio" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vat_pb_inicio'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vat_pb_final" class="col-md-1 col-form-label">Final:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vat_pb_final" id="vat_pb_final" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vat_pb_final'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vat_pb_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vat_pb_siguiente" id="vat_pb_siguiente" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vat_pb_siguiente'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
</div><hr>
|
||||||
|
|
||||||
|
<!-- Validación y Folio de Cartas Cupo -->
|
||||||
|
<p>Números de Validación para Cartas Cupo</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vcc_inicio" class="col-md-1 col-form-label">Inicio:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vcc_inicio" id="vcc_inicio" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vcc_inicio'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vcc_final" class="col-md-1 col-form-label">Final:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vcc_final" id="vcc_final" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vcc_final'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vcc_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vcc_siguiente" id="vcc_siguiente" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vcc_siguiente'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
</div><hr>
|
||||||
|
|
||||||
|
<!-- Avisos Electrónicos -->
|
||||||
|
<p>Números de Validación para Avisos Electrónicos</p>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vae_inicio" class="col-md-1 col-form-label">Inicio:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vae_inicio" id="vae_inicio" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vae_inicio'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vae_final" class="col-md-1 col-form-label">Final:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vae_final" id="vae_final" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vae_final'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<label for="vae_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input name="vae_siguiente" id="vae_siguiente" type="text" maxlength="3" class="form-control"
|
||||||
|
value="<?= htmlspecialchars(sprintf('%03d', $agente['vae_siguiente'] ?? '0')) ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: flex; justify-content: right;">
|
||||||
|
<button type="submit" class="btn btn-success">Guardar</button>
|
||||||
|
<a href="/IMPORTADORES/patente/lista" class="btn btn-secondary ms-2">Cancelar</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('formEdicionPatente').addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault(); // Prevenir envío por defecto
|
||||||
|
|
||||||
|
// Obtener todos los campos correctamente
|
||||||
|
const aduana = document.getElementById('aduana').value;
|
||||||
|
const patente = document.getElementById('patente').value;
|
||||||
|
const agente_aduanal = document.getElementById('agente_aduanal').value.trim();
|
||||||
|
const rfc = document.getElementById('rfc').value.trim();
|
||||||
|
const curp = document.getElementById('curp').value.trim();
|
||||||
|
const razon_social = document.getElementById('razon_social').value.trim();
|
||||||
|
|
||||||
|
// Expresiones regulares
|
||||||
|
const rfcRegex = /^[A-ZÑ&]{3,4}\d{6}[A-Z0-9]{3}$/;
|
||||||
|
const curpRegex = /^[A-Z]{4}[0-9]{6}[HM](AS|BC|BS|CC|CL|CM|CS|CH|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS)[A-Z]{3}[A-Z0-9]{2}$/;
|
||||||
|
const soloNumerosRegex = /^[0-9]+$/;
|
||||||
|
|
||||||
|
if (!aduana) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La aduana es obligatoria.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('aduana').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(aduana)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Aduana inválida', text: 'La aduana solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('aduana').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!patente) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La patente es obligatoria.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('patente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(patente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Patente inválida', text: 'La patente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('patente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!agente_aduanal) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El agente aduanal es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('agente_aduanal').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!rfc) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El RFC es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('rfc').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!rfcRegex.test(rfc)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'RFC inválido', text: 'El RFC debe tener 12 o 13 caracteres con el formato correcto (ej. ABC123456XYZ).', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('rfc').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!curp) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El CURP es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('curp').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (curp && !curpRegex.test(curp)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'CURP inválido', text: 'El CURP debe tener 18 caracteres con el formato correcto.', confirmButtonColor: '#dc3545'
|
||||||
|
});
|
||||||
|
document.getElementById('curp').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!razon_social) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La razón social es obligatoria.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('razon_social').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const vp_inicio = document.getElementById('vp_inicio').value;
|
||||||
|
const vp_final = document.getElementById('vp_final').value;
|
||||||
|
const vp_siguiente = document.getElementById('vp_siguiente').value;
|
||||||
|
const vpe_inicio = document.getElementById('vpe_inicio').value;
|
||||||
|
const vpe_final = document.getElementById('vpe_final').value;
|
||||||
|
const vpe_siguiente = document.getElementById('vpe_siguiente').value;
|
||||||
|
const vat_pb_inicio = document.getElementById('vat_pb_inicio').value;
|
||||||
|
const vat_pb_final = document.getElementById('vat_pb_final').value;
|
||||||
|
const vat_pb_siguiente = document.getElementById('vat_pb_siguiente').value;
|
||||||
|
const vcc_inicio = document.getElementById('vcc_inicio').value;
|
||||||
|
const vcc_final = document.getElementById('vcc_final').value;
|
||||||
|
const vcc_siguiente = document.getElementById('vcc_siguiente').value;
|
||||||
|
const vae_inicio = document.getElementById('vae_inicio').value;
|
||||||
|
const vae_final = document.getElementById('vae_final').value;
|
||||||
|
const vae_siguiente = document.getElementById('vae_siguiente').value;
|
||||||
|
|
||||||
|
// Validaciones Números de Validación y Folios
|
||||||
|
if (!soloNumerosRegex.test(vp_inicio)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vp_inicio').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vp_final)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vp_final').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vp_siguiente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vp_siguiente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vpe_inicio)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vpe_inicio').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vpe_final)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vpe_final').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vpe_siguiente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vpe_siguiente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vat_pb_inicio)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vat_pb_inicio').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vat_pb_final)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vat_pb_final').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vat_pb_siguiente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vat_pb_siguiente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vcc_inicio)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vcc_inicio').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vcc_final)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vcc_final').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vcc_siguiente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vcc_siguiente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vae_inicio)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vae_inicio').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vae_final)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vae_final').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!soloNumerosRegex.test(vae_siguiente)) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
|
document.getElementById('vae_siguiente').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ SI TODAS LAS VALIDACIONES PASAN, ENVIAR EL FORMULARIO
|
||||||
|
// Mostrar indicador de carga
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Guardando...', text: 'Por favor espere', allowOutsideClick: false, showConfirmButton: false,
|
||||||
|
willOpen: () => { Swal.showLoading(); }
|
||||||
|
});
|
||||||
|
|
||||||
|
// SI TODAS LAS VALIDACIONES PASAN, ENVIAR EL FORMULARIO
|
||||||
|
this.submit();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
120
views/patente/lista.php
Normal file
120
views/patente/lista.php
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?php include __DIR__ . '/../partials/sidebar_agente.php'; ?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Dashboard | Importador</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
|
||||||
|
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
|
||||||
|
<style>
|
||||||
|
body { font-family: 'Segoe UI', sans-serif; background-color: #f4f6f9; }
|
||||||
|
.sidebar { width: 220px; height: 100vh; background-color: #343a40; position: fixed; top: 0; left: 0; padding-top: 56px; z-index: 1040; }
|
||||||
|
.sidebar .nav-link { font-weight: bold; color: white; transition: all 0.3s ease; }
|
||||||
|
.sidebar .nav-link:hover,
|
||||||
|
.sidebar .nav-link.active { background-color: #495057; color: #fff; }
|
||||||
|
.content { margin-top: 56px; padding: 40px 20px; position: relative; z-index: 1; background-color: #f4f6f9; transition: margin-left 0.3s ease; }
|
||||||
|
.navbar { position: fixed; top: 0; width: 100%; z-index: 1050; }
|
||||||
|
.btn-indigo { background-color: #6610f2; color: white;}
|
||||||
|
.btn-indigo:hover { background-color: #520dc2; color: white;}
|
||||||
|
.text-indigo { color: orangeRed;}
|
||||||
|
.btn-orange { background-color: orangeRed; color: white;}
|
||||||
|
.btn-orange:hover { background-color: #ff3600; color: white;}
|
||||||
|
.text-orange { color: orangeRed;}
|
||||||
|
/* A partir de dispositivos medianos (>=768px), deja espacio lateral */
|
||||||
|
@media (min-width: 768px) { .content { margin-left: 250px; /* Ancho del sidebar */ } }
|
||||||
|
/* En móviles, sin margen lateral */
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.content { margin-left: 0; }
|
||||||
|
.sidebar .nav-link { font-weight: normal; color: #343a40; background-color: transparent; }
|
||||||
|
.sidebar .nav-link:hover,
|
||||||
|
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
|
||||||
|
}
|
||||||
|
.card { border-radius: 12px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<h4>📑 Registro de Patentes Aduanales</h4>
|
||||||
|
<a href="/IMPORTADORES/patente/alta" class="btn btn-success mb-3">➕ Nueva Patente</a>
|
||||||
|
<div class="card p-3 shadow-sm">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped" id="tabla-patentes">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Aduana</th>
|
||||||
|
<th>Patente</th>
|
||||||
|
<th>Agente Aduanal</th>
|
||||||
|
<th>RFC</th>
|
||||||
|
<th>CURP</th>
|
||||||
|
<th>Razón Social</th>
|
||||||
|
<th>Acciones</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach($agentes_aduanales as $aa): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= $aa['id_agente'] ?></td>
|
||||||
|
<td><?= htmlspecialchars($aa['aduana']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($aa['patente']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($aa['agente_aduanal']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($aa['rfc']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($aa['curp']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($aa['razon_social']) ?></td>
|
||||||
|
<td>
|
||||||
|
<a href="/IMPORTADORES/patente/editar?id=<?= $aa['id_agente'] ?>" class="btn btn-sm btn-primary">✏️</a>
|
||||||
|
<button class="btn btn-sm btn-danger" onclick="confirmDeleteChofer(<?= $aa['id_agente'] ?>)">🗑️</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function confirmDeleteChofer(id) {
|
||||||
|
Swal.fire({
|
||||||
|
title: '¿Eliminar agente aduanal?',
|
||||||
|
text: 'Esto sólo lo marcara como inactivo.',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Sí, eliminar',
|
||||||
|
cancelButtonText: 'Cancelar',
|
||||||
|
confirmButtonColor: '#d33'
|
||||||
|
}).then(r => {
|
||||||
|
if (r.isConfirmed) {
|
||||||
|
window.location = `/IMPORTADORES/patente/eliminar?id=${id}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#tabla-patentes').DataTable({
|
||||||
|
language: {
|
||||||
|
url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
<?php if(isset($_GET['deleted'])): ?>
|
||||||
|
Swal.fire('¡Hecho!','Agente eliminado.','success');
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if(isset($_GET['created'])): ?>
|
||||||
|
Swal.fire('¡Listo!','Agente creado.','success');
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if(isset($_GET['updated'])): ?>
|
||||||
|
Swal.fire('¡Listo!','Agente actualizado.','success');
|
||||||
|
<?php endif; ?>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -11,6 +11,8 @@ $dos_factores_estado = obtenerEstadoDosFactores();
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
body { font-family: 'Segoe UI', sans-serif; background-color: #f4f6f9; }
|
body { font-family: 'Segoe UI', sans-serif; background-color: #f4f6f9; }
|
||||||
.sidebar { width: 220px; height: 100vh; background-color: #343a40; position: fixed; top: 0; left: 0; padding-top: 56px; z-index: 1040; }
|
.sidebar { width: 220px; height: 100vh; background-color: #343a40; position: fixed; top: 0; left: 0; padding-top: 56px; z-index: 1040; }
|
||||||
@@ -29,6 +31,17 @@ $dos_factores_estado = obtenerEstadoDosFactores();
|
|||||||
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
|
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
|
||||||
}
|
}
|
||||||
.card { border-radius: 12px; }
|
.card { border-radius: 12px; }
|
||||||
|
.btn i { font-family: "Font Awesome 6 Free", sans-serif; margin-right: 0.5rem; }
|
||||||
|
.btn { font-family: 'Segoe UI', sans-serif; }
|
||||||
|
.modal-header.bg-primary { background: linear-gradient(135deg, #003366, #0055A5) !important; color: white; }
|
||||||
|
.modal-header.bg-success { background: linear-gradient(135deg, #28a745, #20c997) !important; color: white; }
|
||||||
|
.codigo-input { text-align: center; font-size: 1.5rem; letter-spacing: 0.5rem; font-weight: bold; }
|
||||||
|
.intentos-restantes { color: #dc3545; font-weight: bold; }
|
||||||
|
.password-strength { height: 4px; border-radius: 2px; margin-top: 5px; transition: all 0.3s ease; }
|
||||||
|
.strength-weak { background-color: #dc3545; }
|
||||||
|
.strength-medium { background-color: #ffc107; }
|
||||||
|
.strength-strong { background-color: #28a745; }
|
||||||
|
.btn-loading { pointer-events: none; opacity: 0.6; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -38,10 +51,10 @@ $dos_factores_estado = obtenerEstadoDosFactores();
|
|||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
|
|
||||||
<!-- Autenticacin de dos factores -->
|
<!-- Autenticacin de dos factores -->
|
||||||
<div class="col-md-7">
|
<div class="col-md-6">
|
||||||
<div class="card shadow-sm p-3">
|
<div class="card shadow-sm p-3">
|
||||||
<h4 class="mb-4 text-dark">Autenticación de dos factores</h4>
|
<h4 class="mb-4 text-dark">Autenticación de dos factores</h4>
|
||||||
<p>Al activar esta funcionalidad, blindas el acceso a tu cuenta, recibiras un código de acceso a tu correo electrónico para confirmar identidad</p>
|
<p>Al activar esta funcionalidad, blindas el acceso a tu cuenta, recibiras un código de acceso a tu correo electrónico para confirmar identidad.</p>
|
||||||
<form method="post" action="/IMPORTADORES/seguridad/autenticacionDosFactores">
|
<form method="post" action="/IMPORTADORES/seguridad/autenticacionDosFactores">
|
||||||
<div class="form-check form-switch mb-3">
|
<div class="form-check form-switch mb-3">
|
||||||
<input type="checkbox" name="dos_factores" id="dos_factores" class="form-check-input"
|
<input type="checkbox" name="dos_factores" id="dos_factores" class="form-check-input"
|
||||||
@@ -50,57 +63,73 @@ $dos_factores_estado = obtenerEstadoDosFactores();
|
|||||||
<?php echo ($dos_factores_estado == 1) ? "Activo" : "Inactivo"; ?>
|
<?php echo ($dos_factores_estado == 1) ? "Activo" : "Inactivo"; ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Guardar configuración</button>
|
<button type="submit" class="btn btn-primary"><i class="fas fa-floppy-disk"></i>Guardar configuración</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6 hide"></div>
|
||||||
|
|
||||||
<!-- Correo adicional (extra) -->
|
<!-- Correo adicional (extra) -->
|
||||||
<div class="col-md-7">
|
<div class="col-md-6">
|
||||||
<div class="card shadow-sm p-3">
|
<div class="card shadow-sm p-3">
|
||||||
<h4 class="mb-4 text-dark">Recibe Notificaciones</h4>
|
<h4 class="mb-4 text-dark">Recibe notificaciones</h4>
|
||||||
<p>Agrega un correo adicional para recibir notificaciones.</p>
|
<p>Agrega un correo adicional para recibir notificaciones.</p>
|
||||||
<?php if (!empty($correos['correo_extra'])): ?>
|
<?php if (!empty($correos['correo_extra'])): ?>
|
||||||
<p><?= htmlspecialchars($correos['correo_extra']) ?></p>
|
<p><code><?= htmlspecialchars($correos['correo_extra']) ?></code></p>
|
||||||
<form method="POST" action="/IMPORTADORES/seguridad/modificarCorreoExtra">
|
<!-- Formulario para eliminar -->
|
||||||
<div class="mb-3">
|
<form method="POST" action="/IMPORTADORES/seguridad/eliminarCorreoExtra" id="form-eliminar-extra" class="mt-2 hide"></form>
|
||||||
<input type="email" name="email-extra" class="form-control" value="<?= htmlspecialchars($correos['correo_extra']) ?>" required>
|
<form method="POST" action="/IMPORTADORES/seguridad/modificarCorreoExtra">
|
||||||
</div>
|
<div class="mb-3">
|
||||||
<div class="mb-3">
|
<input type="email" name="email-extra" class="form-control" value="" placeholder="Actualizar correo adicional" required>
|
||||||
<button type="submit" class="btn btn-success">Actualizar</button>
|
</div>
|
||||||
</div>
|
<div class="d-flex gap-2">
|
||||||
</form>
|
<button type="submit" class="btn btn-success">
|
||||||
|
<i class="fas fa-edit"></i>Actualizar
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-danger" onclick="confirmarEliminacion('extra')">
|
||||||
|
<i class="fas fa-trash"></i> Eliminar correo
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<form method="POST" action="/IMPORTADORES/seguridad/correoExtra">
|
<form method="POST" action="/IMPORTADORES/seguridad/correoExtra">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<input type="email" name="email-extra" class="form-control" placeholder="Correo adicional" required>
|
<input type="email" name="email-extra" class="form-control" placeholder="Correo adicional" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Registrar</button>
|
<button type="submit" class="btn btn-primary"><i class="fas fa-envelope"></i>Registrar</button>
|
||||||
</form>
|
</form>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Correo de Respaldo -->
|
<!-- Correo de Respaldo -->
|
||||||
<div class="col-md-7">
|
<div class="col-md-6">
|
||||||
<div class="card shadow-sm p-3">
|
<div class="card shadow-sm p-3">
|
||||||
<h4 class="mb-4 text-dark">Correo de Respaldo</h4>
|
<h4 class="mb-4 text-dark">Correo de respaldo</h4>
|
||||||
<p>Agrega un correo de respaldo para reuperación de tu cuenta.</p>
|
<p>Agrega un correo de respaldo para reuperación de tu cuenta.</p>
|
||||||
<?php if (!empty($correos['correo_respaldo'])): ?>
|
<?php if (!empty($correos['correo_respaldo'])): ?>
|
||||||
<p><?= htmlspecialchars($correos['correo_respaldo']) ?></p>
|
<p><code><?= htmlspecialchars($correos['correo_respaldo']) ?></code></p>
|
||||||
<form method="POST" action="/IMPORTADORES/seguridad/modificarCorreoRspaldo">
|
<!-- Formulario para eliminar -->
|
||||||
<div class="mb-3">
|
<form method="POST" action="/IMPORTADORES/seguridad/eliminarCorreoRespaldo" id="form-eliminar-respaldo" class="mt-2 hide"></form>
|
||||||
<input type="email" name="email-respaldo" class="form-control" value="<?= htmlspecialchars($correos['correo_respaldo']) ?>" required>
|
<form method="POST" action="/IMPORTADORES/seguridad/modificarCorreoRspaldo">
|
||||||
</div>
|
<div class="mb-3">
|
||||||
<button type="submit" class="btn btn-success">Actualizar</button>
|
<input type="email" name="email-respaldo" class="form-control" value="" placeholder="Actualizar correo de respaldo" required>
|
||||||
</form>
|
</div>
|
||||||
|
<button type="submit" class="btn btn-success">
|
||||||
|
<i class="fas fa-edit"></i>Actualizar
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-danger" onclick="confirmarEliminacion('respaldo')">
|
||||||
|
<i class="fas fa-trash"></i> Eliminar correo
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<form method="POST" action="/IMPORTADORES/seguridad/correoRespaldo">
|
<form method="POST" action="/IMPORTADORES/seguridad/correoRespaldo">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<input type="email" name="email-respaldo" class="form-control" placeholder="Correo de respaldo" required>
|
<input type="email" name="email-respaldo" class="form-control" placeholder="Correo de respaldo" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Registrar</button>
|
<button type="submit" class="btn btn-primary"><i class="fas fa-envelope"></i>Registrar</button>
|
||||||
</form>
|
</form>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -115,6 +144,61 @@ $dos_factores_estado = obtenerEstadoDosFactores();
|
|||||||
chk.addEventListener('change', () => {
|
chk.addEventListener('change', () => {
|
||||||
label.textContent = chk.checked ? 'Activo' : 'Inactivo';
|
label.textContent = chk.checked ? 'Activo' : 'Inactivo';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Función para confirmar eliminación con SweetAlert
|
||||||
|
function confirmarEliminacion(tipo) {
|
||||||
|
const mensajes = {
|
||||||
|
'extra': {
|
||||||
|
titulo: '¿Eliminar correo adicional?',
|
||||||
|
texto: 'No podrás recibir notificaciones en este correo.',
|
||||||
|
confirmado: 'Correo adicional eliminado',
|
||||||
|
form: 'form-eliminar-extra'
|
||||||
|
},
|
||||||
|
'respaldo': {
|
||||||
|
titulo: '¿Eliminar correo de respaldo?',
|
||||||
|
texto: 'No podrás recuperar tu cuenta con este correo.',
|
||||||
|
confirmado: 'Correo de respaldo eliminado',
|
||||||
|
form: 'form-eliminar-respaldo'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const config = mensajes[tipo];
|
||||||
|
|
||||||
|
swal({
|
||||||
|
title: config.titulo,
|
||||||
|
text: config.texto,
|
||||||
|
icon: "warning",
|
||||||
|
buttons: {
|
||||||
|
cancel: {
|
||||||
|
text: "Cancelar",
|
||||||
|
visible: true,
|
||||||
|
className: "btn-secondary"
|
||||||
|
},
|
||||||
|
confirm: {
|
||||||
|
text: "Sí, eliminar",
|
||||||
|
className: "btn-danger"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dangerMode: true,
|
||||||
|
})
|
||||||
|
.then((eliminar) => {
|
||||||
|
if (eliminar) {
|
||||||
|
// Mostrar mensaje de éxito y enviar formulario
|
||||||
|
swal({
|
||||||
|
title: "¡Eliminado!",
|
||||||
|
text: config.confirmado,
|
||||||
|
icon: "success",
|
||||||
|
timer: 1500,
|
||||||
|
buttons: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// Enviar el formulario después de un pequeño delay
|
||||||
|
setTimeout(() => {
|
||||||
|
document.getElementById(config.form).submit();
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -34,25 +34,29 @@
|
|||||||
<h4 class="mb-4">👮 Seguridad</h4>
|
<h4 class="mb-4">👮 Seguridad</h4>
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
|
|
||||||
<div class="col-md-7">
|
<div class="col-md-6">
|
||||||
<div class="card shadow-sm p-3">
|
<div class="card shadow-sm p-3">
|
||||||
<h4 class="mb-4 text-dark">Autenticación de dos factores</h4>
|
<h4 class="mb-4 text-dark">Autenticación de dos factores</h4>
|
||||||
|
<p>Al activar esta funcionalidad, blindas el acceso a tu cuenta, recibiras un código de acceso a tu correo electrónico para confirmar identidad.</p>
|
||||||
<form>
|
<form>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input type="checkbox" class="form-check-input" role="switch"
|
<input type="checkbox" class="form-check-input" role="switch"
|
||||||
id="dos_factores" name="dos_factores" disabled
|
id="dos_factores" name="dos_factores" disabled
|
||||||
<?php if(!empty($correos['dos_factores'])) echo "checked"; ?>>
|
<?php if(!empty($correos['dos_factores'])) echo "checked"; ?>>
|
||||||
<label class="form-check-label" for="dos_factores">
|
<label class="form-check-label" for="dos_factores">
|
||||||
<?php echo !empty($correos['dos_factores']) ? "Activo" : "Inactivo"; ?>
|
<?php echo !empty($correos['dos_factores']) ? "Activo" : "Inactivo"; ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-7">
|
<div class="col-md-6 hide"></div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
<div class="card shadow-sm p-3">
|
<div class="card shadow-sm p-3">
|
||||||
<h4 class="mb-4 text-dark">Recibe notificaciones</h4>
|
<h4 class="mb-4 text-dark">Recibe notificaciones</h4>
|
||||||
|
<p>Agrega un correo adicional para recibir notificaciones.</p>
|
||||||
<form>
|
<form>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Correo electrónico adicional</label>
|
<label class="form-label">Correo electrónico adicional</label>
|
||||||
@@ -62,9 +66,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-7">
|
<div class="col-md-6">
|
||||||
<div class="card shadow-sm p-3">
|
<div class="card shadow-sm p-3">
|
||||||
<h4 class="mb-4 text-dark">Correo de respaldo</h4>
|
<h4 class="mb-4 text-dark">Correo de respaldo</h4>
|
||||||
|
<p>Agrega un correo de respaldo para reuperación de tu cuenta.</p>
|
||||||
<form>
|
<form>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Correo electrónico de respaldo</label>
|
<label class="form-label">Correo electrónico de respaldo</label>
|
||||||
|
|||||||
@@ -184,7 +184,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!soloNumerosRegex.test(caat)) {
|
if (!soloNumerosRegex.test(caat)) {
|
||||||
Swal.fire({ icon: 'error', title: 'Código CAAT inválido', text: 'El código caat solo puede contener números', confirmButtonColor: '#dc3545' });
|
Swal.fire({ icon: 'error', title: 'Código CAAT inválido', text: 'El código caat solo puede contener números.', confirmButtonColor: '#dc3545' });
|
||||||
document.getElementById('caat').focus();
|
document.getElementById('caat').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
function confirmDelete(id) {
|
function confirmDelete(id) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: '¿Eliminar transportista?',
|
title: '¿Eliminar transportista?',
|
||||||
text: 'Esto sólo lo eliminara completamente y no se podrá volver a usar.',
|
text: 'Esto sólo lo marcara como inactivo',
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: 'Sí, eliminar',
|
confirmButtonText: 'Sí, eliminar',
|
||||||
|
|||||||
Reference in New Issue
Block a user