Vinculaciones multi-agencia
This commit is contained in:
@@ -121,29 +121,29 @@
|
||||
document.getElementById('formEditTransportista').addEventListener('submit', function(e) {
|
||||
e.preventDefault(); // Prevenir envío por defecto
|
||||
|
||||
const rfcInput = document.getElementById('rfc');
|
||||
const curpInput = document.getElementById('curp');
|
||||
const rfcInput = document.getElementById('rfc');
|
||||
const curpInput = document.getElementById('curp');
|
||||
const telefonoInput = document.getElementById('telefono');
|
||||
|
||||
const rfc = rfcInput.value.trim().toUpperCase();
|
||||
const curp = curpInput.value.trim();
|
||||
const telefono = telefonoInput.value.trim();
|
||||
const clave = document.getElementById('clave').value.trim();
|
||||
const nombre = document.getElementById('nombre').value.trim();
|
||||
const caat = document.getElementById('caat').value.trim();
|
||||
const pais = document.getElementById('pais').value;
|
||||
const entidad = document.getElementById('entidad').value;
|
||||
const ciudad = document.getElementById('ciudad').value;
|
||||
const rfc = rfcInput.value.trim().toUpperCase();
|
||||
const curp = curpInput.value.trim();
|
||||
const telefono = telefonoInput.value.trim();
|
||||
const clave = document.getElementById('clave').value.trim();
|
||||
const nombre = document.getElementById('nombre').value.trim();
|
||||
const caat = document.getElementById('caat').value.trim();
|
||||
const pais = document.getElementById('pais').value;
|
||||
const entidad = document.getElementById('entidad').value;
|
||||
const ciudad = document.getElementById('ciudad').value;
|
||||
const domicilio = document.getElementById('domicilio').value.trim();
|
||||
|
||||
// Expresiones regulares
|
||||
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 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 rfcRegex = /^[A-ZÑ&]{3,4}\d{6}[A-Z0-9]{3}$/;
|
||||
const telefonoRegex = /^\d{3}\s\d{7}$/;
|
||||
|
||||
// Validaciones de campos obligatorios
|
||||
if (!clave) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La clave es obligatoria.', confirmButtonColor: '#dc3545' });
|
||||
Swal.fire({ icon: 'warning', title: 'Campo requerido', text: 'La clave es obligatoria.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('clave').focus();
|
||||
return;
|
||||
}
|
||||
@@ -153,12 +153,12 @@
|
||||
return;
|
||||
}
|
||||
if (!nombre) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El nombre es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
Swal.fire({ icon: 'warning', title: 'Campo requerido', text: 'El nombre es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('nombre').focus();
|
||||
return;
|
||||
}
|
||||
if (!rfc) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El RFC es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
Swal.fire({ icon: 'warning', title: 'Campo requerido', text: 'El RFC es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('rfc').focus();
|
||||
return;
|
||||
}
|
||||
@@ -169,13 +169,12 @@
|
||||
}
|
||||
// Validación de CURP (solo si se ingresó)
|
||||
if (curp && !curpRegex.test(curp)) {
|
||||
Swal.fire({ icon: 'error', title: 'CURP inválido', text: 'El CURP no tiene el formato correcto.', confirmButtonColor: '#dc3545'
|
||||
});
|
||||
Swal.fire({ icon: 'error', title: 'CURP inválido', text: 'El CURP no tiene el formato correcto.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('curp').focus();
|
||||
return;
|
||||
}
|
||||
if (!telefono) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El teléfono es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
Swal.fire({ icon: 'warning', title: 'Campo requerido', text: 'El teléfono es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('telefono').focus();
|
||||
return;
|
||||
}
|
||||
@@ -190,27 +189,27 @@
|
||||
return;
|
||||
}
|
||||
if (!caat) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El código caat es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
Swal.fire({ icon: 'warning', title: 'Campo requerido', text: 'El código caat es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('caat').focus();
|
||||
return;
|
||||
}
|
||||
if (!pais) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'Debe seleccionar un país.', confirmButtonColor: '#dc3545' });
|
||||
Swal.fire({ icon: 'warning', title: 'Campo requerido', text: 'Debe seleccionar un país.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('pais').focus();
|
||||
return;
|
||||
}
|
||||
if (!entidad) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'Debe seleccionar un estado.', confirmButtonColor: '#dc3545' });
|
||||
Swal.fire({ icon: 'warning', title: 'Campo requerido', text: 'Debe seleccionar un estado.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('entidad').focus();
|
||||
return;
|
||||
}
|
||||
if (!ciudad) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'Debe seleccionar una ciudad.', confirmButtonColor: '#dc3545' });
|
||||
Swal.fire({ icon: 'warning', title: 'Campo requerido', text: 'Debe seleccionar una ciudad.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('ciudad').focus();
|
||||
return;
|
||||
}
|
||||
if (!domicilio) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El domicilio es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
Swal.fire({ icon: 'warning', title: 'Campo requerido', text: 'El domicilio es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('domicilio').focus();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user