const navText = [ '', '' ]; class Web { static init() { Web.initDynamicBG(); $(document).ready(function(e) { $('.selectpicker').on('changed.bs.select', function (e, clickedIndex, isSelected, previousValue) { if (isSelected === null) return; $(this).removeClass("error"); }); const btnSubir = $("#btn-subir"); let toScroll = null; $(window).scroll(function () { let scrollPosition = $(window).scrollTop(); if (scrollPosition > 300) { clearTimeout(toScroll); toScroll = setTimeout(function () { btnSubir.removeClass("d-none"); }, 100); } else { clearTimeout(toScroll); btnSubir.addClass("d-none"); } btnSubir.click(function () { clearTimeout(toScroll); window.scrollTo({top: 0, behavior: 'smooth'}); $(this).addClass("d-none"); }); }); new WOW( { boxClass: "title-animation", offset: 50, callback: function(box) { $(box).addClass("animate"); } } ).init(); }); } static initInicio() { } static initInscripcion() { $(document).ready(function () { preparaLugar(28, undefined, undefined, "frm-inscripcion-pais-club", "frm-inscripcion-provincia-club", "frm-inscripcion-localidad-club"); preparaLugar(28, undefined, undefined, "frm-inscripcion-pais-responsable", "frm-inscripcion-provincia-responsable", "frm-inscripcion-localidad-responsable"); $("#btn-inscribirse").click(realizarInscripcion); const torneo = $("#frm-inscripcion-torneo"); const bloques = $("#inscripcion-categorias-masculinas, #inscripcion-categorias-femeninas"); const etiqueta = "N\u00ba de equipos Clase %1%"; const validacion = "Debe escribir un n\u00famero v\u00e1lido de equipos para la clase %1%"; const bloqueAlojamiento = $("#inscripcion-alojamiento"); const opcionesAlojamiento = $("#opcs-alojamiento"); const modalAlojamiento = $("#modal-info-alojamiento"); const etiquetaAlojamiento = "%1% - n.\u00ba de personas"; const validacionAlojamiento = "Debe escribir un n\u00famero v\u00e1lido de personas para %1%"; const informacionAlojamiento = "Informaci\u00f3n de la opci\u00f3n %1%"; const tituloAlojamiento = "Alojamiento"; const iconoInformacion = "\u003Csvg width=\u002215\u0022 height=\u002215\u0022 viewBox=\u00220 0 15 15\u0022 fill=\u0022none\u0022 xmlns=\u0022http:\/\/www.w3.org\/2000\/svg\u0022\u003E\n\u003Cpath d=\u0022M7.5 1.25C10.9375 1.25 13.75 4.0625 13.75 7.5C13.75 10.9375 10.9375 13.75 7.5 13.75C4.0625 13.75 1.25 10.9375 1.25 7.5C1.25 4.0625 4.0625 1.25 7.5 1.25Z\u0022 stroke=\u0022#4A5565\u0022 stroke-linecap=\u0022round\u0022 stroke-linejoin=\u0022round\u0022\/\u003E\n\u003Cpath d=\u0022M7.5 10V6.875\u0022 stroke=\u0022#4A5565\u0022 stroke-linecap=\u0022round\u0022 stroke-linejoin=\u0022round\u0022\/\u003E\n\u003Cpath d=\u0022M7.49658 5H7.5022\u0022 stroke=\u0022#4A5565\u0022 stroke-linecap=\u0022round\u0022 stroke-linejoin=\u0022round\u0022\/\u003E\n\u003C\/svg\u003E\n"; let alojamientos = []; let peticion = null; opcionesAlojamiento.on("click", ".abre-info-alojamiento", function () { const id = $(this).attr("data-id"); const alojamiento = alojamientos.find(function (opcion) { return String(opcion.id) === id; }); if (alojamiento) { modalAlojamiento.html(alojamiento.html); ClassBlockUI.abrirBlockUIEstandar("modal-info-alojamiento", undefined, tituloAlojamiento, "modal-lg"); } }); torneo.on("change", function () { if (peticion) { peticion.abort(); } bloques.addClass("d-none").find(".row").empty(); bloqueAlojamiento.addClass("d-none").prop("disabled", true).find("input").val(""); opcionesAlojamiento.empty(); modalAlojamiento.empty(); alojamientos = []; const idTorneo = torneo.val(); $("#inscripcion-datos").toggleClass("d-none", !idTorneo); if (!idTorneo) { return; } peticion = $.ajax({ url: "https://www.deporteytorneos.com/ajax/Torneos.datosInscripcion.php", type: "POST", dataType: "json", data: {idTorneo: idTorneo, CSRF: CSRF}, success: function (data) { if (torneo.val() !== idTorneo) { return; } ["masculinas", "femeninas"].forEach(function (tipo) { const bloque = $("#inscripcion-categorias-" + tipo); const grupos = data && Array.isArray(data[tipo]) ? data[tipo] : []; grupos.forEach(function (grupo) { const id = "frm-inscripcion-categoria-" + grupo.id; const columna = $("
").addClass("col-12 col-sm-6 col-lg-3"); $("
'+ ' '+ ''; $("body").append(message); var modal = $("#"+blockUIId); modal.find(".modal-body").append(node); modal.find(".modal-dialog").addClass("fadeIn"); modal.on('hidden.bs.modal', function () { ClassBlockUI.restaurarElemento(); }) var myModal = new bootstrap.Modal($(modal)[0], { keyboard: false }) myModal.show(); if(accionCerrar==undefined) //boton cerrar tiene accion por defecto { $("#"+blockUIId+" .btnCerrarModalEquis").click(function(){ myModal.hide(); if($(".modal").length>0){$("body").addClass("modal-open")} }); } else if(accionCerrar==false) //oculta el boton cerrar { $("#"+blockUIId+" .btnCerrarModalEquis").hide(); } else //boton cerrar con accion especial { $("#"+blockUIId+" .btnCerrarModalEquis").click(accionCerrar); } return modal; }, abrirBlockUIEstandarMensaje: function(mensaje, isAlertOrButtons, onClose, extraClass, title) { $(".modalAutoHide").modal("hide"); if($(".modal").length>0){$("body").addClass("modal-open")} var blockUIId="blockUI_"+new Date().getTime(); extraClass = extraClass == null || extraClass == undefined ? "" : extraClass; //modal-lg title = title == null || title == undefined ? "Aviso" : title; if(isAlertOrButtons==undefined) isAlertOrButtons=false; if(onClose==undefined) onClose=false; var botonera = ""; var botoneraEspecial = false; if(isAlertOrButtons === false) { botonera = ""; } else if (isAlertOrButtons === true) { let textoBoton = "Aceptar"; botonera = `
`; } else { botoneraEspecial = true; botonera = "
"; for(var index in isAlertOrButtons) { botonera += " "+isAlertOrButtons[index]["text"]+" "; } botonera += "
"; } var message = ''; message += ''; $("body").append(message); var modal = $("#"+blockUIId); modal.find(".modal-dialog").css("animation-duration", "500ms").addClass("zoomIn"); modal.on('hidden.bs.modal', function () { modal.remove(); }) var myModal = new bootstrap.Modal($(modal)[0], { keyboard: false }); myModal.show(); //Acciones de los botones especiales if(botoneraEspecial) { for(var index in isAlertOrButtons) { if(isAlertOrButtons[index]["action"] == "close") { isAlertOrButtons[index]["action"] = function(){ myModal.hide(); if($(".modal").length>0){$("body").addClass("modal-open")} }; } $("#"+blockUIId+" ."+index).unbind("click").click(isAlertOrButtons[index]["action"]); } } var fnOnClose; if(onClose==false) { fnOnClose = function(){ myModal.hide(); if($(".modal").length>0){$("body").addClass("modal-open")} }; } else if (typeof onClose === "function") { fnOnClose = function(){onClose()}; } else if (onClose == "location") { fnOnClose = function(){window.location.reload()}; } else if (onClose == "back") { fnOnClose = function(){history.go(-1);}; } else { if(onClose.indexOf("/") !=0 && onClose.indexOf("http") !=0) { onClose = "/"+onClose; } fnOnClose = function(){window.location = onClose}; } $("#"+blockUIId+" .btnCerrarBlockUIAlert, #"+blockUIId+" .btnCerrarModalEquis").unbind("click").click(fnOnClose); return modal; }, abrirBlockUIConfirm: function(mensaje, textoAceptar, accionAceptar, textoCancelar, accionCancelar, extraClass, title) { accionCancelar = accionCancelar == undefined ? "close" : accionCancelar; extraClass = extraClass == null || extraClass == undefined ? "" : extraClass; var buttons = { "btnAceptarBUI_CONFIRM": { "text": textoAceptar, "action": accionAceptar }, "btnCancelarBUI_CONFIRM": { "text": textoCancelar, "action": accionCancelar } }; return ClassBlockUI.abrirBlockUIEstandarMensaje(mensaje, buttons, false, extraClass, title); }, abrirBlockUIEsperePorFavor: function(mensaje) { if(mensaje == undefined){ mensaje = "
Espere por favor...
"; }; return ClassBlockUI.abrirBlockUIEstandarMensaje(mensaje, undefined, false, "modalEspere"); } };