up
This commit is contained in:
+12
-2
@@ -1717,11 +1717,21 @@ const agendaNueva = {
|
||||
// Validar teléfono si fue ingresado
|
||||
const telRaw = document.getElementById('na-np-telefono').value.trim();
|
||||
if (telRaw) {
|
||||
const prefijo = document.getElementById('na-np-prefijo').value || '57';
|
||||
const telDigits = telRaw.replace(/[^0-9]/g, '');
|
||||
if (!/^(57)?3\d{9}$/.test(telDigits)) {
|
||||
const esColombia = prefijo === '57';
|
||||
if (esColombia) {
|
||||
const sinPref = telDigits.replace(/^57/, '');
|
||||
if (!/^3\d{9}$/.test(sinPref)) {
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="fas fa-calendar-check me-1"></i>Agendar';
|
||||
this._mostrarError('El celular colombiano debe comenzar por 3 y tener 10 dígitos. Ej: 3001234567.');
|
||||
return;
|
||||
}
|
||||
} else if (telDigits.length < 6 || telDigits.length > 15) {
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="fas fa-calendar-check me-1"></i>Agendar';
|
||||
this._mostrarError('El celular debe comenzar por 3 y tener 10 dígitos. Ej: 3001234567.');
|
||||
this._mostrarError('El número telefónico no es válido (entre 6 y 15 dígitos).');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user