1$.fn.hasAttr=function(e){return void 0!==this.attr(e)},Element.prototype.subir_y_buscar_valor=function(e,o,a=0){var e=this.closest(e);return(e=e&&e.querySelector(o))?e.value??a:a};const swal_toast=window.swal_toast=Swal.mixin({padding:"1.8rem",icon:"success",background:"#defdcb",toast:!0,position:"top-end",showConfirmButton:!1,timer:3e3,timerProgressBar:!0,didOpen:e=>{e.addEventListener("mouseenter",Swal.stopTimer),e.addEventListener("mouseleave",Swal.resumeTimer),e.addEventListener("click",Swal.close)}});function wf_recaptcha_render(e,o){var a=e?$(e):$(document);o=o||1,"undefined"==typeof grecaptcha||"function"!=typeof grecaptcha.render?o<=20?setTimeout(function(){wf_recaptcha_render(a,o+1)},250):console.warn("No se pudo renderizar reCAPTCHA. Revisa que api.js esté cargado como render=explicit."):a.find(".g-recaptcha").each(function(){var e=$(this),o=e.attr("id"),a=e.data("sitekey");if(o&&a&&1!=e.data("rendered"))try{var t=window.grecaptcha.render(o,{sitekey:a});e.data("rendered",1),e.data("widget_id",t)}catch(e){console.error("Error al renderizar reCAPTCHA:",e)}})}function wf_recaptcha_onload(){wf_recaptcha_render(document)}function ventana_wf(e,o=!1,a=null,t="w1200",r="",n=!0,i="",s="",c=0,l=""){var d,u;return console.groupCollapsed("ðª ventana_wf()"),console.log("ID recibido:",e),console.log("Eliminar:",o),console.log("URL:",l),console.log("ID artilugio:",c),o&&e?(d=String(e).replace(/^#/,"").trim(),u=document.getElementById(d),console.log("Modo: eliminar ventana del DOM"),console.log("ID limpio:",d),console.log("Ventana encontrada:",!!u),u?(u.remove(),document.body.style.overflow="",console.log("Ventana eliminada correctamente:",d)):console.warn("No se encontró la ventana para eliminar:",d),console.groupEnd(),!0):(u=(new wf_ventana).abrir({id:e||"",eliminar:o,contenido_b64:a,clase_ancho:t,titulo_ventana:r,pintar_cabecera:n,style_contenedor_principal:i,params:s||"",id_artilugio:parseInt(c,10)||0,url:l||""}),console.log("Delegado a wf_ventana.abrir()"),console.groupEnd(),u)}function wf_b64(e=""){try{return btoa(unescape(encodeURIComponent(String(e))))}catch{return btoa(String(e))}}function wf_cookie_b64(e=""){let o="";for(const t of document.cookie.split(";")){var a=t.trim().split("=");if(a[0]===e){o=a.slice(1).join("=");break}}if(!o)return"";try{o=decodeURIComponent(o)}catch(e){}try{return decodeURIComponent(escape(atob(o)))}catch(e){try{return atob(o)}catch(e){return""}}}function wf_alerta(o="info",a="",t="",r=0){var n="ok"===o?"success":"error"===o?"danger":"info";if(parseInt(r,10)<=0){const i="#wf_alerta_wf";i.replace("#","");console.groupCollapsed("ð¨ wf_alerta() modo ventana WF"),console.log("Tipo:",o),console.log("Badge:",n),console.log("TÃtulo:",a),console.log("Texto:",t),console.log("ID ventana:",i);const s=` 2 <div class='p-3 wf_alerta_wf_contenido'> 3 <h5 class='border-bottom pb-1 border-${n} text-${n}'>${a||""}</h5> 4 <p class='my-4'>${t||""}</p> 5 <button class='btn btn-sm btn-outline-primary cerrar_ventana_wf'>Cerrar</button> 6 </div>`,c=(console.log("HTML generado:",s),ventana_wf(i,!0,null,"w500","",!1,"min-height: auto;"),console.log("Ventana reiniciada."),ventana_wf(i,!1,wf_b64(s),"w500","",!1,"min-height: auto;"),console.log("Ventana abierta con HTML codificado."),setTimeout(function(){var e,o=document.querySelector(i);console.log("Ventana localizada después de abrir:",o),o?(e=o.querySelector(".wf_alerta_wf_contenido"),console.log("¿Ya tiene contenido de alerta?:",e),e||(e=o.querySelector(".contenido")||o.querySelector(".contenedor_principal")||o.querySelector(".modal-body")||o,console.warn("La ventana estaba vacÃa. Insertando contenido manualmente en:",e),e.innerHTML=s)):console.warn(`wf_alerta(): no se ha encontrado la ventana ${i}.`),console.groupEnd()},50),function(e){"Escape"===e.key&&(ventana_wf(i),document.removeEventListener("keydown",c))});void document.addEventListener("keydown",c)}else{let e=document.querySelector("#wf_alerta_toast_contenedor");e||((e=document.createElement("div")).id="wf_alerta_toast_contenedor",e.className="wf_alerta_toast_contenedor",document.body.appendChild(e));n="ok"===o?` 7 <div class='wf_alerta_toast_icono wf_alerta_toast_icono_ok'> 8 <div class='wf_alerta_toast_success_ring'></div> 9 <span class='wf_alerta_toast_success_line_tip'></span> 10 <span class='wf_alerta_toast_success_line_long'></span> 11 </div>`:"error"===o?` 12 <div class='wf_alerta_toast_icono wf_alerta_toast_icono_error'> 13 <span>!</span> 14 </div>`:` 15 <div class='wf_alerta_toast_icono wf_alerta_toast_icono_info'> 16 <span>i</span> 17 </div>`;const l=document.createElement("div"),d=(l.className="wf_alerta_toast wf_alerta_toast_"+o,l.setAttribute("role","alert"),l.setAttribute("aria-live","polite"),l.setAttribute("tabindex","-1"),l.innerHTML=` 18 ${n} 19 20 <div class='wf_alerta_toast_contenido'> 21 ${a?`<div class='wf_alerta_toast_titulo'>${a}</div>`:""} 22 <div class='wf_alerta_toast_texto'>${t||""}</div> 23 </div> 24 25 <div class='wf_alerta_toast_progress_container'> 26 <div class='wf_alerta_toast_progress'></div> 27 </div>`,e.appendChild(l),l.querySelector(".wf_alerta_toast_progress"));d&&(d.style.transition=`width ${parseInt(r,10)}ms linear`),requestAnimationFrame(function(){l.classList.add("wf_alerta_toast_show"),d&&(d.style.width="0%")}),setTimeout(function(){l.classList.remove("wf_alerta_toast_show"),l.classList.add("wf_alerta_toast_hide"),setTimeout(function(){l.remove(),e.querySelector(".wf_alerta_toast")||e.remove()},300)},parseInt(r,10))}}async function confirmar(e="¿Está seguro?",o="Confirmación"){return(await Swal.fire({title:o,text:e,icon:"warning",showCancelButton:!0,confirmButtonText:"SÃ",cancelButtonText:"Cancelar"})).isConfirmed}function set_modal_alto(o="auto"){document.querySelectorAll(".modal").forEach(function(e){e.style.height=o})}function cerrar_wf_barra_lateral(){var e="",o=(e+="Entrando en cerrar_sidebar\n",document.getElementById("wf_barra_lateral_activador"));e+="checkbox_activador obtenido: "+(o?"sÃ":"no")+"\n",o&&o.checked?(e=(e+="Checkbox marcado, procediendo a cerrar sidebar\n")+"label_activador obtenido: "+((o=document.querySelector("label[for='wf_barra_lateral_activador']"))?"sÃ":"no")+"\n",o?(e+="Disparando click en label_activador\n",o.click()):e+="label_activador no encontrado\n"):e+="
27Checkbox no marcado o no existe, nada que cerrar\n",console.log(e)}function tinymce_resolver_blobs(e){var o=e.getDoc(),o=o?o.querySelectorAll('img[src^="blob:"]'):[];if(o.length){const a=e.editorUpload?.blobCache;a&&o.forEach(e=>{var o=e.getAttribute("src"),o=a.getByUri(o);o&&(o=`data:${o.blob().type||"image/jpeg"};base64,`+o.base64(),e.setAttribute("src",o))})}}function editor_tinymce(e="sincronizar",a="",t=null){let r="";if(window.tinymce){let o=null;if(t instanceof Element?o=t:"string"==typeof t&&""!==t.trim()&&(o=document.querySelector(t)),o=o||document,"iniciar"===e){let e=[];if(a&&""!==String(a).trim()){t=document.querySelector(a);if(!t)return void console.warn("No se ha encontrado el selector: "+a);e=[t]}else if(!(e=Array.from(o.querySelectorAll("textarea.editor_enriquecido"))).length)return;window.__wf_tinymce_focusin_fix||(window.__wf_tinymce_focusin_fix=1,document.addEventListener("focusin",e=>{e.target&&(e.target.closest?.(".tox-dialog")||e.target.classList?.contains?.("tox-dialog"))&&e.stopImmediatePropagation()},!0));for(const i of e){var n;i.hasAttribute("required")&&i.removeAttribute("required"),i.id||(i.id="tinymce_"+Date.now()+"_"+Math.floor(1e5*Math.random())),tinymce.get(i.id)||(n="#"+CSS.escape(i.id),tinymce.init({selector:n,height:500,plugins:"code visualblocks fullscreen lists link image media charmap table emoticons anchor insertdatetime advlist autosave",toolbar:"undo redo | code visualblocks fullscreen | bold italic underline | bloques estilos forecolor backcolor | alignleft aligncenter alignright al
27ignjustify | bullist numlist outdent indent | link image media charmap anchor | table hr insertdatetime | emoticons | removeformat",toolbar_mode:"wrap",automatic_uploads:!0,paste_data_images:!0,images_file_types:"jpeg,jpg,png,gif,webp",images_upload_handler:(a,e)=>new Promise((e,o)=>{try{e(`data:${a.blob().type||"image/jpeg"};base64,`+a.base64())}catch(e){o(e)}}),setup:function(o){o.ui.registry.addMenuButton("bloques",{icon:"paragraph",tooltip:"Formato",fetch:function(e){e([{type:"menuitem",text:"Párrafo",onAction:()=>o.execCommand("FormatBlock",!1,"p")},{type:"menuitem",text:"Encabezado 1",onAction:()=>o.execCommand("FormatBlock",!1,"h1")},{type:"menuitem",text:"Encabezado 2",onAction:()=>o.execCommand("FormatBlock",!1,"h2")},{type:"menuitem",text:"Encabezado 3",onAction:()=>o.execCommand("FormatBlock",!1,"h3")},{type:"menuitem",text:"Preformateado",onAction:()=>o.execCommand("FormatBlock",!1,"pre")},{type:"menuitem",text:"Divisor",onAction:()=>o.execCommand("FormatBlock",!1,"div")}])}}),o.ui.registry.addMenuButton("estilos",{icon:"formatpainter",tooltip:"Estilos",fetch:function(e){e([{type:"menuitem",text:"6pt",onAction:function(){o.execCommand("FontSize",!1,"6pt")}},{type:"menuitem",text:"8pt",onAction:function(){o.execCommand("FontSize",!1,"8pt")}},{type:"menuitem",text:"10pt",onAction:function(){o.execCommand("FontSize",!1,"10pt")}},{type:"menuitem",text:"12pt",onAction:function(){o.execCommand("FontSize",!1,"12pt")}},{type:"menuitem",text:"14pt",onAction:function(){o.execCommand("FontSize",!1,"14pt")}},{type:"menuitem",text:"16pt",onAction:function(){o.execCommand("FontSize",!1,"16pt")}},{type:"menuitem",text:"18pt",onAction:function(){o.execCommand("FontSize",!1,"18pt")}},{type:"menuitem",text:"20pt",onAction:function(){o.execCommand("FontSize",!1,"20pt")}},{type:"menuitem",text:"22pt",onAction:function(){o.execCommand("FontSize",!1,"22pt")}}])}})},menubar:!1,language:"es",language_url:"/js/tinymce_7.9.1/langs/es.js",branding:!1,license_key:"gpl",visualblocks_default_state:!0,convert_urls:!1,relative_urls:!1,remove_script_host:!1,content_css:["https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css","/estilomatriz.css"],extended_valid_elements:"iframe[src|frameborder|style|scrolling|class|width|height|name|align|allow|allowfullscreen|loading|referrerpolicy],span[style|class]",valid_children:"+body[iframe],+body[hr],+body[table],+body[script],+body[style]",schema:"html5",verify_html:!1,sanitize:!1,valid_styles:{"*":"color,background-color,font-size,text-align,margin,margin-left,margin-right,margin-top,margin-bottom,padding,padding-left,padding-right,padding-top,padding-bottom,float,display",img:"width,height,object-fit,max-width,border,border-radius",div:"width,height",span:"color,background-color,font-size"},forced_root_block:"p",invalid_elements:"script,style",sandbox_iframes:!1,entity_encoding:"raw",preprocess:function(e,o){o.content=o.content.replace(/\t/g,` `)}}),r+=`Iniciado TinyMCE en: ${n} (id=${i.id}) 28`)}void(""!==r.trim()&&console.log(r.trim()))}else if("sincronizar"===e){try{for(const s of tinymce?.editors||[])tinymce_resolver_blobs(s)}catch(e){}try{tinymce.triggerSave(),r+=`Contenido del editor volcado en textarea 29`}catch(e){}""!==r.trim()&&console.log(r.trim())}}else console.warn("TinyMCE no está disponible")}function editor_codemirror(e="sincronizar",a="",t=null){let r="";if(window.CodeMirror){let o=null;if(t instanceof Element?o=t:"string"==typeof t&&""!==t.trim()&&(o=document.querySelector(t)),o=o||document,"iniciar"===e){let e=[];
29if(a&&""!==String(a).trim()){t=o.querySelector(a)||document.querySelector(a);if(!t)return void console.warn("No se ha encontrado el selector: "+a);e=[t]}else if(!(e=Array.from(o.querySelectorAll("textarea.editor_codemirror"))).length)return;window.__wf_codemirror||(window.__wf_codemirror=new Map);for(const l of e)if(!l.__wf_cm){var n=l.dataset.cmMode?String(l.dataset.cmMode):"text/html",i=l.dataset.cmTheme?String(l.dataset.cmTheme):"blackboard",s=!l.dataset.cmLineNumbers||"0"!==l.dataset.cmLineNumbers,c="1"===l.dataset.cmReadOnly;const d=CodeMirror.fromTextArea(l,{lineNumbers:s,mode:n,theme:i,readOnly:c,extraKeys:{F11:function(e){e.setOption("fullScreen",!e.getOption("fullScreen"))},Esc:function(e){e.getOption("fullScreen")&&e.setOption("fullScreen",!1)}},autoRefresh:!0});l.__wf_cm=d,l.id||(l.id="codemirror_"+Date.now()+"_"+Math.floor(1e5*Math.random())),window.__wf_codemirror.set(l.id,d),setTimeout(()=>{try{d.refresh()}catch(e){}},0),r+=`Iniciado CodeMirror en: #${l.id} (mode=${n}, theme=${i}) 30`}void(""!==r.trim()&&console.log(r.trim()))}else if("sincronizar"===e){let e=[];
30if(a&&""!==String(a).trim()){t=o.querySelector(a)||document.querySelector(a);if(!t)return;e=[t]}else if(!(e=Array.from(o.querySelectorAll("textarea.editor_codemirror"))).length)return;for(const u of e){if(!u.__wf_cm)try{editor_codemirror("iniciar","#"+CSS.escape(u.id||""),o)}catch(e){}if(u.__wf_cm)try{u.value=u.__wf_cm.getValue(),r+=`Sincronizado CodeMirror -> textarea (#${u.id}) 31`}catch(e){}}""!==r.trim()&&console.log(r.trim())}}else console.warn("CodeMirror no está disponible")}function crear_callback(){return{executed:!1,func:null,add:function(e){this.executed||(this.func=e)},fire:function(e){!this.executed&&this.func&&(this.func(e),this.executed=!0)}}}function mostrar_espera(){var e;document.querySelector(".espera")||((e=document.createElement("div")).className="espera",document.body.appendChild(e))}function eliminar_espera(){document.querySelectorAll(".espera").forEach(e=>e.remove())}async function pintar_tabla_json(o="none",a="",t=1,r=0,n="",i=1e3,s=40,c="600px",l={}){console.groupCollapsed("ð¦ pintar_tabla_json");let d="";const u=30,p=(e,o="",a="")=>{var t;o&&""!==a&&null!=a?(t=String(o).padEnd(u," "),d+=e+` ${t}: ${a} 32`):d+=o?e+` ${o} 33`:e+` 34`};var f=(e,o="")=>p("â¤",e,o),m=(e,o="")=>p("â ",e,o),_=(e,o="")=>p("â ï¸",e,o),h=(e,o="")=>p("â",e,o);if(f("INICIO","pintar_tabla_json"),f("Parámetro url",o),f("Parámetro contenedor",a),f("Parámetro d",t),f("Parámetro dc",r),f("Parámetro param",n),f("Parámetro resultados",i),f("Parámetro rowheight",s),f("Parámetro minHeight",c),f("Parámetro opciones",JSON.stringify(l)),""===a||null==a){f("Contenedor","VacÃo, intentando deducir a partir de la URL");let e="";var g=o.match(/(?:\?|&)proceso=([^&#]+)/);g&&g[1]?f("Contenedor deducido desde proceso=",e=g[1]):"undefined"!=typeof enrutador&&o.startsWith(enrutador)?f("Contenedor deducido desde enrutador",e=o.slice(enrutador.length)):f("Contenedor deducido desde último segmento",e=(o.split("/").pop()||"").trim()),f("Contenedor final deducido",a=(e=(e=e.split(/[?#]/)[0]).replace(/[^A-Za-z0-9_-]/g,"_"))?"#"+e:"")}if(!a)throw h("Selector contenedor","VacÃo tras intento de deducción"),console.log(d),console.groupEnd(),new Error("Selector del contenedor vacÃo. No se pudo deducir a partir de la URL.");g=document.querySelectorAll(a).length;if(f("Selector contenedor",a),f("Coincidencias DOM",g),0===g)throw h("DOM",`No existe ningún elemento con el selector '${a}'`),console.log(d),console.groupEnd(),new Error(`El contenedor '${a}' no existe en el DOM.`);1<g?_("DOM",`Se han encontrado ${g} elementos con el selector '${a}'. Se usará el primero.`):m("DOM","Contenedor único encontrado correctamente");var g=a.replace(/^#/,""),b=""+o+(n=String(n||"").replace(/([&?])(d|dc)=(-?\d*)/g,"")),t=""+o+n+"&d="+t,n=""+o+n+"&dc="+r;f("persistenceID",g),f("URL datos (ajaxURL)",b),f("URL columnas",t),f("URL diseño columnas (dc)",n);let{url_mod_orden:v="",startExpanded:$=!1,barra_de_paginacion:y=!0}=l;!v&&o.includes("_tabla_json")&&f("url_mod_orden deducida automáticamente",v=o.replace("_tabla_json","_mod_orden"));l={headerTooltip:!0,headerSortStartingDir:"desc",formatter:"html",responsive:0,resizable:!1,vertAlign:"middle",headerFilter:"input",headerSort:!0,frozen:!1,sorter:"string"};"function"==typeof mostrar_espera?(f("mostrar_espera","Llamando a mostrar_espera()"),mostrar_espera()):_("mostrar_espera","No es una función definida");try{let e=l;if(f("columnDefaults","Inicializado con diseño por defecto"),0!==r){f("Diseño remoto","Intentando cargar diseño remoto de columnas (dc != 0)...");try{var w,x=await fetch(n);f("respuesta_dc.ok",x.ok),f("respuesta_dc.status",x.status),x.ok?(w=await x.json(),f("json_de_respuesta_dc recibido",JSON.stringify(w)),w&&"object"==typeof w?(e=w,m("columnDefaults","Actualizado desde diseño remoto")):_("json_de_respuesta_dc","No es un objeto válido, se mantiene fallback")):_("Diseño remoto","No se pudo cargar el diseño remoto, status != 200. Se mantiene fallback.")}catch(e){_("Diseño remoto","Error cargando diseño remoto, usando fallback local: "+e.message),console.warn("Error cargando diseño remoto, usando fallback local.",e)}}else f("Diseño remoto","dc == 0 â usando únicamente diseño local por defecto.");f("Columnas","Solicitando columnas a: "+t);var j=await fetch(t);if(f("Columnas respuesta.ok",j.ok),f("Columnas respuesta.status",j.status),!j.ok)throw new Error("Error al cargar columnas: "+j.status);var S=await j.json(),E=(f("Columns JSON recibido",JSON.stringify(S)),Array.isArray(S)&&S.some(e=>e&&"_select"===e.field)),k=(f("Detección de árbol",E),{layout:"fitColumns",minHeight:c,responsiveLayout:!0,scrollHorizontal:!0,ajaxURL:b,ajaxConfig:"GET",rowHeight:s,pagination:y,paginationSize:i,paginationSizeSelector:[25,50,100],placeholder:"Sin datos",columnDefaults:e,columns:S,dataLoaderLoading:"<div class='espera'></div>",persistenceMode:"local",persistenceID:g,persistence:{sort:!0},locale:"es-es",langs:{"es-es":{columns:{name:"Nombre",progress:"Progreso",gender:"Género",rating:"Puntuación",col:"Color",dob:"Nacimiento"},pagination:{page_size:"Resultados",first:"Primera",first_title:"Primera página",last:"Ãltima",last_title:"Ãltima página",prev:"Anterior",prev_title:"Página anterior",next:"Siguiente",next_title:"Siguiente página",all:"Todo"}}}});f("Opciones base Tabulator",JSON.stringify({ajaxURL:k.ajaxURL,minHeight:k.minHeight,rowHeight:k.rowHeight,pagination:k.pagination,paginationSize:k.paginationSize,persistenceID:k.persistenceID})),E&&(f("dataTree","Configurando opciones de árbol (dataTree)..."),Object.assign(k,{dataTree:!0,dataTreeStartExpanded:!!$,dataTreeChildField:"_children",dataTreeSelectPropagate:!0}),v?(f("Drag & Drop","Habilitando drag & drop con url_mod_orden: "+v),k.rowFormatter=function(l){var e=l.getElement();e.setAttribute("draggable",!0),e.addEventListener("dragstart",e=>{e.dataTransfer.setData("text/plain",JSON.stringify(l.getData()))}),e.addEventListener("dragover",e=>e.preventDefault()),e.addEventListener("drop",async e=>{e.preventDefault();const o=l.getTable();var e=JSON.parse(e.dataTransfer.getData("text/plain")),a=l.getData();if(e.id!==a.id){var t=o.getRow(e.id);const s=[],c=e=>
34{e.getTreeChildren().forEach(e=>{s.push(e.getData().id),c(e)})};if(t&&c(t),!s.includes(a.id))try{var r=await fetch(`${v}&id=${e.id}&nidpadre=`+a.id);if(!r.ok)throw new Error("HTTP "+r.status);var n,i=await r.json();1===i.code?(n=o.getRows().filter(e=>e.isTreeExpanded()).map(e=>e.getData().id),await o.setData(),n.forEach(e=>{e=o.getRow(e);e&&e.treeExpand()})):console.error("Error servidor: "+(i.str??JSON.stringify(i)))}catch(e){console.error("Error actualización: "+e.message)}}})}):_("Drag & Drop","es_arbol = true pero sin url_mod_orden, no se configura drag & drop.")),f("Tabulator","Instanciando Tabulator sobre el contenedor: "+a),new Tabulator(a,k),m("Tabulator","Instanciado correctamente")}catch(e){h("CATCH","Error en pintar_tabla_json -> "+e.message),console.error(e),document.body&&(document.body.innerHTML=`<p class='as400'>Error al cargar la tabla: ${e.message}</p>`)}finally{f("FINALLY","Entrando en bloque finally"),"function"==typeof eliminar_espera?(f("eliminar_espera","Llamando a eliminar_espera()"),eliminar_espera()):_("eliminar_espera","No es una función definida"),f("FIN","Fin de pintar_tabla_json"),console.log(d),console.groupEnd()}}async function pintar_arbol_json(e="none",o="#tabla_registros",a=1,d="",t="",r=1e3){var n=""+e+t,e=""+e+t+"&d="+a,t={headerTooltip:!0,headerSortStartingDir:"desc",formatter:"html",responsive:0,resizable:!1,vertAlign:"middle",headerFilter:"input",headerSort:!0,frozen:!1,sorter:"string"};let i=[{title:"Nombre",field:"nombre",formatter:"html",headerFilter:"input",headerTooltip:!0},{title:"Descripción",field:"descripcion",formatter:"html",headerFilter:"input",headerTooltip:!0},{headerTooltip:!0,formatter:"rowSelection",titleFormatter:"rowSelection",headerSort:!1,frozen:!0,hozAlign:"center",width:50}];mostrar_espera();try{if(1==a){var s=await fetch(e);if(!s.ok)throw new Error("Error al cargar columnas: "+s.status);i=await s.json()}const u=new Tabulator(o,{ajaxURL:n,ajaxConfig:"GET",selectable:!0,dataTree:!0,dataTreeStartExpanded:!1,dataTreeChildField:"_children",dataTreeSelectPropagate:!0,columnDefaults:t,columns:i,placeholder:"Sin datos",layout:"fitColumns",pagination:!0,paginationSize:r,paginationSizeSelector:[25,50,100],locale:"es-es",langs:{"es-es":{pagination:{page_size:"Resultados",first:"Primera",last:"Ãltima",prev:"Anterior",next:"Siguiente",all:"Todo"}}},rowFormatter:function(l){var e=l.getElement();e.setAttribute("draggable",!0),e.addEventListener("dragstart",e=>{e.dataTransfer.setData("text/plain",JSON.stringify(l.getData()))}),e.addEventListener("dragover",e=>e.preventDefault()),e.addEventListener("drop",async e=>{e.preventDefault();var e=JSON.parse(e.dataTransfer.getData("text/plain")),o=l.getData();if(e.id===o.id)return console.error("No puedes mover una fila dentro de sà misma.");var a=u.getRow(e.id);const t=[],r=e=>
34{e.getTreeChildren().forEach(e=>{t.push(e.getData().id),r(e)})};if(a&&r(a),t.includes(o.id))return console.error("No puedes mover un padre dentro de su propio descendiente.");try{var n=await fetch(`${d}&id=${e.id}&nidpadre=`+o.id);if(!n.ok)throw new Error("HTTP "+n.status);var i,s,c=await n.json();1===c.code?(console.log(`Actualización: ${e.id} â padre `+o.id),i=u.getRows().filter(e=>e.isTreeExpanded()).map(e=>e.getData().id),await u.setData(),i.forEach(e=>{e=u.getRow(e);e&&e.treeExpand()})):(s=c.str??JSON.stringify(c),console.error("Error servidor: "+s))}catch(e){console.error("Error actualización: "+e.message)}})}});console.log("Tabla inicializada:",u)}catch(e){console.error("Error en pintar_arbol_json:",e)}finally{eliminar_espera()}}function obtener_ids_seleccionados(e,o=null){if(!e||"string"!=typeof e)return[];const a=e.startsWith("#")?e:"#"+e;const t=(e,o)=>{try{if(e&&"function"==typeof e.getIndex){var a=e.getIndex();if(null!=a&&""!==String(a))return String(a);var t=e.getData?e.getData():null;if(t&&"object"==typeof t){var r=("function"==typeof o?.getOptions?o.getOptions():{})?.index;if(r&&void 0!==t[r]&&null!==t[r]&&""!==String(t[r]))return String(t[r]);for(const i of["id","ID","Id","idreg","id_reg","id_articulo","idarticulo"])if(void 0!==t[i]&&null!==t[i]&&""!==String(t[i]))return String(t[i])}}if(e&&"object"==typeof e){var n=("function"==typeof o?.getOptions?o.getOptions():{})?.index;if(n&&void 0!==e[n]&&null!==e[n]&&""!==String(e[n]))return String(e[n]);for(const s of["id","ID","Id","idreg","id_reg","id_articulo","idarticulo"])if(void 0!==e[s]&&null!==e[s]&&""!==String(e[s]))return String(e[s])}}catch(e){}return""};e=!!document.querySelector(a+" .selec[type='checkbox']");const r=(()=>{try{var e=Tabulator.findTable(a);return Array.isArray(e)?e[0]:null}catch(e){return null}})();var n=!(!r||"function"!=typeof r.getColumns||!r.getColumns().some(e=>"function"==typeof e.getField&&"_select"===e.getField())),i=!(!r||"function"!=typeof r.getSelectedRows&&"function"!=typeof r.getSelectedData);let s;if(0===o||1===o)s=o;else if(e)s=1;else{if(!n&&!i)return[];s=0}let c=[];if(0===s){if(!r)return console.log(`obtener_ids_seleccionados ${a}: no hay instancia Tabulator.`),[];try{var l="function"==typeof r.getSelectedRows?r.getSelectedRows():[];Array.isArray(l)&&l.length&&(c=l.map(e=>t(e,r)).filter(Boolean))}catch(e){}if(!c.length)try{var d="function"==typeof r.getSelectedData?r.getSelectedData():[];Array.isArray(d)&&d.length&&(c=d.map(e=>t(e,r)).filter(Boolean))}catch(e){}c.length||document.querySelectorAll(a+" .selec[type='checkbox']:checked").length&&(s=1)}return 1===s&&(o=document.querySelectorAll(a+" .selec[type='checkbox']:checked"),c=Array.from(o).map(e=>String(e.dataset.id||"")).filter(Boolean)),console.log(`obtener_ids_seleccionados [${a}] (modo=${s}) â`,c),c}function actualizar_tablas_tabulator(e=""){let i="Iniciando actualización de tablas Tabulator\n";document.querySelectorAll(e+".tabulator").forEach((t,r)=>{i+=`Tabla ${r}: buscando instancia de Tabulator... 35`;const n=Tabulator.findTable(t)[0];if(n){i=(i+=`Tabla ${r}: instancia encontrada 36`)+`Tabla ${r}: ajaxURL = ${n.options.ajaxURL} 37`;let e=[],o=(n.options.dataTree&&(i+=`Tabla ${r}: dataTree activo, guardando nodos expandidos 38`,e=n.getRows().filter(e=>e._row.modules.dataTree.open).map(e=>e.getData().id),i+=`Tabla ${r}: nodos expandidos: ${JSON.stringify(e)} 39`),Array.from(t.querySelectorAll(".selec:checked")).map(e=>e.dataset.id));i+=`Tabla ${r}: guardando checkboxes seleccionados: ${JSON.stringify(o)} 40`;let a;(a=n.options.ajaxURL?(i+=`Tabla ${r}: iniciando recarga remota con setData(ajaxURL) 41`,n.setData(n.options.ajaxURL).then(()=>{i+=`Tabla ${r}: setData(ajaxURL) resuelta 42`})):(i+=`Tabla ${r}: iniciando recarga local con setData(data) 43`,n.setData(n.options.data).then(()=>{i+=`Tabla ${r}: setData(data) resuelta 44`}))).then(()=>{i+=`Tabla ${r}: recarga completada 45`,n.options.dataTree&&(i+=`Tabla ${r}: reexpandiendo nodos 46`,e.forEach(e=>{var o=n.getRow(e);o?(o.treeExpand(),i+=`-- Nodo expandido id=${e} 47`):i+=`-- Nodo id=${e} no encontrado 48`})),o.length&&(i+=`Tabla ${r}: restaurando checkboxes seleccionados y clase tabulator-selected
49`,o.forEach(e=>{var o=t.querySelector(`.selec[data-id='${e}']`);o?(o.checked=!0,(o=o.closest(".tabulator-row"))&&o.classList.add("tabulator-selected"),i+=`-- Checkbox marcado y fila destacada id=${e} 50`):i+=`-- Checkbox id=${e} no encontrado 51`})),console.log(i)}).catch(e=>{i+=`Tabla ${r}: error en recarga: ${e.message} 52`,console.error(i)})}else i+=`Tabla ${r}: no se encontró instancia, se omite 53`,console.log(i)})}function cargar_tabla_pedidos(e=0,o="#div_pedidos",a=1){pintar_tabla_json("/json.php?proceso=tab_ec_pedidos_usr",o,a,0,"&iduser="+e)}function datas(e,o={}){if(!e||0===Object.keys(e).length)return"";var a,t,r,n=Array.isArray(o.excluir)?o.excluir:[],i=Array.isArray(o.incluir)?o.incluir:null;let s="";for([a,t]of Object.entries(e))i&&!i.includes(a)||n.includes(a)||void 0!==t&&null!==t&&(r=String(t)).length&&(s+=`&${encodeURIComponent(a)}=`+encodeURIComponent(r));return s}function lanzar_y_borrar(e,o,a){let t=document.createElement("span");t.classList.add("d-none",e),Array.isArray(o)?Array.isArray(o)&&Array.isArray(a)&&o.length===a.length&&o.forEach((e,o)=>{t.setAttribute("data-"+e,a[o])}):t.setAttribute("data-"+o,a),document.body.appendChild(t),t.click(),document.body.removeChild(t)}function archivos_crear_uploader(e){const o=document.querySelector(e.selector),r=e.url_subida,a=e.url_pintar,t=e.url_borrar,i=e.extra||{};if(o){o.querySelector(".uploader")||(o.innerHTML=` 54 <div 55 class='uploader m-2 p-2 text-center puntero text-info' 56 style='border:2px dashed #ccc; border-radius: 1.25rem!important; background-color: #17a2b81a !important;' 57 data-wf-pastezone 58 data-wf-dropzone 59 > 60 <p>Arrastra los archivos aquà o pega con <b>Ctrl+V</b></p> 61 <button type='button' class='btn btn-outline-info'> 62 <i class='fa fa-cloud-upload rem 4 my-2 rem1 mr-2'></i> 63 <span>O clic para seleccionar</span> 64 </button> 65 66 <input type='file' multiple hidden> 67 68 <input class="uploader_clipboard" type="text" 69 style="position:absolute; left:-9999px; width:1px; height:1px; opacity:0;" 70 > 71 </div> 72 <div class='preview mt-3 row' id='preview_archivos'></div> 73 `);const u=o.querySelector(".uploader"),p=u.querySelector("input[type=file]"),f=o.querySelector("#preview_archivos"),m=u.querySelector(".uploader_clipboard");u.setAttribute("tabindex","0"),m&&m.addEventListener("paste",async e=>{var o=e.clipboardData;if(o){var a,t,r=[];if(o.items&&o.items.length)for(const l of o.items)"file"===l.kind&&(a=l.getAsFile(),(t=a)&&(t.type&&t.type.startsWith("image/")||"application/pdf"===t.type))&&r.push(a);if(r.length)e.preventDefault(),d(r);else{o=o.getData("text/plain");if(o){o=o.trim();if(/^https?:\/\//i.test(o)){e.preventDefault();try{mostrar_espera();var n=await fetch(o,{credentials:"omit"});if(!n.ok)throw new Error("HTTP "+n.status);var i=await n.blob();if(!i.type.startsWith("image/")&&"application/pdf"!==i.type)throw new Error("Tipo no permitido: "+(i.type||"desconocido"));var s="application/pdf"===i.type?"pdf":i.type.split("/")[1]||"img",c=`pegado_${Date.now()}.`+s;d([new File([i],c,{type:i.type||"application/octet-stream"})])}catch(e){alert("No se pudo pegar desde URL"),console.warn(e)}finally{eliminar_espera()}}}}}});const _=o.querySelector("form.uploader_form");u.addEventListener("click",()=>{(m||u).focus(),p.click()});let n=null;const h=()=>{n&&(n.remove(),n=null)};function s(){const a={};_&&["tabla","idregistro","id_idioma","modo","carpeta"].forEach(e=>{var o=_.querySelector(`[name='${e}']`);o&&String(o.value).length&&(a[e]=o.value)}),!a.tabla&&o.dataset.tabla&&(a.tabla=o.dataset.tabla),!a.idregistro&&o.dataset.idregistro&&(a.idregistro=o.dataset.idregistro),!a.id_idioma&&o.dataset.id_idioma&&(a.id_idioma=o.dataset.id_idioma);for(const e in i)a[e]=i[e];return a}function c(){return datas(s(),{excluir:["d","dc"]})}function d(e){const o=new FormData;var a=s();for(const t in a)o.append(t,a[t]);e=Array.from(e||[]);e.length&&(e.forEach(e=>o.append("archivo[]",e)),mostrar_espera(),fetch(r,{method:"POST",body:o}).then(e=>e.json()).then(e=>{e.d&&console.log("DEBUG subida:",e.d),l(),actualizar_tablas_tabulator()}).catch(()=>alert("Error al subir archivos")).finally(()=>eliminar_espera()))}function l(){mostrar_espera();var e=c(),e=e.length?""+a+e:a;fetch(e).then(e=>e.json()).then(e=>{e.d&&console.log("DEBUG pintar:",e.d),1===e.code&&e.html&&(f.innerHTML=e.html)}).catch(()=>alert("Error al pintar archivos")).finally(()=>eliminar_espera())}document.addEventListener("click",e=>
73{n&&((e=e.target.closest("[data-wf-ctx]"))&&"pegar"===e.dataset.wfCtx&&(m||u).focus(),h())}),document.addEventListener("keydown",e=>{"Escape"===e.key&&h()}),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),u.addEventListener("contextmenu",e=>{console.log("[CTX handler] entro",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,innerWidth:window.innerWidth,innerHeight:window.innerHeight}),e.preventDefault(),e.stopPropagation(),console.log("[CTX handler] llamo ctx_open"),((e,o)=>{console.log("[CTX open] creando",{x:e,y:o}),h(),(n=document.createElement("div")).className="wf_ctxmenu dropdown-menu show",n.style.position="fixed",n.style.left=e+"px",n.style.top=o+"px",n.style.setProperty("z-index","2147483647","important"),n.innerHTML='<button type="button" class="dropdown-item" data-wf-ctx="pegar">Sólo puedes pegar con CONTROL-V. Hazlo ahora</button>',document.body.appendChild(n);var a=n.getBoundingClientRect();let t=e,r=o;a.right>window.innerWidth&&(t=window.innerWidth-a.width-8),window.innerHeight<a.bottom&&(r=window.innerHeight-a.height-8),n.style.left=Math.max(8,t)+"px",n.style.top=Math.max(8,r)+"px"})(e.clientX,e.clientY)}),["dragover","dragenter"].forEach(e=>u.addEventListener(e,e=>{e.preventDefault(),u.style.background="#f0f0f0"})),["dragleave","drop"].forEach(e=>u.addEventListener(e,e=>{e.preventDefault(),u.style.background="#17a2b81a"})),u.addEventListener("drop",e=>{d(e.dataTransfer.files)}),p.addEventListener("change",e=>{d(e.target.files)}),f.addEventListener("click",e=>{var o;(e.target.matches(".borrar_archivo")||e.target.closest(".borrar_archivo"))&&(o=e.target.closest(".borrar_archivo"),e=e.target.dataset.id||o.dataset.id,mostrar_espera(),o=(o=c()).length?""+t+e+o:""+t+e,fetch(o).then(e=>e.json()).then(e=>{e.d&&console.log("DEBUG borrar:",e.d),l(),actualizar_tablas_tabulator()}).catch(()=>alert("Error al borrar archivo")).finally(()=>eliminar_espera()))}),l()}}function jq_uploader(e,o,s,c,a,t,r,n,i,l,d,u,p,f,m,_,h=0,g=1){var b;1===o?$.ajax({url:"/json.php?proceso=jq_uploader_files&dir="+c+"&id="+s+"&tab="+u+"&cdb="+p+"&cdbid="+f,async:!1,dataType:"json",success:function(e){b=e}}):b=null,b=b||null;$(e).filer({limit:a,maxSize:30,extensions:["","jpg jpeg","jpg jpeg png webp","jpg jpeg png tif tiff gif","jpg jpeg png tif tiff gif doc docx xls xlsx pdf txt js htm html xls xlsx doc docx css csv mp4 mp3 webp webm mp3 ogg","pdf","png","inc","ico","htm","php"][r].split(" "),changeInput:'<div class="jFiler-input-dragDrop"><div class="jFiler-input-inner"><div class="jFiler-input-icon"><i class="icon-jfi-cloud-up-o"></i></div><div class="jFiler-input-text"><h3>Arrastre y suelte archivos aquÃ.</h3> <span style="display:inline-block; margin: 15px 0">O bien</span></div><a class="jFiler-input-choose-btn blue">Pulse y elija archivos</a></div></div>',showThumbs:!0,theme:"dragdropbox",templates:{box:'<ul class="jFiler-items-list jFiler-items-grid"></ul>',item:'<li class="jFiler-item">\t\t\t\t\t\t<div class="jFiler-item-container">\t\t\t\t\t\t\t<div class="jFiler-item-inner">\t\t\t\t\t\t\t\t<div class="jFiler-item-thumb">\t\t\t\t\t\t\t\t\t<div class="jFiler-item-status"></div>\t\t\t\t\t\t\t\t\t<div class="jFiler-item-info">\t\t\t\t\t\t\t\t\t\t<span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\t\t\t\t\t\t\t\t\t\t<span class="jFiler-item-others">{{fi-size2}}</span>\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t{{fi-image}}\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t<div class="jFiler-item-assets jFiler-row">\t\t\t\t\t\t\t\t\t<ul class="list-inline float-left">\t\t\t\t\t\t\t\t\t\t<li>{{fi-progressBar}}</li>\t\t\t\t\t\t\t\t\t</ul>\t\t\t\t\t\t\t\t\t<ul class="list-inline float-right">\t\t\t\t\t\t\t\t\t\t<li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\t\t\t\t\t\t\t\t\t</ul>\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t</div>\t\t\t\t\t\t</div>\t\t\t\t\t</li>',itemAppend:'<li class="jFiler-item">\t\t\t\t\t\t\t<div class="jFiler-item-container">\t\t\t\t\t\t\t\t<div class="jFiler-item-inner">\t\t\t\t\t\t\t\t\t<div class="jFiler-item-thumb">\t\t\t\t\t\t\t\t\t\t<div class="jFiler-item-status"></div>\t\t\t\t\t\t\t\t\t\t<div class="jFiler-item-info">\t\t\t\t\t\t\t\t\t\t\t<span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\t\t\t\t\t\t\t\t\t\t\t<span class="jFiler-item-others">{{fi-size2}}</span>\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t{{fi-image}}\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t<div class="jFiler-item-assets jFiler-row">\t\t\t\t\t\t\t\t\t\t<ul class="list-inline float-left">\t\t\t\t\t\t\t\t\t\t\t<li><span class="jFiler-item-others">{{fi-icon}}</span></li>\t\t\t\t\t\t\t\t\t\t</ul>\t\t\t\t\t\t\t\t\t\t<ul class="list-inline float-right">\t\t\t\t\t\t\t\t\t\t\t<li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\t\t\t\t\t\t\t\t\t\t</ul>\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t</div>\t\t\t\t\t\t</li>',progressBar:'<div class="bar"></div>',itemAppendToEnd:!1,removeConfirmation:!0,_selectors:{list:".jFiler-items-list",item:".jFiler-item",progressBar:".bar",remove:".jFiler-item-trash-action"}},dragDrop:{dragEnter:null,dragLeave:null,drop:null},uploadFile:{url:["/upload.php","/a/upload.php"][h]+"?id="+s+"&dir="+c+"&max="+a+"&mar
73ca_agua="+t+"&ext="+r+"&sar="+n+"&mod_ancho="+i+"&ancho="+l+"&save_db="+d+"&tab="+u+"&cdb="+p+"&cdbid="+f+"&sobescr="+m+"&namefile="+_+"&to="+g,data:null,type:"POST",enctype:"multipart/form-data",beforeSend:function(){},success:function(e,o){var a=o.find(".jFiler-jProgressBar").parent();o.find(".jFiler-jProgressBar").fadeOut("slow",function(){$('<div class="jFiler-item-others text-success"><i class="icon-jfi-check-circle"></i> Success</div>').hide().appendTo(a).fadeIn("slow")})},error:function(e){var o=e.find(".jFiler-jProgressBar").parent();e.find(".jFiler-jProgressBar").fadeOut("slow",function(){$('<div class="jFiler-item-others text-error"><i class="icon-jfi-minus-circle"></i> Error</div>').hide().appendTo(o).fadeIn("slow")})},statusCode:null,onProgress:null,onComplete:null},files:b,addMore:!0,clipBoardPaste:!0,excludeName:null,beforeRender:null,afterRender:null,beforeShow:null,beforeSelect:null,onSelect:null,afterShow:null,onRemove:function(e,o,a,t,r,n,i){o=o.name;$.post("/ajax.php?proceso=del_file&dir="+c+"&deldb="+d+"&tab="+u+"&cdbid="+f+"&cdb="+p+"&id="+s,{nombre:o})},onEmpty:null,options:null,captions:{button:"Elija sus archivos",feedback:"Elija archivos para subir",feedback2:"Los archivos se han elegidos",drop:"Arrastre aquà archivos para subirlos.",removeConfirmation:"¿Seguro que desea eliminar?",errors:{filesLimit:"Sólo se pueden subir {{fi-limit}} archivos.",filesType:"Sólo se permiten archivos con extensión: {{fi-extensions}}",filesSize:"{{fi-name}} es demasiado grande! Suba un fichero hasta {{fi-maxSize}} MB.",filesSizeAll:"¡Los archivos pesan demasiado! Sube archivos hasta {{fi-maxSize}} MB."}}})}function r_ajax(e,o,a="",t="get",r){$.ajax({cache:!1,type:t,url:e,data:o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),""!==a&&$(a).html(e),r&&r(e)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}function send_pass_usr(){return $.ajax({cache:!1,type:"post",url:"/ajax.php?proceso=send_pass_usr",data:$("#form_rec_pass_usr").serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),0==e.code?swal.fire("",e.str,"error"):1==e.code&&(swal_toast.fire({text:e.str}),"undefined"!=typeof modal_open_form_rec_pass&&modal_open_form_rec_pass.close(),"undefined"!=typeof modal_open_form_login)&&modal_open_form_login.close()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}}),!1}function close_session(){return $.ajax({cache:!1,type:"get",url:"/ajax.php",data:"proceso=closesession",success:function(e){load_icon_usr()}}),!1}function $_GET(e){e=(e=e.replace(/[\[]/,"\\[")).replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+e+"=([^&#]*)"),o=unescape(window.location.href),e=e.exec(o),o=null===e?null:e[1];return o}function load_icon_usr(o=0){return d="Entramos en load_icon_usr\n",$("#wf_ico_sistema").length&&(d+="Encontrado #wf_ico_sistema: "+$("#wf_ico_sistema").length+" veces\nEncontrado .open-cesta-tumbl: "+$(".open-cesta-tumbl").length+" veces\n",$.post("/ajax.php?proceso=iconos_usr",function(e){d+="Ejecutamos procesosajax >> iconos_usr\n",$("#wf_ico_sistema").html(e),1==o?(d+="Abrimos cesta en miniatura.\n",$(".open-cesta-tumbl").first().trigger("click")):d+="NO abrimos cesta en miniatura.\n"})),$("#wf_ico_sistema_btn").length&&(d+="Encontrado #wf_ico_sistema_btn: "+$("#wf_ico_sistema_btn").length+" veces\nEncontrado .open-cesta-tumbl: "+$(".open-cesta-tumbl").length+" veces\n",$.post("/ajax.php?proceso=iconos_usr_btn",function(e){d+="Ejecutamos procesosajax >> iconos_usr_btn\n",$("#wf_ico_sistema_btn").html(e)})),$("#id_btn_acceso").length&&(r_ajax("/ajax.php","proceso=btn_acceso","#id_btn_acceso"),d+="Refrescamos botones de acceso.\n"),console.log(d),!1}function muestra_oculta(e){$(e).is(":hidden")?$(e).show("fast"):$(e).hide("slow")}function igualar_altura(){$(".igualar_altura").length&&($(".igualar_altura").length,$(".igualar_altura").imagesLoaded(function(){0;var e=$(".igualar_altura").map(function(){return $(this).height()}).get(),e=Math.max.apply(null,e);$(".igualar_altura").height(e)}))}function onuba_menu(){$(document.body).on("click touch",".om_ir",function(){menu_a_entrar=$(this).data("onuba_menu"),$('ul[data-onuba_menu="'+menu_a_entrar+'"]').removeClass("om_salir").addClass("om_entrar"),$(this).parents(":eq(1)").addClass("om_salir")})}function login_modo(e=1){let o="Inspeccionamos Modo de logado\n";0==(e=isNaN(e)?(o+="data-modo NO está presente\n",1):(o+="data-modo está presente: "+e+"\n",parseInt(e)))&&location.reload(),1==e&&(load_icon_usr(),"undefined"!=typeof modal_open_form_login&&modal_open_form_login.close(),o+="Cargamos sólo iconos y cerramos ventana de logado.\n"),2==e&&(load_icon_usr(),jQuery.each(BootstrapDialog.dialogs,function(e,o){o.close()}),o+="Cargamos sólo iconos y cerramos todas las ventanas.\n"),o+="Modo ejecutado: "+e+"\n",console.log(o)}function on_signin_google(e){e.credential&&(console.log("ON_SIGNIN_GOOGLE ha recibido una credencial."),e={credential:e.credential,id_cuota_elegida:1,recordar:$("#form_login_recordar").val()},$.ajax({cache:!1,type:"post",url:"/json.php?proceso=loginsystem_google",data:e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove();let o="Hemos recibido respuesta sobre logado con Google.\n";e.code<1?(o+="Mostramos error\n",swal.fire("",e.str,"error")):1==e.code&&(o+="Login correcto\n",e.str?(swal.fire("",e.str,"info"),o+="Mostramos texto Swal\n"):login_modo($(document.body).find("#form_login").data("modo"))),console.log("dentro: "+o)}}))}$.fn.modal.Constructor.prototype.enforceFocus=function(){$(document).off("focusin.bs.modal").on("focusin.bs.modal",$.proxy(function(e){this.$element[0]===e.target||this.$element.has(e.target).length||$(e.target).closest(".cke_dialog, .cke").length||this.$element.trigger("focus")},this))},"function"==typeof jQuery.fn.responsiveSlides&&($("#slider1").responsiveSlides({auto:!0,pager:!1,nav:!0,speed:500,timeout:9e3,namespace:"centered-btns",pause:!1,pauseControls:!0}),$(".r_slider").responsiveSlides({auto:!0,pager:!1,nav:!0,speed:500,timeout:9e3,namespace:"centered-btns",pause:!1,pauseControls:!0})),function(a){function t(e,o){(e="string"==typeof e?document.querySelectorAll(e):e).length===a&&(e=[e]),[].forEach.call(e,function(e){t[(o===a?!e.getAttribute("readonly"):o)?"activate":"deactivate"](e)})}t.activate=function(e){e.setAttribute("readonly",!0),e.setAttribute("disabled",!0),e.classList.add("readonly");var o=/checkbox|radio/i.test(e.type);o&&!e.checked||((o=document.createElement("input")).name=e.name,o.type="hidden",o.value=e.value,o.setAttribute("data-sham",e.name),e.parentNode.insertBefore(o,e.nextSibling))},t.deactivate=function(e){e.setAttribute("readonly",!1),e.setAttribute("disabled",!1),e.classList.remove("readonly");var o=e.parentNode.querySelector('[data-sham="'+e.name+'"]');o&&e.parentNode.removeChild(o)},this.readonly=t,this.jQuery!==a&&(this.jQuery.fn.readonly=function(e){return this.each(function(){t(this,e)})})}(this),function(){let r="",n;function i(){speechSynthesis.speaking&&speechSynthesis.cancel()}function s(e){e.classList.remove("fa-stop-circle","audio_activo"),e.classList.add("fa-microphone"),e.style.color="",e.setAttribute("title","Audio Ayuda")}document.addEventListener("DOMContentLoaded",()=>{document.body.addEventListener("click",async e=>{const o=e.target.closest(".audio_ayuda");if(o&&o.hasAttribute("data-texto")){e=o.getAttribute("data-texto");
73if(e&&"speechSynthesis"in window)if(speechSynthesis.speaking&&e===r)i(),s(o);else{i(),r=e,n=o,(a=o).classList.remove("fa-microphone"),a.classList.add("fa-stop-circle","audio_activo"),a.style.color="red",a.setAttribute("title","Haga clic para parar.");var a=await new Promise(e=>{let o=speechSynthesis.getVoices();if(o.length)return e(o);speechSynthesis.onvoiceschanged=()=>{(o=speechSynthesis.getVoices()).length&&e(o)},speechSynthesis.speak(new SpeechSynthesisUtterance(""))}),e=new SpeechSynthesisUtterance(e);e.lang="es-ES",e.rate=parseFloat(o.getAttribute("data-rate")||1),e.pitch=parseFloat(o.getAttribute("data-pitch")||1),e.volume=parseFloat(o.getAttribute("data-volume")||1);const t=o.getAttribute("data-voz");t&&(a=a.find(e=>e.name===t))&&(e.voice=a),e.onend=()=>{s(o),r="",n=null},speechSynthesis.speak(e)}}})})}(),function(){"use strict";const o="wf_modo_oscuro",r="a.wf_modo_oscuro",n="wf_modo_oscuro",a="function"==typeof window.matchMedia,i=a&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;let s=null;const t=()=>a&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",c=()=>{try{var e=localStorage.getItem(o);return null===e?null:"1"===e?1:0}catch(e){return null}},l="wf_theme_live",d=()=>{var e=document.getElementById(l);return e||((e=document.createElement("div")).id=l,e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="sr-only",document.body.appendChild(e)),e},u=(e,o={con_transicion:!1,anunciar:!1})=>{var a,t=document.documentElement,e=1===e;o.con_transicion&&!i&&(document.documentElement.classList.add("theme-transition"),s&&clearTimeout(s),s=setTimeout(()=>{document.documentElement.classList.remove("theme-transition")},400)),t.classList.toggle(n,e),t.style.colorScheme=e?"dark":"light",a=e,document.querySelectorAll(r).forEach(e=>{var o=e.querySelector("i.fa"),o=(o&&(o.className=a?"fa fa-sun-o fa-fw rem12":"fa fa-moon-o fa-fw rem12"),e.querySelector("span.d-none.d-sm-inline"));o&&(o.textContent=a?"Claro":"Oscuro"),e.setAttribute("title",a?"Cambiar a modo claro":"Cambiar a modo oscuro"),e.setAttribute("aria-label",a?"Cambiar a modo claro":"Cambiar a modo oscuro"),e.setAttribute("role","button"),e.setAttribute("aria-pressed",a?"true":"false"),e.hasAttribute("tabindex")||e.setAttribute("tabindex","0")}),o.anunciar&&(t=e,d().textContent=t?"Tema oscuro activado":"Tema claro activado")},p=()=>{var e=1==(document.documentElement.classList.contains(n)?1:0)?0:1;(e=>{try{localStorage.setItem(o,e?"1":"0")}catch(e){}})(e),u(e,{con_transicion:!0,anunciar:!0})};document.addEventListener("DOMContentLoaded",()=>{var e,o=c(),o=null!==o?o:"dark"===t()?1:0;u(o,{con_transicion:!1,anunciar:!1}),document.body.addEventListener("click",e=>{e.target.closest(r)&&(e.preventDefault(),p())}),document.body.addEventListener("keydown",e=>{!e.target.closest(r)||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),p())}),null===c()&&a&&(o=()=>{var e="dark"===t()?1:0;u(e,{con_transicion:!0,anunciar:!1})},(e=window.matchMedia("(prefers-color-scheme: dark)")).addEventListener?e.addEventListener("change",o):e.addListener(o))})}(),document.addEventListener("click",function(o){var a=o.target.closest(".abrir_ventana_wf");if(a){o.preventDefault();var o=e=>null!=e&&("1"===(e=String(e).trim().toLowerCase())||"true"===e||"yes"===e),t=(a.dataset.id||"").trim(),r=o(a.dataset.eliminar),n=(a.dataset.contenido_b64||"").trim(),i=(a.dataset.clase_ancho||"").trim(),s=(a.dataset.titulo_ventana||"").trim(),o=o(a.dataset.pintar_cabecera),c=(a.dataset.style_contenedor_principal||"").trim(),l=(a.dataset.url||"").trim(),d=parseInt(a.getAttribute("data-id_artilugio")||"0",10)||0;let e=(a.dataset.params||"").trim();const u=["eliminar","contenido_b64","clase_ancho","titulo_ventana","pintar_cabecera","style_contenedor_principal","url","params","id_artilugio"];a=Object.entries(a.dataset).filter(([e,o])=>!u.includes(e)&&null!=o&&""!==String(o).trim()).map(([e,o])=>encodeURIComponent(e)+"="+encodeURIComponent(String(o).trim())).join("&"),a=(""!==a&&(e=""!==e?e+"&"+a:a),""!==l&&""!==e?""+l+(l.includes("?")?"&":"?")+e:l);ventana_wf(t?"#"+t:"",r,n,i,s,o,c,e,d,a)}}),document.addEventListener("DOMContentLoaded",()=>{new wf_abrir_imagen}),document.addEventListener("DOMContentLoaded",()=>{window.wfScrollAnim=new wf_scrollanim({autoReset:!0,debug:!1})}),document.addEventListener("DOMContentLoaded",()=>{new wf_audio({selector_boton:".wf_audio_play",debug:!0})}),document.addEventListener("DOMContentLoaded",function(){document.body.addEventListener("click",function(e){e.target&&e.target.closest(".cerrar_ventana_wf")&&(e.preventDefault(),e=e.target.closest("div.ventana_wf"))&&("1"===(e.dataset.eliminar_al_cerrar??"0")?(e.remove(),document.querySelector(".ventana_wf.visible")||(document.body.style.overflow=""),set_modal_alto("100%")):e.id&&e.classList.contains("visible")?ventana_wf("#"+e.id):(e.classList.remove("visible"),document.querySelector(".ventana_wf.visible")||(document.body.style.overflow="")))}),document.addEventListener("mousedown",e=>{const o=e.target.closest(".cabecera > span.text-monospace");if(o){const n=o.closest(".contenedor_principal");if(n){let a=e.clientX-n.offsetLeft,t=e.clientY-n.offsetTop,r=!0;o.style.cursor="grabbing";const i=e=>{var o;r&&(o=e.clientX-a,e=e.clientY-t,n.style.left=o+"px",n.style.top=e+"px",n.style.transform="none")},s=()=>{r=!1,o.style.cursor="grab",document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",s)}}})}),document.addEventListener("DOMContentLoaded",function(){const c="/enrutador.php?proceso=",l="usuarios_perfil";document.body.addEventListener("click",async function(e){if(e.target&&e.target.closest(`.${l}_panel_perfil_html`)){e.preventDefault(),mostrar_espera();var t=l+"_panel_perfil_html",e=e.target.closest("."+t),r=t;let o=parseInt(e.dataset.d??"1"),a=(delete e.dataset.d,datas(e.dataset));e=c+t+a,t=(console.log("hola usuario"),crear_callback());t.add(e=>{pintar_tabla_json(c+l+"_pds_tabla_json",`#${l}_pds_tabla_json`,o,0,a,1e3,40,"50px",{barra_de_paginacion:!1}),pintar_tabla_json(c+l+"_obras_tabla_json",`#${l}_obras_tabla_json`,o,0,a,1e3,40,"50px",{barra_de_paginacion:!1})});
73try{var n=await fetch(e,{method:"POST",cache:"no-cache"});if(!n.ok)throw new Error("Error respuesta servidor: "+e);var i,s=await n.json();eliminar_espera(),1===s.code?((i=document.querySelector(r))?i.innerHTML=s.html:(document.body.insertAdjacentHTML("beforeend",s.html),ventana_wf("#"+r)),t.fire(s.id)):swal.fire("¡Error!",s.str,"error"),console.log(s.d)}catch(e){eliminar_espera(),swal.fire("¡Error!","Se ha producido un error.","error"),console.error("Error:",e)}}})}),document.addEventListener("DOMContentLoaded",function(){const c="/enrutador.php?proceso=",l="archivos";document.body.addEventListener("click",function(e){if(e.target&&e.target.closest(`.${l}_panel`)){e.preventDefault(),mostrar_espera();var n=l+"_panel",i=e.target.closest("."+n);let a=n,o=parseInt(i.dataset.d??"1");i={...i.dataset};delete i.d;let t=datas(i),r=c+n+t;var s=crear_callback();s.add(e=>{pintar_tabla_json(c+l+"_tabla_json","#t_"+l,o,0,t)}),fetch(r,{method:"POST",cache:"no-cache"}).then(e=>{if(e.ok)return e.json();throw new Error("Error al ir a buscar: "+r)}).then(e=>{var o;eliminar_espera(),1===e.code?((o=document.querySelector(a))?o.innerHTML=e.html:(document.body.insertAdjacentHTML("beforeend",e.html),ventana_wf("#"+a)),s.fire(e.id)):swal.fire("¡Error!",e.str,"error"),console.log(e.d)}).catch(e=>{eliminar_espera(),swal.fire("¡Error!","Se ha producido un error.","error"),console.error("Error:",e)})}if(e.target&&e.target.closest(`.${l}_load`)){e.preventDefault(),mostrar_espera();let t=l+"_load";i=e.target.closest("."+t);let r=parseInt(i.dataset.id),o=c+t+datas(i.dataset);fetch(o,{method:"POST",cache:"no-cache"}).then(e=>{if(e.ok)return e.json();throw new Error("Error al ir a buscar: "+o)}).then(e=>{var o,a;eliminar_espera(),1===e.code?((a=document.querySelector("#"+t))?((o=document.createElement("div")).innerHTML=e.html,(o=o.querySelector("div.contenedor_principal"))&&(a=a.querySelector("div.contenedor_principal"))&&(a.innerHTML=o.innerHTML)):(document.body.insertAdjacentHTML("beforeend",e.html),ventana_wf("#"+t)),r):swal.fire("¡Error!",e.str,"error"),console.log(e.d)}).catch(e=>{eliminar_espera(),swal.fire("¡Error!","Se ha producido un error.","error"),console.error("Error:",e)})}if(e.target&&e.target.closest(`.${l}_load_lote`)){e.preventDefault(),mostrar_espera();let t=l+"_load_lote";n=e.target.closest("."+t);let o=c+t+datas(n.dataset);const r={...n.dataset};delete r.d;fetch(o,{method:"POST",cache:"no-cache"}).then(e=>{if(e.ok)return e.json();throw new Error("Error al ir a buscar: "+o)}).then(e=>{var o,a;eliminar_espera(),1===e.code?((a=document.querySelector("#"+t))?((o=document.createElement("div")).innerHTML=e.html,(o=o.querySelector("div.contenedor_principal"))&&(a=a.querySelector("div.contenedor_principal"))&&(a.innerHTML=o.innerHTML)):(document.body.insertAdjacentHTML("beforeend",e.html),ventana_wf("#"+t)),archivos_crear_uploader({selector:"#"+t,url_subida:"/enrutador.php?proceso=archivos_save_lote",url_pintar:"/enrutador.php?proceso=archivos_pintar",url_borrar:"/enrutador.php?proceso=archivos_del&id=",extra:r})):swal.fire("¡Error!",e.str,"error"),console.log(e.d)}).catch(e=>{eliminar_espera(),swal.fire("¡Error!","Se ha producido un error.","error"),console.error("Error:",e)})}if(e.target&&e.target.closest(`.${l}_del`)){e.preventDefault(),mostrar_espera();i=l+"_del",n=e.target.closest("."+i);let o=datas(n.dataset),a=c+i+o;n.dataset.id_padre;e=obtener_ids_seleccionados("t_"+l);let t=new URLSearchParams;e.forEach(e=>{t.append("ids[]",e)}),console.log("IDs seleccionados:",e.join(","));fetch(a,{method:"POST",cache:"no-cache",body:t}).then(e=>{if(e.ok)return e.json();throw new Error("Error al ir a buscar: "+a)}).then(e=>{eliminar_espera(),1===e.code?(swal_toast.fire({text:e.str}),pintar_tabla_json(c+l+"_tabla_json","#t_"+l,-1,0,o)):swal.fire("¡Error!",e.str,"error"),console.log(e.d)}).catch(e=>{eliminar_espera(),swal.fire("¡Error!","Se ha producido un error.","error"),console.error("Error:",e)})}}),document.body.addEventListener("submit",function(e){if(e.target&&e.target.getAttribute("id")===l+"_form"){e.preventDefault();l;var t=e.target.closest(`#${l}_form`);let o=parseInt(t.querySelector("input[name='id']").value)||0;l;c;let a=crear_callback();a.add(function(e){actualizar_tablas_tabulator("#t_"+l)});t=new FormData(e.target);mostrar_espera(),fetch("/enrutador.php?proceso=archivos_save",{method:"POST",body:t,cache:"no-cache"}).then(e=>{if(e.ok)return e.json();throw new Error("Error en la respuesta del servidor")}).then(e=>{eliminar_espera(),1==e.code?(swal_toast.fire({text:e.str}),a.fire(o),lanzar_y_borrar("archivos_load","id",e.id)):swal.fire("",e.str,"error"),console.log(e.d)}).catch(e=>{eliminar_espera(),swal.fire("¡Error!","Se ha producido un error.","error"),console.error("Error:",e)})}})}),document.addEventListener("DOMContentLoaded",()=>{let _=null,h=null,g=null,b="";function v(){_&&_.remove(),g&&g.remove(),g=null,_=null,h=null}document.addEventListener("click",function(e){b="";var o,a,t,r,n,i,s,c,l,d,u,p,f,m=e.target.closest(".dropdown-toggle");m&&m.closest(".barra_negra_30")?(e.preventDefault(),o=m.id,_&&h===o?v():(v(),(a=document.querySelector(`.dropdown-menu[aria-labelledby="${o}"]`))&&((a=a.cloneNode(!0)).classList.remove("d-none"),a.classList.add("submenu_flotante"),a.style.position="absolute",a.style.zIndex="10001",a.style.display="block",a.style.visibility="hidden",(m.closest(".ventana_wf.visible .contenido")||m.closest(".modal-body")||document.body).appendChild(a),s=m.closest(".modal-body"),r=(t=(c=(c=m.closest(".ventana_wf.visible"))?c.querySelector(".contenido"):null)||s||window)===window?{top:0,left:0,width:window.innerWidth,height:window.innerHeight}:t.getBoundingClientRect(),m=m.getBoundingClientRect(),n=t===window?window.innerWidth:t.clientWidth,d=t===window?window.scrollX:t.scrollLeft,i=t===window?window.scrollY:t.scrollTop,s=s?25:0,c=c?6:0,l=m.bottom+i+6,d=t===window?m.left+d:m.left-r.left+d,u=a.getBoundingClientRect(),f=(u=Math.max(u.width,200))+16<=n,p=d,p=Math.max(8,Math.min(d,n-u-8)),f=!f||p<8&&n-8<p+u,b=(b=(b=(b=(b=(b=(b=(b=b+` 74=== DEBUG SUBMENU ===`+` 75trigger id: `+o)+` 76scrollEl: `+(t===window?"window":t.className))+` 77rectTrig.bottom: `+m.bottom)+` 78rectScroll.top: `+r.top+` 79scrollY: `+i)+` 80extraOffset: `+s+` 81wfOffset: `+c)+` 82TOP FINAL: `+l+` 83LEFT BASE: `+d)+` 84LEFT FINAL: `+p+` 85menuW: `+u)+` 86viewportW: `+n+` 87activarOverlay: `+f,f?(g||((g=document.createElement("div")).className="submenu_backdrop",g.addEventListener("click",v),document.body.appendChild(g)),a.classList.add("overlay"),a.style.top=Math.max(16,Math.round(.15*window.innerHeight))+i+"px",a.style.left="50%",a.style.transform="translateX(-50%)",a.style.maxWidth="min(92vw, 520px)",a.style.width="auto"):(p=Math.max(8,Math.min(p,n-u-8)),a.style.top=l+"px",a.style.left=p+"px"),a.style.visibility="visible",_=a,h=o,b&&console.log(b),console.log("[submenu_flotante] â Activado para #"+o+(f?" (overlay)":"")))
87)):_&&!e.target.closest(".submenu_flotante")&&v()}),document.addEventListener("keydown",e=>{"Escape"===e.key&&v()})}),document.addEventListener("DOMContentLoaded",function(){const t="/enrutador.php?proceso=",r="huella",o=new wf_abmc(r,t);document.body.addEventListener("click",function(e){e.target.closest(`.${r}_panel`)?o.abrir_ventana(e,r+"_panel",(e,o,a)=>{pintar_tabla_json(t+r+"_tabla_json",`#${r}_tabla_json`,a,0,o)}):e.target.closest(`.${r}_load`)?o.abrir_ventana(e):e.target.closest(`.${r}_filtro`)?o.abrir_ventana(e,r+"_filtro"):e.target.closest(`.${r}_del`)&&o.ejecutar_metodo(e,"",(e,o)=>{actualizar_tablas_tabulator(`#${r}_tabla_json`)})})}),document.addEventListener("DOMContentLoaded",()=>{document.addEventListener("click",async e=>{var r=e.target.closest(".abrir_subpagina");if(r){e.preventDefault(),console.groupCollapsed("ð¦ abrir_subpagina"),console.log("1. Click detectado"),console.log("2. Botón:",r),console.log("3. dataset botón:",r.dataset);let o="",a=null,t=null;try{var n=datas(r.dataset);if(console.log("4. datas(boton.dataset):",n),mostrar_espera(),console.log("5. mostrar_espera() ejecutado"),o="/ajax.php?proceso=abrir_subpagina"+n,console.log("6. URL final:",o),a=await fetch(o,{method:"GET",cache:"no-store",headers:{"X-Requested-With":"XMLHttpRequest"}}),console.log("7. response:",a),console.log("8. response.ok:",a.ok),console.log("9. response.status:",a.status),console.log("10. response.headers content-type:",a.headers.get("content-type")),!a.ok)throw new Error("HTTP "+a.status);var i,s,c,l,d,u=await a.text();console.log("11. Respuesta cruda:",u),t=JSON.parse(u),console.log("12. JSON parseado:",t),eliminar_espera(),console.log("13. eliminar_espera() ejecutado"),0===parseInt(t.code)?(console.warn("14. data.code == 0"),swal.fire("",t.str,"error"),console.groupEnd()):(void 0!==t.html&&t.html.trim()?(console.log("16. data.html existe"),console.log("17. data.html length:",t.html.length),(i=document.createElement("template")).innerHTML=t.html.trim(),s=i.content.firstElementChild,console.log("18. ventana_recibida:",s),s?(c=s.id||"wf_abrir_subpagina",console.log("20. id_ventana detectado:",c),l=document.getElementById(c),console.log("21. ventana_existente antes de borrar:",l),l&&(console.log("22. Eliminando ventana previa"),l.remove()),document.body.appendChild(s),console.log("23. Ventana insertada en body"),s.classList.add("visible"),document.body.style.overflow="hidden",console.log("24. classList final ventana:",s.className),console.log("25. outerHTML ventana final:",s.outerHTML),d=s.querySelector(".contenido"),console.log("26. .contenido encontrado:",d),console.log("27. .contenido innerHTML length:",d?d.innerHTML.length:0)):(console.error("19. No se pudo convertir data.html en nodo DOM"),swal.fire("","Error al construir la ventana","error"))):(console.warn("15. data.html no existe o viene vacÃo"),swal.fire("","Error","error")),console.groupEnd())}catch(e){console.error("â Error en abrir_subpagina"),console.error(e),console.log("URL usada en error:",o),console.log("Response en error:",a),console.log("Data en error:",t),eliminar_espera(),swal.fire("¡Error!","Se ha producido un error.","error"),console.groupEnd()}}})}),$(document).ajaxComplete(function(){console.log("ajaxComplete"),$(".abrir_siguiente").each(function(){var e,o;"0"===$(this).attr("data-ajax")||$(this).attr("data-noocultar")||(e=$(this).attr("data-class"),o=$(this).attr("data-id"),(e?$("."+e):o?$("#"+o):$(this).next()).css("display","none"))}),"function"==typeof jQuery.fn.tilt&&$(".efecto_tilt").length&&($(".efecto_tilt").tilt({disableAxis:"x"}),console.log("Iniciado Tilt despues de Ajax.")),"function"==typeof jQuery.fn.webuiPopover&&$(".webuipopover").length&&$(".webuipopover").webuiPopover(),igualar_altura()}),$(document).ready(function(){$(document.body).on("click","input[name*=_estoy_seguro]",function(e){$(this).is(":checked")?($(this).closest("div.estoy_seguro").find("button").attr("disabled",!1),console.log("Estoy seguro está chequeado, ponemos enable")):($(this).closest("div.estoy_seguro").find("button").attr("disabled",!0),console.log("Estoy seguro NO está chequeado, ponemos disable"))}),$(document.body).on("click",".abrir_tablajson",function(){var e=datas($(this).data()),o=$(this).data("url"),a=2,r="",n=($(this).data("tamano")&&(a=$(this).data("tamano")),$(this).data("cabecera")&&parseInt($(this).data("cabecera")),$(this).data("pie")&&parseInt($(this).data("pie")),$(this).data("titulo")&&(r=$(this).data("titulo")),$.Callbacks("once"));n.add(function(){pintar_tabla_json(o,"#tabla_abrir_tablajson",1,0,e)}),$.ajax({cache:!1,timeout:6e5,type:"POST",url:o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),t=4==a?"size-extrawide":3==a?"size-wide":5==a?"size-large":2==a?"size-normal":1==a?"size-small":"BootstrapDialog.SIZE_WIDE","undefined"!=typeof modal_abrir_tablajson&&modal_abrir_tablajson.close(),modal_abrir_tablajson=BootstrapDialog.show({title:r,autodestroy:!0,draggable:!0,closable:!0,closeByBackdrop:!1,size:t,message:$('<table id="tabla_abrir_tablajson"></table>'),onshown:function(){n.fire()},tabindex:!1}
87)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".ver_agencia",function(){var e=0;$(this).data("id")&&(e=$(this).data("id")),$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php?proceso=ver_datos_agencia&id="+e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_ver_agencia&&modal_ver_agencia.close(),modal_ver_agencia=BootstrapDialog.show({title:"Agencia",draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").append(e),tabindex:!1,buttons:[{label:"<?=cn_cerrar?>",action:function(e){e.close()},cssClass:"btn-secondary"}]})},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".borrar_mi_perfil_usuario",function(){var e=-1;$(this).data("id")&&(e=$(this).data("id")),$.ajax({cache:!1,timeout:6e5,type:"POST",url:"/ajax.php?proceso=borrar_mi_perfil_usuario&id="+e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),0==e.code?swal.fire("",e.str,"error"):1==e.code&&swal.fire("",e.str,"success")},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit","form#modif_mi_perfil_usuario",function(e){e.preventDefault();$.ajax({cache:!1,type:"POST",url:"/ajax.php?proceso=modif_mi_perfil_usuario",data:$(this).serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),1==e.code?(swal_toast.fire({text:e.str}),callbacks.fire(id)):swal.fire("",e.str,"error")},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".usuarios_perfil_cargar_deseos",function(){var e=parseInt($(this).data("id")),o=$.Callbacks("once");o.add(function(e){}),"undefined"!=typeof modal_usuarios_perfil_cargar_deseos&&modal_usuarios_perfil_cargar_deseos.close(),(modal_usuarios_perfil_cargar_deseos=BootstrapDialog.show({title:"Mis deseos",draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_WIDE,message:$('<div id="dr_usuarios_perfil_cargar_deseos"></div>').load("ajax_ec.php?proceso=ec_resultados_index&subproceso=cargar_deseos"),onshow:function(){$("body").append('<div class="espera"></div>')},onshown:function(){o.fire(e),$(".espera").remove()},tabindex:!1})).open()}),$(document.body).on("click",".usuarios_perfil_cargar_encuestas",function(){var e=parseInt($(this).data("id")),o=$.Callbacks("once");o.add(function(e){}),"undefined"!=typeof modal_usuarios_perfil_cargar_encuestas&&modal_usuarios_perfil_cargar_encuestas.close(),(modal_usuarios_perfil_cargar_encuestas=BootstrapDialog.show({title:"Encuestas",draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_EXTRAWIDE,message:$('<div id="dr_usuarios_perfil_cargar_encuestas"></div>').load("ajax.php?proceso=cargar_encuestas_perfil"),onshow:function(){$("body").append('<div class="espera"></div>')},onshown:function(){o.fire(e),$(".espera").remove()},tabindex:!1})).open()}),$(document.body).on("click",".usuarios_perfil_cargar_notify",function(){var e=parseInt($(this).data("id")),o="ajax.php?proceso=cargar_notify_perfil&id="+e,a=$.Callbacks("once");a.add(function(e){}),"undefined"!=typeof modal_usuarios_perfil_cargar_notify&&modal_usuarios_perfil_cargar_notify.close(),(modal_usuarios_perfil_cargar_notify=BootstrapDialog.show({title:"Notificaciones",draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_WIDE,message:$('<div id="dr_usuarios_perfil_cargar_notify"></div>').load(o),onshow:function(){$("body").append('<div class="espera"></div>')},onshown:function(){a.fire(e),$(".espera").remove()},tabindex:!1})).open()}),$(document.body).on("click",".usuarios_perfil_docs",function(){var o=$(this).data("id"),e="/enrutador.php?proceso=usuarios_perfil_docs"+datas($(this).data()),a="dr_usuarios_perfil_docs",t=$.Callbacks("once");t.add(function(e){pintar_tabla_json("/json.php?proceso=tab_ec_pedidos_usr","#usuarios_perfil_docs_t",1,0,"&iduser="+e)}),$.ajax({cache:!1,timeout:6e5,type:"POST",url:e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"==typeof usuarios_perfil_docs?usuarios_perfil_docs=BootstrapDialog.show({title:"Sus documentos",autodestroy:!1,draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_EXTRAWIDE,message:$('<div id="'+a+'"></div>').append(e.html),onshown:function(){t.fire(o)},tabindex:!1}
87):(usuarios_perfil_docs.open(),$("#"+a).html(e.html),t.fire(o))},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click","#dr_usuarios_perfil_docs button[data-doc]",function(){var e=$(this).data("doc"),o=$(this).closest("div.container-fluid").data("id");$("#usuarios_perfil_docs").empty(),"pe"==e?pintar_tabla_json("/json.php?proceso=tab_ec_pedidos_usr","#usuarios_perfil_docs_t",1,0,"&iduser="+o):pintar_tabla_json("/json.php?proceso=tab_docs_usr","#usuarios_perfil_docs_t",1,0,"&doc="+e+"&iduser="+o)}),$(document.body).on("click","#dr_usuarios_perfil_docs .load_pedido_usuarios_perfil",function(){var o=-1;$(this).data("id")&&(o=$(this).data("id")),$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php?proceso=ec_perfil_pedido&id="+o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_pedido&&modal_pedido.close(),modal_pedido=BootstrapDialog.show({title:"Su pedido",draggable:!0,closable:!0,size:BootstrapDialog.SIZE_EXTRAWIDE,message:$('<div id="div_modal_pedido"></div>').append(e),onshown:function(e){pintar_tabla_json("/json.php?proceso=tab_ec_pedido_usr","#tabla_pedido_usr",1,0,"&id="+o),pintar_tabla_json("/f/json.php?proceso=t_doc_envios","#tabla_envios_pedido_usr",2,0,"&id="+o+"&doc=pe"),pintar_tabla_json("/enrutador.php?proceso=pagos_tabla_json","#tabla_pagos_pedido_usr",2,0,"&modulo=1&&id_registro="+o)},tabindex:!1,buttons:[{label:"<?=cn_cerrar?>",action:function(e){e.close()},cssClass:"btn-secondary"}]})},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".btn_add_datfac, .btn_mod_datfac",function(){var e=$
87(this).data("id"),o=datas($(this).data());$.ajax({cache:!1,timeout:6e5,type:"POST",url:"/ajax_ec.php?proceso=load_form_dat_factu&id_usr="+e+o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_datfac&&modal_datfac.close(),(modal_datfac=BootstrapDialog.show({title:"Mis datos",draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_WIDE,message:$("<div></div>").append(e),tabindex:!1})).getModalFooter().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit","#form_ec_datos_factu",function(e){e.preventDefault(),$.ajax({cache:!1,type:"POST",url:"/ajax_ec.php?proceso=save_usr_df",data:$(this).serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),0==e.code?swal.fire("",e.str,"error"):1==e.code&&(swal_toast.fire({text:e.str}),modal_datfac.close(),$.post("ec_cesta_ajax.php?cestanav=3",function(e){$("#contenido_cesta").html(e),$("#tabla_cesta").length&&r_ajax("/ajax_ec.php","proceso=pintar_tabla_cesta","#tabla_cesta")}))},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".load_direcciones_usuarios",function(){var o=parseInt($(this).data("id")),e="/a/usuarios_ajax.php?proceso=load_direcciones_usuarios"+datas($(this).data()),a="dr_load_direcciones_usuarios",t="Usuario "+o,r=$.Callbacks("once");r.add(function(e){}),$.ajax({cache:!1,timeout:6e5,type:"POST",url:e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"==typeof modal_direcciones_usuarios?modal_direcciones_usuarios=BootstrapDialog.show({title:t,autodestroy:!1,draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_WIDE,message:$('<div id="'+a+'"></div>').append(e),onshown:function(){r.fire(o)},tabindex:!1}):(modal_direcciones_usuarios.open(),$("#"+a).html(e),r.fire(o))},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit","#form_direcciones_usuarios",function(e){e.preventDefault();parseInt($(this).find("input[name='id']").val());var o="load_direcciones_usuarios",a=$.Callbacks("once");a.add(function(e){$("#t_direcciones_usuarios").length&&pintar_tabla_json("/a/usuarios_ajax.php?proceso=tabla_direcciones_usuarios&id="+e,"#t_direcciones_usuarios",1,0,""),$("#contenido_cesta").length&&$.post("ec_cesta_ajax.php?cestanav=3",function(e){$("#contenido_cesta").html(e)}),$("#tabla_cesta").length&&r_ajax("/ajax_ec.php","proceso=pintar_tabla_cesta","#tabla_cesta")}),$.ajax({cache:!1,type:"POST",url:"/a/usuarios_ajax.php?proceso=save_direcciones_usuarios",data:$(this).serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),1==e.code?(swal_toast.fire({text:e.str}),a.fire(e.id),$(document.body).append('<cite class="d-none '+o+'" data-id_direcciones="'+e.id_direcciones+'"></cite>').find("cite."+o+'[data-id_direcciones="'+e.id_direcciones+'"]').trigger("click").remove()):swal.fire("",e.str,"error"),console.log(e.d)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".del_direcciones_usuarios",function(e){e.preventDefault();var o=datas($(this).data());$.get("/a/usuarios_ajax.php?proceso=del_direcciones_usuarios"+o,function(e){0==e.code?swal.fire("",e.str,"error"):1==e.code&&(swal_toast.fire({text:e.str}),$("#t_direcciones_usuarios").length&&pintar_tabla_json("/a/usuarios_ajax.php?proceso=tabla_direcciones_usuarios"+o,"#t_direcciones_usuarios",1,0,""),$("#contenido_cesta").length&&$.post("ec_cesta_ajax.php?cestanav=3",function(e){$("#contenido_cesta").html(e)}
87),$("#tabla_cesta").length)&&r_ajax("/ajax_ec.php","proceso=pintar_tabla_cesta","#tabla_cesta")})}),$(document.body).on("submit","#form_alta_perfil",function(e){e.preventDefault(),recargar=parseInt($(this).data("recargar")),$.ajax({cache:!1,type:"POST",url:"/ajax.php?proceso=alta_perfil"+datas($(this).data()),data:$(this).serialize(),dataType:"json",beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),void 0!==e[0].url?(window.location.href=e[0].url,console.log("Alta perfil tramitada, reenvÃo por url.")):void 0!==e[0].error?(swal.fire("¡Error!",e[0].error,"error"),console.log("Producido error en alta.")):void 0!==e[0].ok?("undefined"!=typeof modal_open_form_alta_perfil&&modal_open_form_alta_perfil.close(),swal.fire("¡Listo!",e[0].ok,"success"),console.log("Alta perfil correcta, sin redirección."),0==recargar?(load_icon_usr(),console.log("Cargamos iconos de sesión.")):(location.reload(),console.log("Recargamos página."))):console.log("Respuesta no identificada.")}})}),$(document.body).on("click",".open_form_alta_perfil",function(e){e.preventDefault();var e=$(this).attr("data-id"),o=$(this).attr("data-modo");return"undefined"!=typeof modal_open_form_alta_perfil&&modal_open_form_alta_perfil.close(),(modal_open_form_alta_perfil=new BootstrapDialog({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_WIDE,message:$("<div></div>").load("/ajax.php?proceso=form_alta_perfil&byadmin=0&follow="+e+"&modo="+o)})).realize(),modal_open_form_alta_perfil.getModalHeader().hide(),modal_open_form_alta_perfil.open(),!1}),$(document.body).on("click",".mostrar_contrasena",function(){0<$(this).siblings('input[type="password"]').length?$(this).siblings('input[type="password"]').attr("type","text"):$(this).siblings('input[type="text"]').attr("type","password"),console.log("Mostrar Contraseña.")}),$(document.body).on("click",".wf_filtro span",function(){d="Se ha hecho click en un filtro wf_filtro span.\n",filtro=$(this).data("filtro"),d+="Se ta tomado el filtro '"+filtro+"'.\n",destino=$(this).closest(".wf_filtro").data("destino"),null!=filtro?(d=(d=(d+="Filtrando por '"+filtro+"' y ocultando el resto.\n")+destino+" > [data-tipo='"+filtro+"']\n")+destino+" >:not([data-tipo='"+filtro+"'])\n",$(destino+" > [data-tipo='"+filtro+"']").show("fast"),$(destino+" >:not([data-tipo='"+filtro+"'])").hide("fast")):(d+="Mostrando todo.\n",$(destino+" > *").show("fast")),d+="Fin proceso.\n",console.log(d)}),"function"==typeof jQuery.fn.masonry&&$(".mamposteria").length&&((e=$(".mamposteria").masonry()).imagesLoaded().progress(function(){e.masonry()}),console.log("Mansory Aplicado: "+$(".mamposteria").length)),"function"==typeof jQuery.fn.tilt&&$(".efecto_tilt").length&&($(".efecto_tilt").tilt({disableAxis:"x"}),console.log("Iniciado Tilt.")),$(".abrir_siguiente").each(function(e){var o=$(this),a=o.attr("data-noocultar"),t=o.attr("data-class"),r=o.attr("data-id");console.groupCollapsed(`abrir_siguiente [${e}
87]`),console.log("Elemento:",this),console.log("data-noocultar:",a),console.log("data-class:",t),console.log("data-id:",r),a?console.log("No ocultamos por data-noocultar"):t?(e="."+t,$(e).css("display","none"),console.log("Ocultamos clase: "+e),console.log("Coincidencias:",$(e).length)):r?(a="#"+r,$(a).css("display","none"),console.log("Ocultamos id: "+a),console.log("Coincidencias:",$(a).length)):((t=o.next()).css("display","none"),console.log("Ocultamos siguiente"),console.log("Siguiente encontrado:",t.length),console.log("Nodo siguiente:",t.get(0))),console.groupEnd()}),$(document.body).on("click",".abrir_siguiente",function(){($(this).attr("data-class")?(data_class="."+$(this).attr("data-class"),$(data_class)):$(this).attr("data-id")?(data_id="#"+$(this).attr("data-id"),$(data_id)):$(this).next()).toggle("slow")}),igualar_altura(),onuba_menu(),$(document.body).on("click",".ec_avisame_cll",function(e){e.preventDefault();var o=$(this).data("idart");$.ajax({cache:!1,timeout:6e5,type:"GET",url:"/ajax_ec.php?proceso=avisame_cuando_llegue&id="+o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),1==e.code?swal.fire("",e.str,"success"):2==e.code?(async()=>{var e=(await Swal.fire({title:"Escriba su email",text:"Le avisaremos cuando esté disponible:",input:"email",inputPlaceholder:"Escribe aquà tu email"})).value;e&&$.ajax({cache:!1,type:"GET",url:"/ajax_ec.php?proceso=avisame_cuando_llegue&id="+o+"&email="+e,data:$(this).serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),0==e.code||2==e.code?swal.showInputError(e.str):1==e.code&&swal.fire("",e.str,"success")},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})})():0==e.code&&swal.fire("",e.str,"error")},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit",".send_contact_form",function(e){e.preventDefault(),$.ajax({cache:!1,type:"POST",url:"/json.php?proceso=send_contact_form",data:$(this).serialize(),timeout:6e5,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),e.code<1?swal.fire("",e.str,"error"):swal.fire("",e.str,"success")},error:function(e){$(".espera").remove(),swal.fire("","Se ha producido un error.","error")}})}),$(document.body).on("submit",".form_art_7",function(e){e.preventDefault();var e=$(this).data("id"),o=$(this)[0],o=new FormData(o);$(this).prop("disabled",!0),$.ajax({type:"POST",enctype:"multipart/form-data",data:o,processData:!1,contentType:!1,cache:!1,timeout:6e5,url:"/json.php?proceso=procesar_form_art_7&id="+e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),e.code<1?swal.fire("",e.str,"error"):1==e.code?swal.fire("",e.str,"success"):2==e.code&&(window.location.href=e.str)},error:function(e){$(".espera").remove(),swal.fire("","Se ha producido un error.","error")}})}),0==$(".cd-top").length&&$("body").append("<div class='cd-top'><i class='fa fa-chevron-circle-up faa-float animated rem25' aria-hidden='true'></i></div>");var e,o=$(".cd-top i.fa-chevron-up");$(window).scroll(function(){300<$(this).scrollTop()?o.parent().addClass("cd-is-visible"):o.parent().removeClass("cd-is-visible cd-fade-out"),1200<$(this).scrollTop()&&o.addClass("cd-fade-out")}),o.on("click",function(e){e.preventDefault(),$("body,html").animate({scrollTop:0},700)}),"function"==typeof jQuery.fn.easyResponsiveTabs&&($("#tabsjquery1").length||$("#tabsjquery2").length)&&$("#tabsjquery1, #tabsjquery2").easyResponsiveTabs({type:"default",width:"auto",fit:!0,closed:"accordion",tabidentify:"tabsjquery",activate:function(e){}}),"function"==typeof jQuery.fn.jsSocials&&$("#shareadaptive").length&&$.getJSON("/json.php?proceso=jssocials").done(function(e){$("#shareadaptive").jsSocials({shares:e.shares,showLabel:e.showlabel,showCount:e.showcount,shareIn:e.sharein})}),"function"==typeof jQuery.fn.webuiPopover&&$(".webuipopover").length&&$(".webuipopover").webuiPopover(),"function"==typeof jQuery.fn.zoomer&&$(".div_zoomer").length&&$(".div_zoomer").zoomer(),"function"==typeof jQuery.fn.boxer&&$(".boxer").length&&$(".boxer").boxer({mobile:!0}),"function"==typeof jQuery.fn.eventCalendar&&$("#calendariojson").length&&$("#calendariojson").eventCalendar({eventsjson:"/json.php?proceso=calendariojson",jsonDateFormat:"human",cacheJson:!1,monthNames:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],dayNames:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sabado"],dayNamesShort:["Dom","Lun","Mar","Mie","Jue","Vie","Sab"],txt_noEvents:"No hay eventos para este periodo",txt_SpecificEvents_prev:"",txt_SpecificEvents_after:"eventos:",txt_next:"siguiente",txt_prev:"anterior",txt_NextEvents:"Próximos eventos:",txt_GoToEventUrl:"Ir al evento"}),"function"==typeof jQuery.fn.owlCarousel&&$(".sld-owl").length&&$(".sld-owl").owlCarousel({items:4,margin:10,loop:!1,rewind:!0,autoplay:!0,autoplayTimeout:3e3,autoplayHoverPause:!0,dotsEach:!0,responsive:{0:{items:1},576:{items:2},992:{items:3},1200:{items:4}}}),"function"==typeof jQuery.fn.owlCarousel&&$(".sld-owl-big").length&&$(".sld-owl-big").owlCarousel({items:3,margin:10,loop:!1,rewind:!0,autoplay:!0,autoplayTimeout:3e3,autoplayHoverPause:!0,dotsEach:!0,responsive:{0:{items:1},576:{items:3},1200:{items:4}}}),"function"==typeof jQuery.fn.owlCarousel&&$(".sld-owl-default").length&&$(".sld-owl-default").owlCarousel(),"function"==typeof jQuery.fn.flexNav&&$(".flexnav").length&&$(".flexnav").flexNav({buttonSelector:".menu-button"}),"function"==typeof jQuery.fn.flexNav&&$(".fn_barra_arriba").length&&$(".fn_barra_arriba").flexNav({buttonSelector:".mb_barra_arriba"}),"function"==typeof jQuery.fn.flexNav&&$(".fn2").length&&$(".fn2").flexNav({buttonSelector:".mb2"}),"function"==typeof jQuery.fn.flexNav&&$(".fn3").length&&$(".fn3").flexNav({buttonSelector:".mb3"}),$(document.body).on("click",".open_form_rec_pass",function(e){e.preventDefault(),"undefined"!=typeof modal_open_form_rec_pass&&modal_open_form_rec_pass.close(),"undefined"!=typeof modal_open_form_login&&modal_open_form_login.close(),(modal_open_form_rec_pass=new BootstrapDialog({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").load("/ajax.php?proceso=rec_pass_usr")})).realize(),modal_open_form_rec_pass.getModalHeader().hide(),modal_open_form_rec_pass.open()}),$(document.body).on("click",".open_search",function(e){e.preventDefault();var a="all",t=1;return $(this).data("mod")&&(a=$(this).data("mod")),$(this).data("selec")&&(t=$(this).data("selec")),"undefined"!=typeof modal_search_form&&modal_search_form.close(),(modal_search_form=new BootstrapDialog({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,closeByBackdrop:!0,message:function(e){var o=$("<
87div></div>");return $.get("/ajax.php?proceso=search_form&mod="+a+"&selec="+t,function(e){o.html(e)}),o},tabindex:!1})).realize(),modal_search_form.getModalHeader().hide(),modal_search_form.getModalFooter().hide(),modal_search_form.open(),!1}),$(document.body).on("submit","#search_formulario",function(e){e.preventDefault(),"undefined"!=typeof modal_search_form&&modal_search_form.close(),"undefined"!=typeof modal_search_results&&modal_search_results.close();var a=$(this).serialize();return(modal_search_results=new BootstrapDialog({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_WIDE,message:function(e){var o=$("<div></div>");return $.post("/ajax.php?proceso=search_results",a,function(e){o.html(e)}),o},tabindex:!1})).realize(),modal_search_results.getModalHeader().hide(),modal_search_results.open(),!1}),$(document.body).on("click",".open_form_login",function(e){e.preventDefault();e="",e=""!=(e=$(this).data("follow")?$(this).data("follow"):e)?"&follow="+e:"";$.ajax({cache:!1,timeout:6e5,type:"POST",url:"/ajax.php?proceso=loginsystem_form"+e+datas($(this).data()),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_open_form_login&&modal_open_form_login.close(),(modal_open_form_login=BootstrapDialog.show({title:"Módulo",draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").append(e),onshown:function(e){wf_recaptcha_render(e.getModal()),$("#g_id_onload").length&&(client_id=$("#g_id_onload").data("client_id"),google.accounts.id.initialize({client_id:client_id,callback:on_signin_google}),google.accounts.id.renderButton(document.getElementById("g_id_onload"),{theme:"outline",size:"large",shape:"default",text:"continue_with"}))},tabindex:!1})).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".open-notify-tumbl",function(e){e.preventDefault(),"undefined"!=typeof modal_notify_tumbl&&modal_notify_tumbl.close(),(modal_notify_tumbl=new BootstrapDialog({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").load("/ajax.php?proceso=pintar_notify_tumbl")})).realize(),modal_notify_tumbl.getModalHeader().hide(),modal_notify_tumbl.open()}),$(document.body).on("submit","#form_procesopago",function(e){e.preventDefault(),$.ajax({cache:!1,type:"POST",url:"/ajax.php?proceso=procesopago_confirm",data:$(this).serialize(),timeout:6e5,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),console.log(e.html),console.log(e.url),console.log(e.str),console.log(e),e.code<1?swal.fire("",e.str,"error"):void 0!==e.html?("undefined"!=typeof modal_procesopago_confirm&&modal_procesopago_confirm.close(),(modal_procesopago_confirm=new BootstrapDialog({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").append(e.html)})).realize(),modal_procesopago_confirm.getModalHeader().hide(),modal_procesopago_confirm.open()):void 0!==e.url?window.location.href=e.url:void 0!==e.str?(swal.fire("",e.str,"success"),$("#form_procesopago").replaceWith("<p class='alert alert-success'>"+e.str+"<a href='/inicio' class='btn btn-primary'>Volver</a></p>")):swal.fire("","","error")},error:function(e){$(".espera").remove(),swal.fire("","Se ha producido un error.","error")}})}),$(document.body).on("submit","#form_recom_portada",function(e){e.preventDefault();e=$(this).attr("data-id");$.ajax({cache:!1,type:"POST",url:"/ajax.php?proceso=recomendarportada&id="+e,data:$(this).serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),0==e.code?swal.fire("",e.str,"error"):1==e.code&&swal_toast.fire({text:e.str})},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(".subscribe-me").subscribeBetter({animation:"flyInUp",autoClose:!0,delay:500,showOnce:!0}),$(function(){var o,a,t;$("#wf_barra_arriba").length&&(o="#wf_barra_arriba",a=$(document).scrollTop(),t=$(o).outerHeight(),$(window).scroll(function(){var e=$
87(document).scrollTop();t<e?$(o).addClass("bf_ocultar"):$(o).removeClass("bf_ocultar"),a<e?$(o).removeClass("bf_fijar_arriba"):$(o).addClass("bf_fijar_arriba"),a=$(document).scrollTop()}))}),$(document.body).on("submit","#form_login",function(e){e.preventDefault();var o="Enviado formulario FORM_LOGIN\n",a=(o+="Datas: "+datas($(this).data())+"\n",$(this).data("modo"));$.ajax({cache:!1,type:"POST",url:"/json.php?proceso=loginsystem",data:$(this).serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),e.code<1?(o+="Mostramos error\n",swal.fire("",e.str,"error")):1==e.code&&(o+="Login correcto\n",e.str?(swal.fire("",e.str,"info"),o+="Mostramos texto Swal\n"):login_modo(a)),console.log("dentro: "+o)}})}),$(".votar_encuesta").on("click",function(e){e.preventDefault();var o=$(this).data("id"),e=$(this).data("lin");$.ajax({cache:!1,type:"get",url:"/ajax.php",data:"proceso=votar_encuesta&idenc="+o+"&idopc="+e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),0==e.code?swal.fire("",e.str,"error"):1==e.code&&swal_toast.fire({text:e.str})},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}}).done(function(){$.ajax({cache:!1,type:"get",url:"/ajax.php",data:"proceso=cargar_encuesta&idenc="+o,success:function(e){$("#"+o+"_idencuesta").replaceWith(e)}})})}),$(document.body).on("click","#generar_email",function(e){e.preventDefault(),$.ajax({cache:!1,type:"GET",url:"/json.php?proceso=gen_emailfalso",dataType:"json",beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),e[0].email&&$("#form_registro_email").val(e[0].email)}})}),$(document.body).on("click",".verlang",function(e){return e.preventDefault(),"undefined"!=typeof modal_verlang&&modal_verlang.close(),(modal_verlang=new BootstrapDialog({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_SMALL,message:$("<div></div>").load("/ajax.php?proceso=crear_ulidiomas")})).realize(),modal_verlang.getModalHeader().hide(),modal_verlang.open(),!1}),$(document.body).on("click",".changelang",function(e){r_ajax("/ajax.php","proceso=changelang&id="+$(this).attr("data-id"),"","get",function(){history.pushState(null,"","?userchangelang=1"),location.reload()})}),$(document.body).on("click",".open_form_filtrado",function(){var e;console.log("Clicada clase .open_form_filtrado"),$(this).attr("data-contenedor")?(e="&contenedor="+$(this).data("contenedor"),console.log("Indicado contenedor "+$(this).data("contenedor")+" al formulario.")):e="",$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php",data:"proceso=ec_form_filtrado"+e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_form_buscador_ec&&modal_form_buscador_ec.close(),(modal_form_buscador_ec=BootstrapDialog.show({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").append(e),tabindex:!1})).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit",".form_ec_buscador",function(e){e.preventDefault();var o,t,a="Enviado formulario de filtrado\n";$(this).attr("data-contenedor")?(a+="El formulario tiene atributo data-contenedor\n","undefined"!=typeof modal_form_buscador_ec&&modal_form_buscador_ec.close(),o=$(this).data("contenedor"),a+="Contenedor: "+o+"\n",$.ajax({cache:!1,type:"POST",url:"/ajax_ec.php?proceso=ec_resultados_index&subproceso=buscador",data:$(this).serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),$("#"+o).html(e),$("html, body").animate({scrollTop:$("#"+o).offset().top},1e3),$(".form_ec_buscador.form_ec_filtrado").length&&(a+="Repintamos el formulario de filtrado, se han encontrado:"+$(".form_ec_buscador.form_ec_filtrado").length+"\n",$.post("/ajax_ec.php?proceso=ec_form_filtrado&contenedor="+o,function(e){$(".form_ec_buscador.form_ec_filtrado").replaceWith(e)}))},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})):(a+="Enviamos formulario a /tienda\n",t=$("<form></form>"),console.log("Hacemos envÃo del formulario a /tienda."),t.attr("method","post"),t.attr("action","/tienda?proceso=be"),$.each($(this).serializeArray(),function(e,o){var a=$("<input></input>");console.log("Campo: "+e+"Nombre: "+o.name+"Valor: "+o.value),a.attr("type","hidden"),a.attr("name",o.name),a.attr("value",o.value),t.append(a)}),$(t).appendTo("body").submit()),console.log(a)}),$(document.body).on("change",".form_ec_buscador.form_ec_filtrado .submit_form_ec_buscador",function(){$(this).closest("form").submit(),console.log("EnvÃo automático de formulario.")}),$(document.body).on("click","form.form_ec_buscador.form_ec_filtrado .quitar",function(e){var o="Clic en quitar dentro de formulario de filtrado.\n",a=$(this).data("name"),t=$(this).data("valor"),r=$(this).closest("form");$(this).remove(),o="Clic en quitar dentro de formulario de filtrado.\nCampo reseetado....: "+a+"\nValor..............: "+t+"\n",r.find('input[type="text"][name="'+a+'"]').val(""),r.find('input[type="checkbox"][name="'+a+'[]"][value="'+t+'"]').removeAttr("checked"),r.find('select[name="'+a+'"] option').attr("selected",!1),r.submit(),console.log(o)}),$(document.body).on("click",".open_menu_cat_ec",function(){var e;console.log("Ejecutado .open_menu_cat_ec"),$(this).attr("data-contenedor")?(e="&contenedor="+$(this).data("c
87ontenedor"),console.log("Indicado contenedor "+$(this).data("contenedor")+" al formulario.")):e="",$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php",data:"proceso=open_menu_cat"+e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_menu_cat&&modal_menu_cat.close(),(modal_menu_cat=BootstrapDialog.show({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$('<div id="data_form_menu_cat"></div>').append(e),tabindex:!1})).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".cargar_txt_libre_tienda",function(){var e=$("<form></form>"),o=$("<input></input>");console.log("Pulsada clase .cargar_txt_libre_tienda"),txt=$(this).data("txt"),contenedor=$(this).data("go"),console.log("Recogido texto: "+txt+" y contenedor: "+contenedor),txt.length<1||($(this).attr("data-go")?(o.attr("type","hidden"),o.attr("name","ec_cad"),o.attr("value",txt),e.append(o),console.log("Carga en contenedor."),$.post("/ajax_ec.php?proceso=ec_resultados_index&subproceso=buscador",e.serialize(),function(e){$("#"+contenedor).html(e),$("html, body").animate({scrollTop:$("#"+contenedor).offset().top},1e3)})):(console.log("Redirección."),window.location.href="/ec_index.php?q="+txt))}),$(document.body).on("click",".cargar_cat_tienda",function(){var e="Pulsada clase .cargar_cat_tienda\n";id=$(this).data("id"),contenedor=$(this).data("go"),e+="Recogido id: "+id+" y contenedor: "+contenedor+"\n",parseInt(id)<1||($(this).attr("data-go")?(e+="Carga en contenedor.\n",r_ajax("/ajax_ec.php","proceso=ec_resultados_index&subproceso=selectcat&cat="+id,"#"+$(this).data("go"),"get",function(){"undefined"!=typeof modal_menu_cat&&modal_menu_cat.close(),$("html, body").animate({scrollTop:$("#"+contenedor).offset().top},1e3),$(".form_ec_buscador.form_ec_filtrado").length&&(e+="Repintamos el formulario de filtrado, se han encontrado:"+$(".form_ec_buscador.form_ec_filtrado").length+"\n",$.post("/ajax_ec.php?proceso=ec_form_filtrado&contenedor="+contenedor,function(e){$(".form_ec_buscador.form_ec_filtrado").replaceWith(e)}))})):(e+="Redirección.\n",window.location.href="/tienda?proceso=seleccat&cat="+id),console.log(e))}),$(document.body).on("click",".open_menu_fab_ec",function(){var e;console.log("Ejecutado .open_menu_fab_ec"),$(this).attr("data-contenedor")?(e="&contenedor="+$(this).data("contenedor"),console.log("Indicado contenedor "+$(this).data("contenedor")+" al formulario.")):e="",$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php",data:"proceso=open_menu_fab"+e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_menu_fab&&modal_menu_fab.close(),(modal_menu_fab=BootstrapDialog.show({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$('<div id="data_form_menu_fab"></div>').append(e),tabindex:!1})).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".cargar_fab_tienda",function(){console.log("Pulsada clase .cargar_fab_tienda"),id=$(this).data("id"),console.log("Recogido id "+id+" y contenedor "+$(this).data("go")),parseInt(id)<1||($(this).attr("data-go")?(console.log("Carga en contenedor."),r_ajax("/ajax_ec.php","proceso=ec_resultados_index&subproceso=selectfab&fab="+id,"#"+$(this).data("go"),"get",function(){"undefined"!=typeof modal_menu_fab&&modal_menu_fab.close(),$("html, body").animate({scrollTop:$("#"+$(this).data("go")).offset().top},1e3)})):(console.log("Redirección."),window.location.href="/ec_index.php?proceso=selectfab&fab="+id))}),$(document.body).on("click",".cargar_oferta_todos",function(){console.log("Ejecutado .cargar_oferta_todos"),contenedor="#"+$(this).attr("data-contenedor"),$(this).attr("data-contenedor")?(console.log("Carga en contenedor: "+contenedor),r_ajax("/ajax_ec.php","proceso=ec_resultados_index&subproceso=cargar_oferta_todos",contenedor,"get",function(){"undefined"!=typeof modal_menu_cat&&modal_menu_cat.close(),$("html, body").animate({scrollTop:$(contenedor).offset().top},1e3)})):(console.log("Redirección."),window.location.href="/ec_index.php?proceso=cargar_oferta_todos")}),$(document.body).on("click",".paginacion_ec a",function(e){e.preventDefault(),console.log("Hacemos clic en paginación de EC"),console.dir($(this)),custom=$(this).data("custom"),pag_cadena_vari=$(this).data("pag_cadena_vari"),page=$(this).data("page"),url="cargar_oferta"==pag_cadena_vari?"&subproceso=cargar_oferta&idof="+custom:"";var o=$(this).closest(".paginacion_ec").parent();$.post("/ajax_ec.php?proceso=ec_resultados_index&page="+page+url,function(e){o.html(e),$("html, body").animate({scrollTop:o.offset().top},1e3)})}),$(document.body).on("change","#ec_select_rpp",function(){rpp=$(this).val(),contenedor=$
87(this).closest("div").attr("id"),console.log("Contenedor: "+contenedor),r_ajax("/ajax_ec.php","proceso=ec_resultados_index&subproceso=ec_rpp&num_rpp="+rpp,"#"+contenedor,"get",function(){$("html, body").animate({scrollTop:$("#"+contenedor).offset().top},1e3)})}),$(document.body).on("change","#ec_order_by",function(){orden=$(this).val(),contenedor=$(this).closest("div").attr("id"),r_ajax("/ajax_ec.php","proceso=change_ec_order_by&orden="+orden,"","get",function(){$.post("/ajax_ec.php?proceso=ec_resultados_index",function(e){$("#"+contenedor).html(e)}),$("html, body").animate({scrollTop:$("#"+contenedor).offset().top},1e3)})}),$(document.body).on("click",".ec_resall",function(){var e="Reseteo de búsqueda de tienda: Contenedor: "+(contenedor=$(this).parent().attr("id"));r_ajax("/ajax_ec.php","proceso=ec_resultados_index&subproceso=ec_resall","#"+contenedor,"get",function(){$("html, body").animate({scrollTop:$("#"+contenedor).offset().top},1e3),$(".form_ec_buscador.form_ec_filtrado").length&&($.post("/ajax_ec.php?proceso=ec_form_filtrado&contenedor="+contenedor,function(e){$(".form_ec_buscador.form_ec_filtrado").replaceWith(e)}),e+="Repintamos el formulario de filtrado, se han encontrado:"+$(".form_ec_buscador.form_ec_filtrado").length+"\n")}),console.log(e)}),$(document.body).on("click",".abrir_modal_dtos_user",function(){$.ajax({cache:!1,timeout:6e5,type:"POST",url:"/ajax_ec.php?proceso=abrir_modal_dtos_user",beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_abrir_dtos_user&&modal_abrir_dtos_user.close(),(modal_abrir_dtos_user=BootstrapDialog.show({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").append(e),tabindex:!1})).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}
87),$(document.body).on("change","#exc_paises",function(){var e=$(this).val(),o=$(this).data("formato");$.get("/ajax_ec.php?proceso=pintar_provincias&id="+e+"&formato="+o,function(e){$("#exc_provincias").html(e)})}),$(document.body).on("change","#exc_paises_env",function(){var e=$(this).val(),o=$(this).data("formato");$.get("/ajax_ec.php?proceso=pintar_provincias&id="+e+"&formato="+o,function(e){$("#exc_provincias_env").html(e)})}),$(document.body).on("click",".ec_addcesta",function(e){e.preventDefault();var e=$(this).data("idart"),o=$(this).data("idcom");$.ajax({cache:!1,type:"GET",url:"/ajax_ec.php",data:"proceso=anadir_producto_a_cesta&idart="+e+"&idcom="+o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),0==e.code?swal.fire("",e.str,"error"):1==e.code&&load_icon_usr(1),console.log(e.d)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".open-cesta-tumbl",function(){"undefined"!=typeof modal_cesta_tumbls&&modal_cesta_tumbls.close(),(modal_cesta_tumbls=new BootstrapDialog({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").load("/ajax_ec.php?proceso=pintar_cesta_tumbl")})).realize(),modal_cesta_tumbls.getModalHeader().hide(),modal_cesta_tumbls.open()}),$(document.body).on("click",".btn-iv-sdp-go, .btn-iu-sdp-go",function(){var o=$(this).data("registro"),a=0;$(this).data("abrir_cesta")&&parseInt($(this).data("abrir_cesta")),$(this).data("ir_cesta")&&(a=parseInt($(this).data("ir_cesta"))),$.ajax({cache:!1,type:"GET",url:"/json.php",data:"proceso=mpago_tramitarpago"+datas($(this).data()),dataType:"json",beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),e[0].url?window.location.href=e[0].url:e[0].cesta?1==a&&(window.location.href="/cesta"):e[0].login?("undefined"!=typeof modal_opcionacceso&&modal_opcionacceso.close(),(modal_opcionacceso=new BootstrapDialog({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").load("/ajax.php?proceso=btn_acceso®istro="+o)})).realize(),modal_opcionacceso.getModalHeader().hide(),modal_opcionacceso.open()):e[0].error&&swal.fire("¡Error!",e[0].error,"error")},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".mpago-alza",function(){var e="click : .mpago-alza\n",o=parseFloat($(this).closest(".input-group").find("input").val()),a=parseFloat($(this).closest(".input-group").find("input").data("importe-inicial")),t=parseFloat($(this).closest(".input-group").find("input").data("alza")),r=parseFloat($(this).closest(".input-group").find("input").data("baja")),n=parseFloat($(this).closest(".input-group").find("input").data("salto")),e=(e=(e=(e+="Importe actual: "+o+"\n")+("impinicial....: "+a+"\n")+("alza..........: "+t+"\n"))+("baja..........: "+r+"\n")+("salto.........: "+n+"\n"))+("Nuevo importe: "+(o=(o+=n).toFixed(2))+"\n");$(this).closest(".input-group").find("input").val(o),$(this).closest("div.sdp").find(".btn-iu-sdp-go").attr("data-importe",o),0==t&&a<o&&($(this).closest(".input-group").find("input").val(a),$(this).closest("div.sdp").find(".btn-iu-sdp-go").attr("data-importe",a),e+="No podemos subir, volvemos al inicial.\n"),0==r&&o<a&&($(this).closest(".input-group").find("input").val(a),$(this).closest("div.sdp").find(".btn-iu-sdp-go").attr("data-importe",a),e+="No podemos bajar, volvemos al inicial.\n"),console.log(e)}),$(document.body).on("click",".mpago-baja",function(){var e="click : .mpago-baja\n",o=parseFloat($(this).closest(".input-group").find("input").val()),a=parseFloat($(this).closest(".input-group").find("input").attr("data-importe-inicial")),t=parseFloat($(this).closest(".input-group").find("input").data("baja")),r=parseFloat($(this).closest(".input-group").find("input").data("alza")),n=parseFloat($(this).closest(".input-group").find("input").data("salto")),e=(e=(e+="Importe actual: "+o+"\n")+("impinicial....: "+a+"\n")+("alza..........: "+r+"\n"))+("baja..........: "+t+"\n")+("salto.........: "+n+"\n\n");.01<(o=(o-=n).toFixed(2))&&(e+="Importe es mayor de 0.01.\n",$(this).closest(".input-group").find("input").val(o
87),$(this).closest("div.sdp").find(".btn-iu-sdp-go").attr("data-importe",o)),e+="Nuevo importe: "+o+"\n",0==t&&o<a&&($(this).closest(".input-group").find("input").val(a),$(this).closest("div.sdp").find(".btn-iu-sdp-go").attr("data-importe",a))}),$(document.body).on("change","div.sdp input.input_sdp",function(){var e="Ha cambiado el importe de un sÃstema de pago único\n",o=parseFloat($(this).val()),a=parseFloat($(this).data("importe-inicial")),t=parseFloat($(this).data("baja"));e+="Importe: "+o+"\nImporte inicial: "+a+"\n¿Baja?: "+t+"\n",0==t&&o<a?($(this).val(a),$(this).closest("div.sdp").find(".btn-iu-sdp-go").attr("data-importe",a),e+="Ponemos importe inicial"):($(this).closest("div.sdp").find(".btn-iu-sdp-go").attr("data-importe",o),e+="Ponemos importe."),console.log(e)}),$(document.body).on("change","div.sdp select",function(){var e="Ha seleccionado otro importe de un sÃstema de pago único\n",o=parseFloat($(this).val());e+="Importe: "+o+"\n",$(this).closest("div.sdp").find(".btn-iu-sdp-go").attr("data-importe",o),$(this).closest("div.sdp").find(".btn-iv-sdp-go").attr("data-importe",o),e+="Ponemos importe.",console.log(e)}),$(document.body).on("change","#bkf_form",function(){var o=$("#bkf_importe");$.ajax({cache:!1,timeout:6e5,type:"POST",url:"/ajax_ec.php?proceso=procesar_bkf",data:$(this).serialize(),success:function(e){o.html(e.importe),0==e.items_calendario&&swal.fire("¡Error!","Sin disponibilidad para esta selección.","error"),console.log(e.d)},error:function(){swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit","#bkf_form",function(e){e.preventDefault();var e=datas($(this).data()),o=$("#bkf_importe"),a=$(this).data("idlindoc"),t=$(this).data("iddoc"),r=$(this).data("doc");doct=1==r?(sc="presupuestos_ajax",cnl="r_presupuesto_l",tbl="t_presupuestos_l",cfc="#r_presupuesto","pr"):2==r?(sc="pedidos_ajax",cnl="r_pedido_l",tbl="t_pedidos_l",cfc="#r_pedido","pe"):3==r?(sc="albaranes_ajax",cnl="r_albaran_l",tbl="t_albaranes_l",cfc="#r_albaran","al"):4==r?(sc="facturas_ajax",cnl="r_factura_l",tbl="t_facturas_l",cfc="#r_factura","fa"):(sc="none",cnl="none",tbl="none",cfc="#none","none"),$.ajax({cache:!1,timeout:6e5,type:"POST",url:"/ajax_ec.php?proceso=procesar_bkf&add_cesta=1"+e,data:$(this).serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),0==e.code?swal.fire("",e.str,"error"):1==e.code&&(0==e.items_calendario&&swal.fire("¡Error!","Sin disponibilidad para esta selección.","error"),"undefined"!=typeof bk_crear_rsv_from_cms&&bk_crear_rsv_from_cms.close(),$("#"+cnl).length&&$.post("/f/"+sc+".php?proceso=load_l&id="+a,function(e){$("#"+cnl).html(e),formateo_de_clases(),pintar_tabla_json("/f/json.php?proceso="+tbl,cfc+" div.lineas",1,0,"&id="+t),$.get("/f/ajax.php?proceso=pintar_totales_doc&doc="+doct+"&id="+t,function(e){$(cfc+" .totales_doc").html(e)})}),load_icon_usr(1)),o.html(e.importe),console.log(e.d)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".bkf_tax_t1 .sube, .bkf_tax_t1 .baja",function(){var o="CLICK EN .sube O .baja\n",e=$(this).parent().data("idtax"),a=parseInt($(this).siblings("input").val()),t=(o+="Id de la taxonomÃa: "+e+"\nValor del input...: "+a+"\n",$(this).siblings("input"));$(this).hasClass("sube")&&(a=++a),$(this).hasClass("baja")&&(a=--a),o+="Su nuevo valor será: "+a+"\n",$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php",data:"proceso=change_bkf_tax_t1&id="+e+"&valor="+a,success:function(e){o+=e.d+"Se ha procesado y cambiado a: "+e.valor,console.log(e.d),t.val(e.valor).change()},error:function(){swal.fire("¡Error!","Se ha producido un error.","error")}}),console.log(o)}),$(document.body).on("click",".open_form_ec_recomendar",function(){data_id=$(this).closest(".ec_cuadro_pago").data("id"),$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php",data:"proceso=open_form_ec_recomendar&id="+data_id,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_recomendar&&modal_recomendar.close(),(modal_recomendar=
87BootstrapDialog.show({draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").append(e),tabindex:!1})).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".ec_anadir_deseo",function(e){e.preventDefault(),"undefined"==typeof(data_id="undefined"==typeof(data_id=$(this).closest(".ec_cuadro_pago").data("id"))?$(this).data("idart"):data_id)&&(data_id=$(this).data("id")),$.ajax({cache:!1,timeout:6e5,type:"GET",url:"/ajax_ec.php?proceso=anadir_a_mis_deseos&id="+data_id,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),1==e.code?swal.fire("",e.str,"success"):0==e.code&&swal.fire("",e.str,"error")},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit","#form_ec_recomendar",function(e){e.preventDefault(),r_ajax("/ajax_ec.php?proceso=recomendar_articulo",$(this).serialize(),"","post",function(e){0==e.code?swal.fire("",e.str,"error"):1==e.code&&(swal_toast.fire({text:e.str}),"undefined"!=typeof modal_recomendar)&&modal_recomendar.close()})}),$(document.body).on("change",".combo_combinaciones",function(){data_id=$(this).data("id");
87var e=$(this).val();console.log("Se ha elegido la combinación "+e+" desde un selector."),$(this).siblings("button.ec_addcesta").data("idcom",e),$.post("/ajax_ec.php?proceso=obtener_pv_combi&id="+data_id+"&idcom="+e,function(e){1==e.code&&($(".precio_pantalla").html(e.precio_pantalla),$(".precio_pantalla_del").html(e.precio_pantalla_del),$(".precio_pantalla_dto").html(e.precio_pantalla_dto),$(".txt_tasa").html(e.txt_tasa))})}),$(document.body).on("click",".open_com",function(){data_id=$(this).data("id"),$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php",data:"proceso=pintar_combinaciones&idart="+data_id,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_open_com&&modal_open_com.close(),(modal_open_com=BootstrapDialog.show({draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").append(e),tabindex:!1,onshown:function(e){$(".sld-owl_ec_item_comb").owlCarousel({items:1,margin:10,loop:!1,rewind:!0,autoplay:!0,autoplayTimeout:3e3,autoplayHoverPause:!0,responsive:{0:{items:1},600:{items:1}}}),$(".sld-owl_ec_item_comb_img").owlCarousel({items:1,margin:10,loop:!1,rewind:!0,autoplay:!0,autoplayTimeout:3e3,autoplayHoverPause:!0,dotsEach:!0,responsive:{0:{items:1},600:{items:1}}})}})).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit","#form_ec_envconsulta",function(e){e.preventDefault(),r_ajax("/ajax_ec.php?proceso=envconsulta_articulo&id="+(data_id=$(this).closest(".ec_cuadro_pago").data("id")),$(this).serialize(),"","post",function(e){0==e.code?swal.fire("",e.str,"error"):1==e.code&&(swal_toast.fire({text:e.str}),"undefined"!=typeof modal_envconsulta)&&modal_envconsulta.close()})}),$(document.body).on("click",".open_form_ec_envconsulta",function(){var e=$
87(this).data("id");$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php",data:"proceso=open_form_ec_envconsulta&id="+e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_envconsulta&&modal_envconsulta.close(),(modal_envconsulta=BootstrapDialog.show({draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").append(e),tabindex:!1})).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit",".form_altaboletin",function(e){e.preventDefault(),r_ajax("/ajax.php?proceso=altaboletin",$(this).serialize(),"","post",function(e){0==e.code?swal.fire("",e.str,"error"):1==e.code&&swal_toast.fire({text:e.str})})}),$(document.body).on("click",".open_valoraciones",function(e){e.preventDefault();var e=$(this).data("proceso"),o=$(this).data("id");$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php",data:"proceso=open_valoraciones&id="+o+"&p="+e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_open_valoraciones&&modal_open_valoraciones.close(),(modal_open_valoraciones=BootstrapDialog.show({draggable:!0,closable:!0,closeByBackdrop:!0,size:BootstrapDialog.SIZE_WIDE,message:$("<div></div>").append(e),tabindex:!1})).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit","form.ec_valoraciones",function(e){e.preventDefault(),este=$(this),$.ajax({cache:!1,type:"POST",url:"/ajax_ec.php?proceso=save_valoracion",data:$(this).serialize(),timeout:6e5,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),e.code<1?swal.fire("",e.str,"error"):este.replaceWith("<div class='alert alert-success mt-4'>"+e.str+"</div>"),console.log(e.d)},error:function(e){$(".espera").remove(),swal.fire("","Se ha producido un error.","error")}})}),$(document.body).on("click",".cazar_cupon",function(e){e.preventDefault();e=datas($(this).data());$.ajax({cache:!1,url:"/ajax_ec.php",data:"proceso=cazar_cupon"+e,type:"get",success:function(e){0==e.code?swal.fire("",e.str,"error"):1==e.code&&swal.fire("",e.str,"success"),console.log(e.d)},error:function(){swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click","button.gall_guardar",function(e){e.preventDefault();e=datas($(this).data());$.ajax({cache:!1,url:"/json.php",data:"proceso=gall_guardar"+e,type:"get",success:function(e){$(".pol_cookies").remove(),"undefined"!=typeof modal_form_gall_ajustar&&modal_form_gall_ajustar.close(),console.log(e.d)},error:function(){swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".gall_ajustar",function(e){e.preventDefault(),$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax.php",data:"proceso=form_gall_ajustar",beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_form_gall_ajustar&&modal_form_gall_ajustar.close(),(modal_form_gall_ajustar=BootstrapDialog.show({draggable:!0,closable:!0,closeByBackdrop:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").append(e),tabindex:!1})).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit","form.form_gall_ajustar",function(e){e.preventDefault(),$.ajax({cache:!1,type:"POST",url:"/json.php?proceso=save_gall_ajustar",data:$(this).serialize(),timeout:6e5,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),e.code<1?swal.fire("",e.str,"error"):($(".pol_cookies").remove(),"undefined"!=typeof modal_form_gall_ajustar&&modal_form_gall_ajustar.close()),console.log(e.d)},error:function(e){$(".espera").remove(),swal.fire("","Se ha producido un error.","error")}})}),$(document.body).on("click",".load_form_dat_factu",function(e){BootstrapDialog.show({message:$("<div></div>").load("/ajax_ec.php?proceso=load_form_dat_factu&id_usr="+datas($(this).data()))})}),$(document.body).on("click",".copiar_al_portapapeles",function(e){var o;item=$(this).data("clase"),"undefined"==typeof(html="undefined"==typeof(html="undefined"==typeof(html="undefined"==typeof(html="undefined"==typeof(html=$(this).data("html"))?$(this).next(item).html():html)?$(this).siblings(item).html():html)?$(this).closest(item).html():html)?$(this).parent().find(item).html():html)&&(html=$(this).find(item).html()),navigator.clipboard?navigator.clipboard.writeText(html).then(()=>{console.log("Texto copiado al portapapeles con NAVIGATOR.CLIPBOARD.")}).catch(e=>{console.log("Error al copiar al portapapeles con NAVIGATOR.CLIPBOARD",e)}):((o=document.createElement("input")).setAttribute("value",html),document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)),console.log("Copiamos al portapapeles el elemento "+item+" con el texto: "+html)}),$(document.body).on("click",".open_ec_cupon",function(e){e.preventDefault(),console.log("Ejecutado .open_ec_cupon");var e=0,o=1;$(this).data("id")&&(e=$(this).data("id"),console.log("Indicado id "+e+" al modal.")),$(this).data("tamano")&&(o=$(this).data("tamano"),console.log("Indicado tamaño "+o+" al modal.")),$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax_ec.php",data:"proceso=open_ec_cupon&tamano="+o+"&id="+e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_open_ec_cupon&&modal_open_ec_cupon.close(),t=1==o?"size-small":"size-extrawide",modal_op={draggable:!0,closable:!0,closeByBackdrop:!0,size:t,message:$("<div></div>").append(e),tabindex:!1}
87,(modal_open_ec_cupon=BootstrapDialog.show(modal_op)).getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".abrir_legal",function(e){e.preventDefault(),console.log("Ejecutado .abrir_legal: "+datas($(this).data()));var o=3,a=1,r=1,n="";$(this).data("tamano")&&(o=$(this).data("tamano")),$(this).data("cabecera")&&(a=parseInt($(this).data("cabecera"))),$(this).data("pie")&&(r=parseInt($(this).data("pie"))),$(this).data("titulo")&&(n=$(this).data("titulo")),$.ajax({cache:!1,timeout:6e5,type:"get",url:"/ajax.php",data:"proceso=abrir_legal"+datas($(this).data()),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),0==e.code?swal.fire("",e.str,"error"):void 0!==e.html?("undefined"!=typeof modal_abrir_legal&&modal_abrir_legal.close(),t=4==o?"size-extrawide":3==o?"size-wide":5==o?"size-large":2==o?"size-normal":1==o?"size-small":"BootstrapDialog.SIZE_WIDE",console.log(o+" "+t),modal_vpr2={title:n,draggable:!0,closable:!0,closeByBackdrop:!0,size:t,message:$("<div></div>").append(e.html),tabindex:!1},modal_abrir_legal=BootstrapDialog.show(modal_vpr2),0==a&&modal_abrir_legal.getModalHeader().hide(),0==r&&modal_abrir_legal.getModalFooter().hide()):swal.fire("","Error","error")},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".load_gestionar_avatar",function(){var e=parseInt($(this).data("id")),o="/ajax.php?proceso=gestionar_avatar"+datas($(this).data()),a="dr_gestionar_avatar",t="Avatar "+e,r=$.Callbacks("once");r.add(function(e){options={thumbBox:".thumbBox",spinner:".spinner"};var a=$("div.gestionar_avatar .imageBox").cropbox({thumbBox:".thumbBox",spinner:".spinner"});$(".gestionar_avatar #file").on("change",function(){console.log(".gestionar_avatar #file : CHANGE");var e=new FileReader;e.onload=function(e){options.imgSrc=e.target.result,a=$(".gestionar_avatar .imageBox").cropbox(options)},e.readAsDataURL(this.files[0]),this.files=[]}),$(".gestionar_avatar #btn_recortar").on("click",function(){console.log(".gestionar_avatar #btn_recortar : CLICK");var e=a.getDataURL(),o=$(this).closest("div.gestionar_avatar").data("id");$(".gestionar_avatar .contenedor_avatar").html('<img class="mx-auto d-block rounded-circle" src="'+e+'">'),$.ajax({type:"POST",url:"/ajax.php?proceso=save_avatar&id="+o,data:"img="+e})}),$(".gestionar_avatar #zoom_in").on("click",function(){a.zoomIn()}),$(".gestionar_avatar #zoom_out").on("click",function(){a.zoomOut()})}),"undefined"==typeof modal_gestionar_avatar?modal_gestionar_avatar=BootstrapDialog.show({title:t,draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_EXTRAWIDE,tabindex:!1,message:$('<div id="'+a+'"></div>').load(o),onshow:function(){$("body").append('<div class="espera"></div>')},onshown:function(){r.fire(e),$(".espera").remove()}}):(modal_gestionar_avatar.open(),$("body").append('<div class="espera"></div>'),setTimeout(function(){$("#"+a).load(o,function(){$(".espera").remove(),r.fire(e),modal_gestionar_avatar.setTitle("Avatar "+e)})},250))}),$(document.body).on("submit","form.cn_tomar_firma",function(e){e.preventDefault(),$("#jqfirma").length&&(e=$("#jqfirma").jSignature("getData","image"),$(this).find("input[name=firma]").val(e[1]));var o=$.Callbacks("once");o.add(function(){}),$.ajax({cache:!1,type:"POST",url:"/cn/ajax.php?proceso=save_firma",data:$(this).serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),o.fire(),e.code=parseInt(e.code),1==e.code?($("div.respuesta_ajax").html(e.html),0==$("canvas.jSignature").length&&$("#jqfirma").jSignature({width:497,height:200,cssclass:"bg-light border border-warning",lineWidth:2,color:"black"})):-7==e.code?$("div.respuesta_ajax").html("<div class='alert alert-info my-5'>"+e.html+"</div>"):swal.fire("",e.str,"error"),console.log(e.d)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".pp_marcar_todo",function(){con="#"+$(this).data("c
87on"),$(con+" .selec").length!=$(con+" .selec:checked").length?($(con+" .selec").prop("checked",!0),$(con+" tr").addClass("alert alert-warning")):($(con+" .selec").prop("checked",!1),$(con+" tr").removeClass("alert alert-warning")),d="Se han seleccionado "+$(con+" .selec").length+" cajas de chequeo.\nNombre del selector: "+con+" .selec",console.log(d)}),$(document.body).on("click",".panel_direcciones_usuarios",function(){var e=datas($(this).data()),o="/a/usuarios_ajax.php?proceso=panel_direcciones_usuarios"+e,a=$.Callbacks("once");a.add(function(){pintar_tabla_json("/a/usuarios_ajax.php?proceso=tabla_direcciones_usuarios","#t_direcciones_usuarios",1,0,e)}),$.ajax({cache:!1,timeout:6e5,type:"POST",url:o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),document.getElementById("wf_barra_lateral_activador").checked&&$("label[for=wf_barra_lateral_activador]").trigger("click"),"undefined"!=typeof panel_direcciones_usuarios&&(panel_direcciones_usuarios=null),(panel_direcciones_usuarios=new BootstrapDialog({title:"Direcciones",draggable:!1,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_WIDE,message:$('<div id="panel_direcciones_usuarios"></div>').append(e),onshown:function(){a.fire()},tabindex:!1})).realize(),panel_direcciones_usuarios.open(),panel_direcciones_usuarios.getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".establecer_habitual_usuarios",function(e){e.preventDefault();var o=datas($(this).data());$.get("/a/usuarios_ajax.php?proceso=establecer_habitual_usuarios"+o,function(e){0==e.code?swal.fire("",e.str,"error"):1==e.code&&(swal_toast.fire({text:e.str}),$("#t_direcciones_usuarios").length)&&pintar_tabla_json("/a/usuarios_ajax.php?proceso=tabla_direcciones_usuarios"+o,"#t_direcciones_usuarios",1,0,"")})}),$(document.body).on("click","#btn_refresh_direnv",function(){pintar_tabla_json("/a/usuarios_ajax.php?proceso=tabla_direcciones_usuarios","#tabla_registros_direc_envio",1,0,"&id="+$(this).data("id"))}),$(document.body).on("click",".btn_del_habitual",function(){$.post("/ajax_ec.php?proceso=quitar_direc_habitual"+datas($(this).data()),function(e){0==e.code?swal.fire("",e.str,"error"):1==e.code&&swal_toast.fire({text:e.str})})}),$(document.body).on("click",".chat_panel",function(){var o="chat",a=datas($(this).data()),e=`/a/lanzador_ajax.php?proceso=${o}_panel`+a,t=o+"_panel",r=$.Callbacks("once");r.add(function(e){pintar_tabla_json(`/a/lanzador_ajax.php?proceso=${o}_tabla_json`,"#t_"+o,1,0,a)}),$.ajax({cache:!1,timeout:6e5,type:"POST",url:e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),$(".sidebar_quitter").trigger("click"),"undefined"!=typeof chat_panel&&(chat_panel=null),(chat_panel=new BootstrapDialog({title:"Chat",draggable:!1,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_LARGE,message:$('<div id="'+t+'"></div>').append(e),onshown:function(){r.fire()},tabindex:!1})).realize(),chat_panel.open(),chat_panel.getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".chat_panel_conf",function(){var e="/a/lanzador_ajax.php?proceso=chat_panel_conf"+datas($(this).data()),o=$.Callbacks("once");o.add(function(e){}),$.ajax({cache:!1,timeout:6e5,type:"POST",url:e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),$(".sidebar_quitter").trigger("click"),console.log(e.d),"undefined"!=typeof chat_panel_conf&&chat_panel_conf.close(),(chat_panel_conf=new BootstrapDialog({title:"Configuración",autodetroy:!0,draggable:!1,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_LARGE,message:$('<div id="panel_chat_conf"></div>').append(e.html),onshown:function(){o.fire()},tabindex:!1})).realize(),chat_panel_conf.open(),chat_panel_conf.getModalHeader().hide()},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit","#chat_form_conf",function(e){e.preventDefault();var o=$.Callbacks("once");o.add(function(e){}),$.ajax({cache:!1,type:"POST",url:"/a/lanzador_ajax.php?proceso=chat_save_conf",data:$(this).serialize(),beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),1==e.code?(swal_toast.fire({text:e.str}),o.fire(id)):swal.fire("",e.str,"error"),console.log(e.d)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".chat_del",function(){var o="/a/lanzador_ajax.php",a=$(this).data("c
87ont"),t=$(this).data("id");0!==parseInt(a.length)&&0<document.querySelectorAll(`#${a} input.selec:checked`).length&&(ids=obtener_ids_seleccionados(a),$.ajax({cache:!1,type:"POST",url:o+"?proceso=chat_del",data:{ids:ids},beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),1==e.code?(swal_toast.fire({text:e.str}),pintar_tabla_json(o+"?proceso=chat_tabla_json","#"+a,1,0,"&id="+t)):swal.fire("",e.str,"error"),console.log(e.d)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}}))}),$(document.body).on("click",".chat_load",function(){var o=parseInt($(this).data("id")),e="/a/lanzador_ajax.php?proceso=chat_load"+datas($(this).data()),a="chat_dr",t=$.Callbacks("once");t.add(function(e){}),$.ajax({cache:!1,timeout:6e5,type:"POST",url:e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"==typeof modal_chat_load?modal_chat_load=BootstrapDialog.show({title:"Chat",autodestroy:!1,draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_WIDE,message:$(`<div id="${a}"></div>`).append(e.html),onshown:function(){t.fire(o)},tabindex:!1}):(modal_chat_load.open(),$("#"+a).html(e.html),t.fire(o)),console.log(e.d)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".chat_conversacion .reply_msg",function(){var e=`chat_reply_msg&modulo=${$(this).closest(".chat_conversacion").attr("data-mod")}®istro=`+$(this).closest(".chat_conversacion").attr("data-reg"),o=datas($(this).data());$.ajax({cache:!1,timeout:6e5,type:"POST",url:"/a/lanzador_ajax.php?proceso="+e+o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_chat_form_reply&&modal_chat_form_reply.close(),modal_chat_form_reply=BootstrapDialog.show({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$('<div class="chat_conversacion"></div>').append(e.html),onshow:function(e){e.getModalHeader().hide()},tabindex:!1}),console.log(e.d)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".chat_conversacion .ver_files",function(){var e=`chat_mostrar_files&modulo=${$(this).closest(".chat_conversacion").attr("data-mod")}®istro=`+$(this).closest(".chat_conversacion").attr("data-reg"),o=datas($(this).data());$.ajax({cache:!1,timeout:6e5,type:"POST",url:"/a/lanzador_ajax.php?proceso="+e+o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"!=typeof modal_chat_ver_files&&modal_chat_ver_files.close(),modal_chat_ver_files=BootstrapDialog.show({draggable:!0,closable:!0,size:BootstrapDialog.SIZE_NORMAL,message:$("<div></div>").append(e.html),onshow:function(e){e.getModalHeader().hide()},tabindex:!1})},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".chat_conversacion .ocultar_msg",function(e){var o=$(this).attr("data-id"),a=$(this).closest(".chat_conversacion").attr("data-mod"),t=$(this).closest(".chat_conversacion").attr("data-reg"),r=$(this);e.preventDefault(),$.ajax({cache:!1,type:"get",url:`/a/lanzador_ajax.php?proceso=chat_ocultar_msg&modulo=${a}®istro=`+t,data:"id="+o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),1==e.code?(swal_toast.fire({text:e.str}),$.post(`/a/lanzador_ajax.php?proceso=chat_load&modulo=${a}®istro=`+t,function(e){r.closest(".chat_conversacion").html(e.html)})):swal.fire("",e.str,"error")},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".chat_conversacion .activar_msg",function(e){var o=$(this).attr("data-id"),a=$(this).closest(".chat_conversacion").attr("data-mod"),t=$(this).closest(".chat_conversacion").attr("data-reg"),r=$(this);e.preventDefault(),$.ajax({cache:!1,type:"get",url:`/a/lanzador_ajax.php?proceso=chat_activar_msg&modulo=${a}®istro=`+t,data:"id="+o,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),1==e.code?(swal_toast.fire({text:e.str}),$.post(`/a/lanzador_ajax.php?proceso=chat_load&modulo=${a}®istro=`+t,function(e){r.closest(".chat_conversacion").html(e.html)})):swal.fire("",e.str,"error")},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".chat_conversacion .borrar_msg",function(e){e.preventDefault();var o=$(this).attr("data-id"),a=$(this).closest(".chat_conversacion").attr("data-mod"),t=$(this).closest(".chat_conversacion").attr("data-reg"),r=$(this);swal.fire({title:"No podrá deshacer",text:"La eliminación se hará de manera definitiva.",type:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Borrar",cancelButtonText:"Salir",buttonsStyling:!0,reverseButtons:!0}).then(e=>{console.log("Resultado: "+e),e.value?(console.log("El usuario decidió borrar: "+e.value),$.ajax({url:`/a/lanzador_ajax.php?proceso=chat_borrar_msg&modulo=${a}®istro=`+t,type:"get",data:"id="+o,dataType:"json",cache:!1,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),1==e.code?(swal_toast.fire({text:e.str}),$.post(`/a/lanzador_ajax.php?proceso=chat_load&modulo=${a}®istro=`+t,function(e){r.closest(".chat_conversacion").html(e.html)})):swal.fire("",e.str,"error")},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})):"cancel"===e.dismiss&&(console.log("El usuario canceló: "+e.dismiss),swal_toast.fire({text:"¡Cancelado! No se han borrado datos ;)"}))})}),$(document.body).on("submit",".chat-form form, .chat_conversacion form",function(e){e.preventDefault();var o=$(this).find("input[name=modulo]").val(),a=$(this).find("input[name=registro]").val(),t=$(this),e=(editor_tinymce(),new FormData($(this)[0]));$.ajax({url:`/a/lanzador_ajax.php?proceso=chat_save&modulo=${o}
87®istro=`+a,type:"POST",enctype:"multipart/form-data",data:e,processData:!1,contentType:!1,cache:!1,timeout:6e5,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),1==e.code?(swal_toast.fire({text:e.str}),"undefined"!=typeof modal_chat_form_reply&&modal_chat_form_reply.close(),$.post(`/a/lanzador_ajax.php?proceso=chat_load&modulo=${o}®istro=`+a,function(e){let o=t.closest(".chat_conversacion");(o=0===o.length?t.closest(".chat"):o).html(e.html)})):swal.fire("",e.str,"error"),console.log(e.d)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("click",".chat_filtro",function(){var e="/a/lanzador_ajax.php?proceso=chat_filtro"+datas($(this).data()),o="chat_filtro",a=$.Callbacks("once");a.add(function(){}),$.ajax({cache:!1,timeout:6e5,type:"POST",url:e,beforeSend:function(){$("body").append('<div class="espera"></div>')},success:function(e){$(".espera").remove(),"undefined"==typeof chat_modal_filtro?chat_modal_filtro=BootstrapDialog.show({title:"Filtro",autodestroy:!1,draggable:!0,closable:!0,closeByBackdrop:!1,size:BootstrapDialog.SIZE_EXTRAWIDE,message:$('<div id="'+o+'"></div>').append(e.html),onshown:function(){a.fire()},tabindex:!1}):(chat_modal_filtro.open(),$("#"+o).html(e.html),a.fire()),console.log(e.d)},error:function(){$(".espera").remove(),swal.fire("¡Error!","Se ha producido un error.","error")}})}),$(document.body).on("submit","#chat_form_filtro",function(e){e.preventDefault(),chat_modal_filtro.close();var e=$(this).data("en"),o="&"+$(this).serialize(),a="#t_chat",t=("contiguo"==e&&(t+=`Se la solicitado pintar resultados en TABLE continuo al formulario. 88`,0==$(this).siblings("table").length&&$(this).after("<table></table>"),a="#chat_form_filtro+table"),`Formulario de búsqueda/filtrado de chat en pantalla principal o contigua al formulario. 89 90`);t+=`En.......: ${e} 91 92`,pintar_tabla_json("/a/lanzador_ajax.php?proceso=chat_tabla_json",a,1,0,o),console.log(t)}),$(document.body).on("dblclick",".tabulator .tabulator-row",function(){var e=$
92(this).find(".selec[type=checkbox]");e.length&&(e.click(),console.log("El checkbox está seleccionado"))}),$(document.body).on("click","div.tabulator .selec[type=checkbox]",function(){var e,a="Clic en un selector de tabla principal.\n",t=0;0==$(this).closest("div.tabulator").siblings("div.info_table").length&&(a+="Creado contenedor de devolución.\n",$(this).closest(".tabulator").after("<div class='badge badge-success border border-light d-table fixed-bottom info_table m-2 rem12'></div>")),0<$(this).closest(".tabulator").find("input[type=checkbox].selec:checked").length?(a+="LÃneas seleccionadas: "+$(this).closest("div.tabulator").find("input[type=checkbox].selec:checked").length,$(this).closest("div.tabulator").find("input[type=checkbox].selec:checked").each(function(e,o){a+="\n\n -------\x3e> Procesamos #"+e+"\n",total=parseFloat($(o).closest(".tabulator-row").find("span[data-total]").data("total")),a+="Se ha encontrado un span: "+total+" "+$(o).closest(".tabulator-row").find("span[data-total]").data("total")+"\n",t+=total,a+="Id: "+e+" Item: "+total+" Total: "+t+"\n"}),a+="--------------- FIN -----------------\n",e=t.toLocaleString("es-ES",{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!0}),a+=`numeroFormateado: ${e} 93`,$(this).closest(".tabulator").find(".tabulator-row").removeClass("tabulator-selected"),$(this).closest(".tabulator").find("input[type=checkbox].selec:checked").closest(".tabulator-row").addClass("tabulator-selected"),$(this).closest(".tabulator").siblings("div.info_table").html("Total seleccionados: <span class='text-monospace'>"+e+"â¬</span>"),a+="\nTotal final: "+t):($(this).closest(".tabulator").find(".tabulator-row").removeClass("tabulator-selected"),$("div.info_table").remove(),a+="Borramos contenedor, ningún seleccionado."),console.log(a)})});
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.