This commit is contained in:
Lizandro Guarnizo
2026-05-27 21:39:53 -05:00
parent 2f72d87c3b
commit b317639258
3 changed files with 33 additions and 7 deletions
+12 -2
View File
@@ -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;
}
}