Revisión 2.1
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
|
||||
<div class="col-md-4">
|
||||
<label for="curp" class="form-label">CURP *</label>
|
||||
<input name="curp" id="curp" class="form-control" maxlength="18" required>
|
||||
<input name="curp" id="curp" class="form-control" maxlength="18">
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
@@ -57,7 +57,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label for="caat" class="form-label">Código CAAT *</label>
|
||||
<label for="caat" class="form-label">Código caat *</label>
|
||||
<input name="caat" id="caat" class="form-control" maxlength="20" required>
|
||||
</div>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
<div class="col-md-8">
|
||||
<label for="domicilio" class="form-label">Domicilio *</label>
|
||||
<input name="domicilio" id="domicilio" class="form-control" required>
|
||||
<input name="domicilio" id="domicilio" class="form-control" maxlength="100" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -123,7 +123,6 @@
|
||||
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}$/;
|
||||
const soloNumerosRegex = /^[0-9]+$/;
|
||||
|
||||
// Validaciones de campos obligatorios
|
||||
if (!clave) {
|
||||
@@ -151,11 +150,6 @@
|
||||
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;
|
||||
}
|
||||
// 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'
|
||||
@@ -179,12 +173,7 @@
|
||||
return;
|
||||
}
|
||||
if (!caat) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El código CAAT es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('caat').focus();
|
||||
return;
|
||||
}
|
||||
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: 'Campo requerido', text: 'El código caat es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('caat').focus();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
id="telefono" class="form-control" maxlength="11" required>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Código CAAT</label>
|
||||
<label class="form-label">Código caat</label>
|
||||
<input name="caat" value="<?= htmlspecialchars($t['caat']) ?>"
|
||||
id="caat" class="form-control" maxlength="20" required>
|
||||
</div>
|
||||
@@ -140,7 +140,6 @@
|
||||
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}$/;
|
||||
const soloNumerosRegex = /^[0-9]+$/;
|
||||
|
||||
// Validaciones de campos obligatorios
|
||||
if (!clave) {
|
||||
@@ -168,11 +167,6 @@
|
||||
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;
|
||||
}
|
||||
// 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'
|
||||
@@ -196,12 +190,7 @@
|
||||
return;
|
||||
}
|
||||
if (!caat) {
|
||||
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El código CAAT es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('caat').focus();
|
||||
return;
|
||||
}
|
||||
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: 'Campo requerido', text: 'El código caat es obligatorio.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('caat').focus();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -67,29 +67,30 @@
|
||||
$('#transportistas-table').DataTable({
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
searchDelay: 500, // espera 500 ms antes de lanzar la búsqueda
|
||||
deferRender: true, // renderiza las filas sólo cuando tiene los datos
|
||||
ajax: {
|
||||
url: '/IMPORTADORES/transportistas/ajax_lista',
|
||||
type: 'GET'
|
||||
},
|
||||
columns: [
|
||||
{ data: 0 },
|
||||
{ data: 1 },
|
||||
{ data: 2 },
|
||||
{ data: 3 },
|
||||
{ data: 4 },
|
||||
{ data: 5 },
|
||||
{ data: 0 }, // ID
|
||||
{ data: 1 }, // Código
|
||||
{ data: 2 }, // Nombre
|
||||
{ data: 3 }, // RFC
|
||||
{ data: 4 }, // Ciudad
|
||||
{ data: 5 }, // Fecha
|
||||
{
|
||||
data: null,
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
render: function(row) {
|
||||
const id = row[0];
|
||||
return `
|
||||
render: function(data, type, row) {
|
||||
const id = row[0];
|
||||
return `
|
||||
<a href="/IMPORTADORES/transportistas/editar?id=${id}" class="btn btn-sm btn-primary">✏️</a>
|
||||
<button class="btn btn-sm btn-danger" onclick="confirmDelete(${id})">🗑️</button>
|
||||
`;
|
||||
`;
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
language: {
|
||||
|
||||
Reference in New Issue
Block a user