/*! * Start Bootstrap - Simple Sidebar v6.0.5 (https://startbootstrap.com/template/simple-sidebar) * Copyright 2013-2022 Start Bootstrap * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-simple-sidebar/blob/master/LICENSE) */ // // Scripts // $(function() { //tooltips // mostrar_bs_tooltips(); $('.input-money').inputNumberFormat(); $('.input-un-decimal').inputNumberFormat({ 'decimal': 1 }); $('.input-integer').inputNumberFormat({ 'decimal': 0 }); }); function mostrar_bs_tooltips(){ var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { return new bootstrap.Tooltip(tooltipTriggerEl) }) } window.addEventListener('DOMContentLoaded', event => { // Toggle the side navigation const sidebarToggle = document.body.querySelector('#sidebarToggle'); if (sidebarToggle) { // Uncomment Below to persist sidebar toggle between refreshes // if (localStorage.getItem('sb|sidebar-toggle') === 'true') { // document.body.classList.toggle('sb-sidenav-toggled'); // } sidebarToggle.addEventListener('click', event => { event.preventDefault(); document.body.classList.toggle('sb-sidenav-toggled'); localStorage.setItem('sb|sidebar-toggle', document.body.classList.contains('sb-sidenav-toggled')); }); } }); function maneja_error_swalert(result) { if (typeof result === 'string' || result instanceof String){ if ((result.indexOf("error") != -1 || result.indexOf("
") != -1) && result.indexOf("errorMsg") == -1 ) { Swal.fire({ title: 'Error!', html: result, icon: 'error', allowOutsideClick: false, confirmButtonText: 'OK' }) return false; } else { var result = eval('(' + result + ')'); if (result.errorMsg) { Swal.fire({ title: 'Error!', html: result.errorMsg, icon: 'error', allowOutsideClick: false, confirmButtonText: 'OK' }) return false; } else { return true; } } } else { result = JSON.stringify(result); if ((result.indexOf("error") != -1 || result.indexOf("
") != -1) ) { Swal.fire({ title: 'Error!', html: result, icon: 'error', allowOutsideClick: false, confirmButtonText: 'OK' }) return false; } else { var result = eval('(' + result + ')'); if (result.errorMsg) { Swal.fire({ title: 'Error!', html: result.errorMsg, icon: 'error', allowOutsideClick: false, confirmButtonText: 'OK' }) return false; } else { return true; } } } } function idioma_msg(datos, texto) { if(typeof datos[texto] === "undefined"){ return texto; } else { return msg_usuario_valido = datos[texto]; } } function toast(icono, mensaje){ Swal.fire({ icon: icono, text: idioma_msg(JSON.parse($('#idioma-json').text()), mensaje), toast: true, position: 'top-right', iconColor: 'white', customClass: { popup: 'colored-toast' }, showConfirmButton: false, timer: 2500, timerProgressBar: true }) } function zoom_screen(zoom){ var zzoom = Math.round(($("body").css("zoom")*100+ Number.EPSILON) * 100) / 100; var xzoom = (zzoom + zoom); document.body.style.zoom = xzoom+'%'; $('#screen_zoom').html(xzoom+' %') //tooltips mostrar_bs_tooltips(); }