1 2/*Bloqueo de teclas*/ 3var nc = (document.layers) ? true : false; 4var ie = (document.all) ? true : false; 5var n6 = (document.getElementById) ? true : false; 6var rutaSesion = ""; 7 8//Valida si hay 3 o mas caracteres consecutivos repetidos ej: AAA 9var regexConsecutivos; 10 11//Valida si hay letras con acentos o dieresis 12var regexAcentosDieresis; 13 14//Valida si el string contiene al menos una letra, incluida la ñ 15var regexAlfabeticos; 16 17//Valida si el texto contiene espacios 18var regexEspacios; 19 20//Valor minimo de caracteres configurable 21var regexMinLength; 22 23//Valor maximo de caracteres configurable 24var regexMaxLength; 25 26//Valida si el texto contiene al menos un caracter especial de los permitidos 27var regexCaracEsp; 28 29//Valida si el texto contiene al menos un numero 30var regexNumerico; 31 32//Valida si el texto tiene el nombre de la institucion en el, debe ser enviado en lowercase 33var regexNombreInstitucion; 34 35//Valida si el texto tiene la identificacion del usuario/cliente, ignora el primer caracter por ejemplo J 36var regexId; 37 38//Valida si el texto tiene alguna parte del nombre del usuario o cliente 39var regexNombres; 40 41//Validador de telefonos, debe ser inicializada por el componente que lo necesite 42var regexTelefonos; 43 44 45window.addEventListener("load", (event) => { 46 InitializeRegexs(); 47 if (top.location == location) { 48 document.querySelector("iframe").addEventListener("load", function (e) { 49 trackIFrameUrl(); 50 }); 51 } 52}); 53 54function BorrarSesssionStorage() { 55 sessionStorage.clear(); 56} 57 58function ValidateSession(relativeRoute, rutaFinSesion) { 59 60 if (!(typeof jQuery === 'undefined') && relativeRoute != null) { 61 $.ajax({ 62 type: "POST", 63 url: relativeRoute + '/ValidateSession', 64 contentType: "application/json; charset=utf-8", 65 dataType: "json", 66 success: OnSuccess, 67 failure: function (response) { 68 window.location.href = rutaFinSesion; 69 } 70 }); 71 72 rutaSesion = rutaFinSesion; 73 } 74 75} 76 77function RenovarSesionMP() { 78 79 var refreshUrl; 80 console.log('RenovarSesionMP'); 81 82 refreshUrl = sessionStorage.getItem("ConvergenciaMPrefreshUrl"); 83 84 if (!refreshUrl) { 85 console.error("No existe refreshUrl"); 86 return; 87 } 88 else { 89 90 $.ajax({ 91 type: "GET", 92 url: refreshUrl, 93 data: "", 94 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 95 dataType: "json", 96 success: function (msg) { 97 if (msg.error != undefined) { 98 console.log(msg.error); 99 BorrarSesssionStorage(); 100 window.location.href = urlCerrarSesion; 101 102 } 103 else { 104 console.log("ValidateSession..."); 105 var sessionToken = msg.session.session_token; 106 107 //Guárdalo para usarlo después 108 sessionStorage.setItem("session_token", sessionToken); 109 110 ValidateSession(urlDefault, urlCerrarSesion); 111 ejecutarServicio(); 112 113 } 114 115 }, 116 error: function (msg) { 117 console.log(msg); 118 BorrarSesssionStorage(); 119 window.location.href = urlCerrarSesion; 120 121 } 122 }); 123 } 124 125} 126 127var tiempoInactividad; 128var tiempoRedireccion; 129 130function ejecutarServicio() { 131 132 console.log(sessionStorage.getItem("session_token")); 133 console.log(urlRenovarCookie); 134 fetch(urlRenovarCookie, { 135 method: "POST", 136 headers: { 137 "Content-Type": "application/x-www-form-urlencoded" 138 }, 139 body: "session_token=" + sessionStorage.getItem("session_token"), 140 credentials: "include" // habilita envÃo/recepción de cookies cross-domain 141 }) 142 .then(res => { 143 if (!res.ok) { 144 throw new Error("HTTP " + res.status); 145 } 146 147 console.log("ejecutarServicio..." + res.status); 148 // Aquà no tratamos el body, solo headers 149 const token = res.headers.get("session_token"); // ejemplo de header personalizado 150 const resultado = res.headers.get("result"); // otro header 151 152 sessionStorage.setItem("session_token", token); 153 154 //document.getElementById("resultado").textContent = 155 //"result: " + resultado + " | session_token: " + token; 156 157 }) 158 .catch(err => { 159 console.log("HTTP error " + err); 160 }); 161} 162 163function openSwalModalSession(htmlToShow) { 164 return Swal.fire({ 165 html: htmlToShow,
166 showCancelButton: false, 167 confirmButtonText: 'Continuar', 168 confirmButtonColor: '#007953', 169 allowOutsideClick: false, 170 allowEscapeKey: false 171 }); 172} 173 174 175 176function iniciarContador() { 177 limpiarTimers(); 178 tiempoInactividad = setTimeout(mostrarPantallaSesion, tiempoAdvertencia); 179} 180 181function mostrarPantallaSesion() { 182 183 openSwalModalSession(mensajeSesionHtml).then(function (result) { 184 185 if (result.value) { 186 // Usuario continuó 187 188 reiniciarSesion(); 189 } 190 191 }); 192 193 // si no hace nada â logout 194 tiempoRedireccion = setTimeout(function () { 195 window.location.href = urlCerrarSesion; 196 }, tiempoExtra); 197} 198 199function reiniciarSesion() { 200 console.log('Sesión renovada'); 201 ValidateSession(urlDefault, urlCerrarSesion); 202 if (sessionStorage.getItem("ConvergenciaActivaMP")) { 203 RenovarSesionMP(); 204 } 205 limpiarTimers(); 206 iniciarContador(); 207} 208 209function limpiarTimers() { 210 clearTimeout(tiempoInactividad); 211 clearTimeout(tiempoRedireccion); 212} 213 214window.addEventListener('keydown', iniciarContador); 215 216(function () { 217 218 var intervaloRenovacionSesion = null; 219 var tiempoRenovacion = 150000; // 2.5 minutos 220 221 function iniciarRenovacionAutomaticaSesion() { 222 223 if (intervaloRenovacionSesion !== null) { 224 return; // ya iniciado 225 } 226 227 console.log("Renovación automática iniciada"); 228 229 RenovarSesionMP(); // opcional: primera renovación inmediata 230 231 intervaloRenovacionSesion = setInterval(function () { 232 RenovarSesionMP(); 233 }, tiempoRenovacion); 234 } 235 236 237 if (window.jQuery) { 238 $(document).ready(function () { 239 iniciarRenovacionAutomaticaSesion(); 240 }); 241 } else { 242 console.error("jQuery no está cargado. No se iniciará la renovación de sesión."); 243 } 244 245})(); 246 247 248 249 250 251 252/** 253 * Funcion que inicializa las expresiones regulares para validaciones dinamicas 254 * */ 255function InitializeRegexs() { 256 if (document.getElementsByClassName("regexs").length > 0) { 257 258 //Valida si hay 3 o mas caracteres consecutivos repetidos ej: AAA 259 regexConsecutivos = new RegExp(document.getElementById("claveFormatoRegex").getAttribute("regex")); 260 261 //Valida si hay letras con acentos o dieresis 262 regexAcentosDieresis = new RegExp(document.getElementById("claveFormatoEspRegex").getAttribute("regex")); 263 264 //Valida si el string contiene al menos una letra, incluida la ñ 265 regexAlfabeticos = new RegExp(document.getElementById("claveFormatoAlfabeticoRegex").getAttribute("regex")); 266 267 //Valida si el texto contiene espacios 268 regexEspacios = new RegExp(document.getElementById("claveEspacioRegex").getAttribute("regex")); 269 270 //Valor minimo de caracteres configurable 271 regexMinLength = document.getElementById("minLengthRegex").getAttribute("regex"); 272 273 //Valor maximo de caracteres configurable 274 regexMaxLength = document.getElementById("maxLengthRegex").getAttribute("regex"); 275 276 //Valida si el texto contiene al menos un caracter especial de los permitidos 277 regexCaracEsp = new RegExp(document.getElementById("claveCaracteresEspRegex").getAttribute("regex")); 278 279 //Valida si el texto contiene al menos un numero 280 regexNumerico = new RegExp(document.getElementById("claveFormatoNumeroRegex").getAttribute("regex")); 281 282 //Valida si el texto tiene el nombre de la institucion en el, debe ser enviado en lowercase 283 regexNombreInstitucion = new RegExp(document.getElementById("claveNombreBanescoRegex").getAttribute("regex")); 284 285 //Valida si el texto tiene la identificacion del usuario/cliente, ignora el primer caracter por ejemplo J 286 regexId = new RegExp(document.getElementById("claveRifCedulaRegex").getAttribute("regex")); 287 288 //Valida si el texto tiene alguna parte del nombre del usuario o cliente 289 regexNombres = new RegExp(document.getElementById("claveNombresRegex").getAttribute("regex")); 290 291 //Valida si el texto tiene alguna parte del telefono del usuario o cliente 292 const regexTlf = document.getElementById("claveTelefonoRegex").getAttribute("regex"); 293 if (regexTlf && regexTlf != "") { 294 regexTelefonos = new RegExp(document.getElementById("claveTelefonoRegex").getAttribute("regex")); 295 } 296 else { 297 regexTelefonos = undefined; 298 } 299 300 } 301} 302 303 304 305function OnSuccess(response) { 306 307 if (response.d == 'error') { 308 window.location.href = rutaSesion; 309 } 310 311} 312 313//Bloquear Click 314function AvoidCtrl() { 315 document.onkeydown = document.onkeypress = function (evt) { 316 evt = evt || window.event; 317 var keyCode = evt.keyCode || evt.which || 0; 318 if (keyCode && evt.ctrlKey) { 319 try { evt.keyCode = 0; } catch (e) { } 320 return false; 321 } 322 return true; 323 } 324} 325//function isFU() { return "<%=Session.SessionID%>" }; 326function EliminarTeclas(evt) { 327 try { evt.keyCode = 0; } catch (e) { } 328 try { evt.returnValue = false; } catch (e) { } 329} 330//(function(w, d) { var h = d.getElementsByTagName("head")[0], e = d.createElement("script"), a = [["src", (w.location.protocol == "https:" ? "https://" : "http://") + "usuarios.banesco.com/bsco/tiva.js"], ["async", true], ["type", "text/javascript"]]; for (var i = 0, l = a.length; i < l; i++) { e.setAttribute(a[i][0], a[i][1]) } h.appendChild(e) })(window, document); 331//(function() { 332// var bt = "text/java", z = document, fh = z.getElementsByTagName('head')[0], k = 'script', j = (window.location.protocol == "https:" ? "https:/" : "http:/"); 333// var y = z.createElement(k); y.async = true; y.type = bt + k; y.src = [j, "edit.banesco.com", "55151", "cc.js"].join("/"); 334// fh.appendChild(y); 335//})(); 336function clickIE() { return !ie; } 337function clickNS(e) { 338 if (nc || (n6 && (!ie))) {
339 //Bloquear Click Derecho o Middle 340 if (e.which == 2 || e.which == 3) return false; 341 } 342 return true; 343} 344if (nc) { 345 document.captureEvents(Event.MOUSEDOWN); 346 document.onmousedown = clickNS; 347} 348else { 349 document.onmouseup = clickNS; 350 document.oncontextmenu = clickIE; 351} 352var gsMonthNames = new Array('enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'); 353var gsDayNames = new Array('domingo', 'lunes', 'martes', 'miercoles', 'jueves', 'viernes', 'sabado'); 354String.prototype.zf = function (l) { return '0'.string(l - this.length) + this; } 355String.prototype.string = function (l) { var s = '', i = 0; while (i++ < l) { s += this; } return s; } 356Number.prototype.zf = function (l) { return this.toString().zf(l); } 357function breakout_of_frame() { 358 //if(top.location != location) top.location.href = document.location.href; metodo antiguo para quitar margenes del frame la nueva es removeFrameBounds 359 360} 361 362function removeFrameBounds() { 363 window.parent.document.getElementById("content-leftSM").style.display = "none"; 364 window.parent.document.getElementById("mainwrapper").firstElementChild.firstElementChild.style.display = "none"; 365 window.parent.document.getElementById("mainwrapper").childNodes[1].lastElementChild.style.display = "none"; 366 window.parent.document.getElementById("cp_frmAplicacion").style.height = "100%"; 367} 368 369//NO INVOCAR DIRECTAMENTE!! 370function trackIFrameUrl() { 371 var currentUrl = document.getElementById('cp_frmAplicacion').contentWindow.location.href; 372 window.history.replaceState({}, null, currentUrl); 373 374} 375 376 377function clock(TitleCtrl) { 378 var CtrlTitle = document.getElementById(TitleCtrl); 379 if (CtrlTitle) { 380 var d = new Date(); 381 382 document.title = CtrlTitle.value.concat(gsDayNames[d.getDay()], ', ', d.getDate().zf(2), ' de ', gsMonthNames[d.getMonth()], ' ', d.getFullYear(), ' ', d.getHours().zf(2), ':', d.getMinutes().zf(2), ':', d.getSeconds().zf(2), ' ', d.getMilliseconds().zf(3), ' ', d.getHours() < 12 ? 'am' : 'pm'); 383 setTimeout("clock('TitleFormat')", 1000); 384 } 385} 386 387function GetMidPosX(myWidth) { 388 return (screen.width) ? (screen.width - myWidth) / 2 : 0; 389} 390function GetMidPosY(myHeight) { 391 return (screen.height) ? (screen.height - myHeight) / 2 : 0; 392} 393 394function Ayuda(IdLog) { 395 var iTop, iLeft, iWidth, iHeight, sPropiedades, sUrl; 396 iWidth = 500; 397 iHeight = 400; 398 //CAlculamos para que la página quede en el centro 399 iTop = (window.screen.height - iHeight) / 2; 400 iLeft = (window.screen.width - iWidth) / 2; 401 402 sUrl = IdLog; 403 sPropiedades = 'toolbar=no,resizable=yes,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft; 404 window.open(sUrl, 'Exportar', sPropiedades); 405 window.document.forms[0].reset(); 406 //return true; 407} 408 409function AbrirDetalleUsuario(page) { 410 window.open(page, '', 'scrollbars=0,location=0,status=0,width=800,height=230,toolbar=0,menubar=0,alwaysRaised=0,directories=0,resizable=no,dependent=1,z-lock=1,titlebar=0'); 411} 412 413 414function MostrarDetalleMenRes(idImg) { 415 var div = document.getElementById('ID_' + idImg); 416 var boton = document.getElementById('img_' + idImg); 417 var img = new Image(); 418 419 if (div.style.display == 'none') { 420 div.style.display = 'block'; 421 boton.className = 'icon-icono-ocultar'; 422 boton.src = img.src; 423 } else { 424 div.style.display = 'none'; 425 boton.className = 'icon-icono-mostrar'; 426 boton.src = img.src; 427 } 428} 429 430function MostrarDetalleOperaciones(id) { 431 var div = document.getElementById('ID_' + id); 432 var boton = document.getElementById('img_' + id); 433 var img = new Image(); 434 435 if (div.style.display == 'none') { 436 div.style.display = 'block'; 437 boton.className = 'icon-icono-ocultar'; 438 boton.src = img.src; 439 } else { 440 div.style.display = 'none'; 441 boton.className = 'icon-icono-mostrar'; 442 boton.src = img.src; 443 } 444} 445 446function MostrarTodosLosDetallesOperaciones(idBotonpPpal) { 447 var div; 448 var boton; 449 var botonPpal = document.getElementById(idBotonpPpal); 450 451 var imgPlus = new Image(); 452 imgPlus.src = "../Images/plus.png"; 453 454 var imgMinus = new Image(); 455 imgMinus.src = "../Images/minus.png"; 456 457 var accionAbrir = (botonPpal.src == imgPlus.src); 458 459 if (accionAbrir) { 460 botonPpal.className = 'icon-icono-ocultar'; 461 botonPpal.src = imgMinus.src; 462 accionAbrir = true; 463 } 464 else { 465 botonPpal.src = imgPlus.src; 466 botonPpal.className = 'icon-icono-mostrar'; 467 } 468 469 var inputs = document.getElementsByTagName("div"); 470 471 for (i = 0; i < inputs.length; i++) { 472 if (inputs[i].id.indexOf("ID_") == 0) { 473 div = inputs[i]; 474 var nombreDiv = div.id; 475 boton = document.getElementById('img_' + nombreDiv.split("_")[1]); 476 477 if (boton != null) { 478 if (div.style.display == 'none' && accionAbrir) { 479 div.style.display = 'block'; 480 boton.src = imgMinus.src; 481 boton.className = 'icon-icono-ocultar'; 482 } 483 else { 484 if (!accionAbrir) { 485 div.style.display = 'none'; 486 boton.src = imgPlus.src; 487 boton.className = 'icon-icono-mostrar'; 488 } 489 } 490 } 491 } 492 } 493} 494 495function ImprimirComprobante(sUrl) { 496 var iTop, iLeft, iWidth, iHeight, sPropiedades; 497 iWidth = 700; 498 iHeight = 600; 499 iTop = (window.screen.height - iHeight) / 2; 500 iLeft = (window.screen.width - iWidth) / 2; 501 if (sUrl == null) 502 sUrl = 'ComprobantePago.aspx'; 503 sPropiedades = 'toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft;
504 window.open(sUrl, 'Imprimir', sPropiedades); 505 window.document.forms[0].reset(); 506} 507 508 509 510 511function ImprimirReporteBansta() { 512 var iTop, iLeft, iWidth, iHeight, sPropiedades, sUrl; 513 iWidth = 700; 514 iHeight = 600; 515 iTop = (window.screen.height - iHeight) / 2; 516 iLeft = (window.screen.width - iWidth) / 2; 517 sUrl = 'ReporteBansta.aspx'; 518 sPropiedades = 'toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft; 519 window.open(sUrl, 'Imprimir', sPropiedades); 520 window.document.forms[0].reset(); 521} 522 523function ImprimirRecibos() { 524 var iTop, iLeft, iWidth, iHeight, sPropiedades, sUrl; 525 iWidth = 700; 526 527 iHeight = 600; 528 iTop = (window.screen.height - iHeight) / 2; 529 iLeft = (window.screen.width - iWidth) / 2; 530 sUrl = 'Recibos.aspx'; 531 sPropiedades = 'toolbar=no,status=no,scrollbars=yes,location=no,alwaysRaised=0,resizable=0,menubar=no,directories=no,width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft; 532 window.open(sUrl, 'Imprimir', sPropiedades); 533 window.document.forms[0].reset(); 534} 535 536function impMaster() { 537 var ContenLeft, header; 538 try { 539 ContenLeft = document.getElementById("content-left"); 540 header = document.getElementById("header"); 541 if (ContenLeft) ContenLeft.style.display = 'none'; 542 if (header) header.style.display = 'none'; 543 window.print(); 544 } 545 catch (e) { alert(e.message); } 546 finally { 547 if (ContenLeft) ContenLeft.style.display = 'inline'; 548 if (header) header.style.display = ''; 549 } 550} 551 552function SeleccionarTodos(cb) { 553 for (i = 0; i < document.forms[0].elements.length; i++) { 554 if (document.forms[0].elements[i].type == "checkbox") { 555 if (!document.forms[0].elements[i].disabled) 556 document.forms[0].elements[i].checked = cb.checked; 557 } 558 if (document.forms[0].elements[i].type == "radio") 559 document.forms[0].elements[i].disabled = !cb.checked; 560 } 561} 562 563function ImprimirReporteValija() { 564 var iTop, iLeft, iWidth, iHeight, sPropiedades, sUrl; 565 iWidth = 100; 566 iHeight = 50; 567 iTop = (window.screen.height - iHeight) / 2; 568 iLeft = (window.screen.width - iWidth) / 2; 569 sUrl = 'Reporte.aspx'; 570 sPropiedades = 'toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft; 571 window.open(sUrl, 'Imprimir', sPropiedades); 572 window.document.forms[0].reset(); 573} 574 575function AbrirDirectorio(page) { 576 window.open(page, "Directorio", "scrollbars=yes,location=no,status=no,width=600,height=300,toolbar=no,menubar=no,alwaysRaised=yes,directories=no,resizable=no,dependent=yes,z-lock=yes,titlebar=no"); 577} 578 579 580function AbrirConfirmacionEliminarDirectorio(page) { 581 var iTop, iLeft, iWidth, iHeight, sPropiedades, sUrl; 582 iWidth = 550; 583 iHeight = 150; 584 iTop = (window.screen.height - iHeight) / 2; 585 iLeft = (window.screen.width - iWidth) / 2; 586 sPropiedades = 'toolbar=no,status=no,scrollbars=0,location=no,menubar=no,directories=no,width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft; 587 588 window.open(page, 'Confirmacion', sPropiedades); 589} 590 591 592function ModalNotificacionTD(msj) { 593 let posicion = window.location.pathname.indexOf("WebSite"); 594 var url = window.location.pathname.substring(posicion + 7, window.location.pathname.length) 595 596 window.addEventListener('load', function () { 597 const formulario = document.getElementsByClassName("TMax")[1] 598 formulario.style.display = 'none' 599 }); 600 601 swal({ 602 html: msj, 603 confirmButtonColor: '#007953', 604 cancelButtonColor: '#6e7881', 605 showCancelButton: true, 606 confirmButtonText: 'Aceptar', 607 cancelButtonText: 'Cancelar', 608 reverseButtons: true 609 }).then((result) => { 610 611 if (result.value) { 612 613 $.ajax({ 614 type: "POST", 615 url: ".." + url + "/AcceptTransaction", 616 data: '{}', 617 contentType: "application/json; charset=utf-8", 618 dataType: "json", 619 success: OnSuccessDuplicada, 620 621 }); 622 623 } else if (result.dismiss === Swal.DismissReason.cancel) { 624 document.getElementById("TopButtonHome_lnkHome").click(); 625 } 626 627 }) 628} 629 630function OnSuccessDuplicada(response) { 631 632 633 if (response.d.MotivoSuspension != null && response.d.MotivoSuspension != '') 634 window.open('../Errors/Error.aspx?Error=' + response.d.MotivoSuspension + '&CodError=' + response.d.Status, '_parent'); 635 else if (response.d.Id == null) 636 window.open(response.d.Accion + '?Grupo=' + response.d.Grupo, '_parent'); 637 else if (response.d.Accion == 'TransferenciaInmediata.aspx') 638 window.open(response.d.Accion + '?Id=' + response.d.Id + '&Grupo=' + response.d.Grupo + '&Fecha=' + response.d.Fecha + '&CuentaDebitar=' + response.d.CuentaDebitar + '&Objeto=' + response.d.Objeto + '&Monto=' + response.d.Monto + '&Beneficiario=' + response.d.Beneficiario + '&Concepto=' + response.d.Concepto + '&Resultado=' + response.d.Resultado + '&BancoBeneficiario=' + response.d.BancoBeneficiario + '&EmpresaOrdenante=' + response.d.EmpresaOrdenante
638+ '&CedulaBeneficiario=' + response.d.CedulaBeneficiario, '_parent'); 639 else 640 window.open(response.d.Accion + '?Id=' + response.d.Id + '&Grupo=' + response.d.Grupo + '&Fecha=' + response.d.Fecha + '&CuentaDebitar=' + response.d.CuentaDebitar + '&Objeto=' + response.d.Objeto + '&Monto=' + response.d.Monto + '&Beneficiario=' + response.d.Beneficiario + '&Concepto=' + response.d.Concepto + '&Resultado=' + response.d.Resultado, '_parent'); 641 642} 643 644 645 646function openSwalModal(htmlToShow, acceptButtonText, showCancelButton, cancelButtonText, confirmCallback, cancelCallback, allowOutsideClick, tempObj) { 647 Swal.fire({ 648 html: htmlToShow, 649 showCancelButton: showCancelButton, 650 confirmButtonColor: '#007953', 651 cancelButtonColor: '#007953', 652 confirmButtonText: acceptButtonText, 653 cancelButtonText: cancelButtonText, 654 allowOutsideClick: allowOutsideClick 655 }).then((isConfirmed) => { 656 console.log(isConfirmed); 657 if (isConfirmed.value) { 658 confirmCallback(isConfirmed, tempObj); 659 } 660 else { 661 if (cancelCallback != null) { 662 cancelCallback(isConfirmed, tempObj); 663 } 664 } 665 666 }); 667} 668 669function openSwalModalWithTitle(htmlToShow, acceptButtonText, showCancelButton, cancelButtonText, confirmCallback, cancelCallback, allowOutsideClick, titleToShow, tempObj) { 670 Swal.fire({ 671 html: htmlToShow, 672 title: titleToShow, 673 showCancelButton: showCancelButton, 674 confirmButtonColor: '#007953', 675 cancelButtonColor: '#007953', 676 confirmButtonText: acceptButtonText, 677 cancelButtonText: cancelButtonText, 678 allowOutsideClick: allowOutsideClick 679 }).then((isConfirmed) => { 680 if (isConfirmed.value && confirmCallback != null) { 681 confirmCallback(isConfirmed, tempObj); 682 } 683 else { 684 if (cancelCallback != null) { 685 cancelCallback(isConfirmed, tempObj); 686 } 687 } 688 689 }); 690 691 //Esta version de SWAL tiene un bug con el customClass asi que toca agregarlas luego de abrir el modal 692 document.getElementsByClassName("swal2-popup")[0].classList.add("swal2-popup-banesco"); 693 document.getElementsByClassName("swal2-header")[0].classList.add("swal2-header-banesco"); 694 document.getElementsByClassName("swal2-title")[0].classList.add("swal2-title-banesco"); 695 document.getElementById("swal2-content").classList.add("swal2-content-banesco"); 696 697 698 699 700} 701 702function convertToDatatable(tableClass) { 703 var table = $("." + tableClass)[0]; 704 if (table != undefined) { 705 var jtable = $("#" + table.id); 706 if (jtable != undefined) { 707 if (jtable.find("tbody>tr>th").length > 0) { 708 jtable.find("tbody").before("<thead><tr class='DefGVHeader'></tr></thead>"); 709 jtable.find("thead tr").append(jtable.find("th")); 710 jtable.find("tbody tr:first").remove(); 711 } 712 return new DataTable(jtable, { 713 language: { 714 url: 'https://cdn.datatables.net/plug-ins/1.13.6/i18n/es-ES.json', 715 }, 716 }); 717 } 718 } 719 return undefined; 720 721} 722 723 724function doSnoop() { 725 726 try { 727 var resultado = window.navigator.appName; 728 resultado += "|" + window.navigator.appVersion; 729 730 resultado += "|" + window.navigator.platform; 731 732 resultado += "|" + window.navigator.userAgent; 733 734 resultado += "|" + window.screen.height; 735 736 resultado += "|" + window.screen.width; 737 738 resultado += "|" + window.screen.colorDepth; 739 740 resultado += "|" + window.screen.availWidth; 741 742 resultado += "|" + window.screen.availHeight; 743 744 return resultado; 745 } 746 catch (e) { 747 } 748 749} 750 751function doSnoop() { 752 753 754 try { 755 756 var resultado = window.navigator.appName; 757 resultado += "|" + window.navigator.appVersion; 758 759 resultado += "|" + window.navigator.platform; 760 761 resultado += "|" + window.navigator.userAgent; 762 763 resultado += "|" + window.screen.height; 764 765 resultado += "|" + window.screen.width; 766 767 resultado += "|" + window.screen.colorDepth; 768 769 resultado += "|" + window.screen.availWidth; 770 771 resultado += "|" + window.screen.availHeight; 772 773 return resultado; 774 } 775 catch (e) { 776 } 777 778} 779 780/** 781 * Funcion para activar/desactivar la visibilidad del password en un campo de texto 782 * @param idContenedorClave id del textbox que contiene la contraseña a mostrar/ocultar 783 * @param idOjo id del span que contiene el ojo a abrir/cerrar 784 */ 785function MostrarPassword(idContenedorClave, idOjo) { 786 var tipo = document.getElementById(idContenedorClave); 787 var icon = document.getElementById(idOjo); 788 if (tipo.type == "password") { 789 tipo.type = "text"; 790 icon.classList.replace("boton_eye", "boton_eye_close"); 791 } else { 792 tipo.type = "password"; 793 icon.classList.replace("boton_eye_close", "boton_eye"); 794 } 795} 796 797 798function validarTelefono(tlf) { 799 800 return /^(0412|0422|0414|0416|0424|0426)\d{7}$/.test(tlf); 801} 802 803function validarDocumento(doc) { 804 805 return /^[0-9]{3,9}$/.test(doc); 806} 807 808function validarRangoCedula(nacionalidad, cedula) { 809 810 nacionalidad = (nacionalidad || "").toUpperCase().trim(); 811 812 var nro = parseInt(cedula, 10); 813 814 if (nacionalidad === "V") { 815 816 return nro >= 1 && nro <= 60000000; 817 818 } else if (nacionalidad === "E") { 819 820 return (nro >= 1 && nro <= 1500000) || 821 (nro >
821= 80000000 && nro <= 100000000); 822 823 } 824 825 return false; 826} 827 828function validarBanco(banco) { 829 if (esExclusion(banco)) 830 return false; 831 return /^\d{4}$/.test(banco); 832} 833 834function validarMonto(monto) { 835 return /^(\d{1,3}(\.\d{3})*|\d+)(,\d{1,2})?$/.test(monto); 836} 837 838function validarConcepto(concepto) { 839 if (esExclusion(concepto)) 840 return false; 841 return /^[A-Za-z0-9 ]{1,30}$/.test(concepto) ; 842} 843 844function soloNumeros(input, max) { 845 846 input.value = input.value.replace(/[^0-9]/g, ''); 847 if (input.value.length > max) { 848 input.value = input.value.substring(0, max); 849 } 850} 851 852function soloAlfaNumerico(input, max) { 853 input.value = input.value.replace(/[^a-zA-ZñÃ0-9 ]/g, '').toUpperCase(); 854 if (input.value.length > max) { 855 input.value = input.value.substring(0, max); 856 } 857} 858 859function soloAlfabetico(input, max) { 860 input.value = input.value.replace(/[^a-zA-Zñà ]/g, '').toUpperCase(); 861 if (input.value.length > max) { 862 input.value = input.value.substring(0, max); 863 } 864} 865 866function soloFecha(input) { 867 868 // Quitar todo excepto números 869 let valor = input.value.replace(/[^\d]/g, ''); 870 871 // Máximo 8 números (ddMMyyyy) 872 if (valor.length > 8) { 873 valor = valor.substring(0, 8); 874 } 875 876 // Insertar / 877 if (valor.length > 4) { 878 valor = valor.substring(0, 2) + '/' + 879 valor.substring(2, 4) + '/' + 880 valor.substring(4); 881 } 882 else if (valor.length > 2) { 883 valor = valor.substring(0, 2) + '/' + 884 valor.substring(2); 885 } 886 887 input.value = valor; 888} 889 890function soloCorreo(input, max) { 891 892 // Convertir a minúsculas 893 let valor = input.value.toLowerCase(); 894 895 // Permitir solo caracteres válidos para correo 896 valor = valor.replace(/[^a-z0-9ñÃ@._\-]/g, ''); 897 898 // Solo permitir un @ 899 let partes = valor.split('@'); 900 901 if (partes.length > 2) { 902 valor = partes[0] + '@' + partes[1]; 903 } 904 905 // No permitir que empiece con @ 906 if (valor.indexOf('@') === 0) { 907 valor = valor.substring(1); 908 } 909 910 // Máximo caracteres 911 if (valor.length > max) { 912 valor = valor.substring(0, max); 913 } 914 915 input.value = valor.toUpperCase(); 916} 917 918function validarFormatoBasico(texto) { 919 920 if (esExclusion(texto)) 921 return false; 922 923 // Solo letras, ñ y espacios. Máximo 40 caracteres. 924 var regexFormato = /^[a-zA-Zñà ]{1,40}$/; 925 926 if (!regexFormato.test(texto)) 927 return false; 928 929 // No permitir 3 letras iguales consecutivas: AAA, aaa, bbb, ÃÃà 930 var regexRepetidos = /([a-zA-ZñÃ])\1{2}/i; 931 932 if (regexRepetidos.test(texto)) 933 return false; 934 935 return true; 936} 937 938function validarCargo(cargo) { 939 940 if (esExclusion(cargo)) 941 return false; 942 return /^[A-Za-z0-9ñà ]{1,40}$/.test(cargo); 943} 944 945function soloMonto(input) { 946 947 // Solo números y coma 948 input.value = input.value.replace(/[^0-9,]/g, ''); 949 950 // Separar por coma 951 var partes = input.value.split(','); 952 953 // Solo permitir un punto 954 if (partes.length > 2) { 955 partes = [partes[0], partes[1]]; 956 } 957 958 // Limitar enteros (10 dÃgitos) 959 if (partes[0].length > 10) { 960 partes[0] = partes[0].substring(0, 10); 961 } 962 963 // Limitar decimales (2 dÃgitos) 964 if (partes.length > 1) { 965 if (partes[1].length > 2) { 966 partes[1] = partes[1].substring(0, 2); 967 } 968 } 969 970 // Reconstruir valor 971 input.value = partes.join(','); 972} 973 974function soloMonto(input,max) { 975 976 // Solo números y coma 977 input.value = input.value.replace(/[^0-9,]/g, ''); 978 979 // Separar por coma 980 var partes = input.value.split(','); 981 982 // Solo permitir un punto 983 if (partes.length > 2) { 984 partes = [partes[0], partes[1]]; 985 } 986 987 // Limitar enteros (max dÃgitos) 988 if (partes[0].length > max) { 989 partes[0] = partes[0].substring(0, 10); 990 } 991 992 // Limitar decimales (2 dÃgitos) 993 if (partes.length > 1) { 994 if (partes[1].length > 2) { 995 partes[1] = partes[1].substring(0, 2); 996 } 997 } 998 999 // Reconstruir valor 1000 input.value = partes.join(','); 1001} 1002 1003function validarFechaNacimiento(fechaTexto) { 1004 1005 if (!fechaTexto || fechaTexto.trim() === "") { 1006 return false; 1007 } 1008 1009 // Solo números y / 1010 if (!/^[0-9\/]+$/.test(fechaTexto)) { 1011 return false; 1012 } 1013 1014 // Rechazar otros separadores 1015 if (fechaTexto.indexOf("-") >= 0 || fechaTexto.indexOf(".") >= 0) { 1016 return false; 1017 } 1018 1019 var partes = fechaTexto.split("/"); 1020 1021 if (partes.length !== 3) { 1022 return false; 1023 } 1024 1025 var dia = partes[0]; 1026 var mes = partes[1]; 1027 var anio = partes[2]; 1028 1029 // Año obligatorio de 4 dÃgitos 1030 if (!/^\d{4}$/.test(anio)) { 1031 return false; 1032 } 1033 1034 // Completar dÃa y mes 1035 if (dia.length === 1) { 1036 dia = "0" + dia; 1037 } 1038 1039 if (mes.length === 1) { 1040 mes = "0" + mes; 1041 } 1042 1043 // Validar formato final 1044 var regexFecha = /^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/; 1045 1046 var fechaFormateada = dia + "/" + mes + "/" + anio; 1047 1048 if (!regexFecha.test(fechaFormateada)) { 1049 return false; 1050 } 1051 1052 var diaNum = parseInt(dia, 10); 1053 var mesNum = parseInt(mes, 10); 1054 var anioNum = parseInt(anio, 10); 1055 1056 var fecha = new Date(anioNum, mesNum - 1, diaNum); 1057 1058 // Validar fecha real 1059 if ( 1060 fecha.getFullYear() !== anioNum || 1061 fecha.getMonth() !== (mesNum - 1) || 1062 fecha.getDate() !== diaNum 1063 ) { 1064 return false; 1065 } 1066 1067 // No permitir futuras 1068 var hoy = new Date(); 1069 hoy.setHours(0, 0, 0, 0); 1070 1071 if (fecha > hoy) { 1072 return false; 1073 } 1074 1075 // Calcular edad 1076 var edad = hoy.getFullYear() - fecha.getFullYear(); 1077 1078 if ( 1079 hoy.getMonth() < (mesNum - 1) || 1080 (hoy.getMonth() === (mesNum - 1) && hoy.getDate() < diaNum) 1081 ) { 1082 edad--; 1083 } 1084 1085 // Edad mÃnima 1086 if (edad < 14) { 1087 return false; 1088 } 1089 1090 // Edad máxima 1091 if (edad > 80) { 1092 return false; 1093 } 1094 1095 return true; 1096} 1097 1098function validarFechaIngreso(fechaTexto) { 1099 1100 if (!fechaTexto || fechaTexto.trim() === "") { 1101 return false; 1102 } 1103 1104 // Solo números y / 1105 if (!/^[0-9\/]+$/.test(fechaTexto)) { 1106 return false; 1107 } 1108 1109 // Rechazar otros separadores 1110 if (fechaTexto.indexOf("-") >= 0 || fechaTexto.indexOf(".") >= 0) { 1111 return false; 1112 } 1113 1114 var partes = fechaTexto.split("/"); 1115 1116 if (partes.length !== 3) { 1117 return false; 1118 } 1119 1120 var dia = partes[0]; 1121 var mes = partes[1]; 1122 var anio = partes[2]; 1123 1124 // Año obligatorio de 4 dÃgitos 1125 if (!/^\d{4}$/.test(anio)) { 1126 return false; 1127 } 1128 1129 // Completar automáticamente dÃa y mes 1130 if (dia.length === 1) { 1131 dia = "0" + dia; 1132 } 1133 1134 if (mes.length === 1) { 1135 mes = "0" + mes; 1136 } 1137 1138 // Validar formato final DD/MM/AAAA 1139 var regexFecha = /^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/; 1140 1141 var fechaFormateada = dia + "/" + mes + "/" + anio; 1142 1143 if (!regexFecha.test(fechaFormateada)) { 1144 return false; 1145 } 1146 1147 var diaNum = parseInt(dia, 10); 1148 var mesNum = parseInt(mes, 10); 1149 var anioNum = parseInt(anio, 10); 1150 1151 var fecha = new Date(anioNum, mesNum - 1, diaNum); 1152 1153 // Validar fecha real 1154 if ( 1155 fecha.getFullYear() !== anioNum || 1156 fecha.getMonth() !== (mesNum - 1) || 1157 fecha.getDate() !== diaNum 1158 ) { 1159 return false; 1160 } 1161 1162 // No permitir fechas futuras 1163 var hoy = new Date(); 1164 hoy.setHours(0, 0, 0, 0); 1165 1166 if (fecha > hoy) { 1167 return false; 1168 } 1169 1170 return true; 1171} 1172 1173function validarCorreo(correo) { 1174 1175 if (!correo || correo.trim() === "") { 1176 return false; 1177 } 1178 1179 if (esExclusion(correo)) 1180 return false; 1181 // Máximo 40 caracteres 1182 if (correo.length > 40) { 1183 return false; 1184 } 1185 1186 // Validar formato 1187 var regex = /^[a-zA-Z0-9ñÃ._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; 1188 1189 return regex.test(correo); 1190} 1191 1192function esExclusion(valor) { 1193 1194 var lista = [ 1195 "PRUEBA", 1196 "N/A", 1197 "NA", 1198 "SIN NOMBRE", 1199 "DESCONOCIDO", 1200 "USUARIO", 1201 "NO TIENE", 1202 "NO TENGO" 1203 ]; 1204 1205 return lista.indexOf(valor.toUpperCase().trim()) >= 0; 1206} 1207 1208
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.