var gvh = gvh || {}; +function($){ 'use strict'; $(".gvhModal").on('load', function () { alert('The modal is fully shown.'); }); $(document).ready(function() { gvh.orderTable = gvh.getUrlParameter('orderTable'); gvh.orderFieldTable = gvh.getUrlParameter('orderField'); // // TODO : Revisar para opción de cargar dinámicamente javascript: // // * https://stackoverflow.com/questions/11803215/how-to-include-multiple-js-files-using-jquery-getscript-method // /** * Muestra una alerta al usuario indicando que hay cambios pendientes de guardar/cancelar. */ gvh.showAlertaCambiosPendientes = function() { if( gvh.showMessage ) { gvh.showMessage( 'gvhlang_msjUI', 'alert' ); } } /** * Permite maximizar/restaurar un panel */ gvh.resizePanel = function(e) { e.preventDefault(); e.stopImmediatePropagation(); var $this = $(this); if( $this.hasClass('glyphicon-resize-full') ) { $this.removeClass( 'glyphicon-resize-full' ); $this.addClass( 'glyphicon-resize-small' ); } else if( $this.hasClass('glyphicon-resize-small') ) { $this.removeClass( 'glyphicon-resize-small' ); $this.addClass( 'glyphicon-resize-full' ); } $(this).closest('.panel').toggleClass( 'panel-fullscreen' ); } gvh.initModal = function(idVentana) { $('[data-toggle="popover"]').each(function () { $(this).popover({ trigger: 'manual', html: true, content: function() { $(this).attr('data-content').html() } }); }) } gvh.initTypeFields = function() { gvh.showConsoleMsg('log', ' - Inicializando tipos...' ); $('select[data-gvhAutocomplete=true][data-gvhWindow='+ambito+']').each(function (e) { gvh.showConsoleMsg('log', ' - Inicializando select2 '+$(this).attr('id') ); let params = gvh.configParamsSelect2($(this)); $(this).select2(params); }); $('input[data-gvhtypedata=numeric][data-gvhWindow='+ambito+']').each(function (e) { // PARA CUANDO SE CREE LA TPL DEL CAMPO DE TEXTO gvh.showConsoleMsg('log', ' - Inicializando numérico '+$(this).attr('id') ); //$(this).inputmask(); }); $('input[data-gvhTypeData=float][data-gvhWindow='+ambito+']').each(function (e) { // PARA CUANDO SE CREE LA TPL DEL CAMPO DE TEXTO gvh.showConsoleMsg('log', ' - Inicializando numérico flotante '+$(this).attr('id') ); /*$(this).inputmask({ 'alias': 'decimal', 'rightAlign': true, 'groupSeparator': '.', 'radixPoint': ',', 'autoGroup': true });*/ }); } /** * Permite maximizar/restaurar una ventana modal */ gvh.resizeModal = function(e) { e.preventDefault(); e.stopImmediatePropagation(); $('#gvhPage').toggleClass( 'modal-fullscreen' ); } gvh.rewirePage_onready = function() { var uiRewire = gvh.rewireUI; var ar = gvh.rewireUI; for (var i = 0,len = ar.length; i < len; i++) { var nameFuncion = ar[i]['funcion']; gvh.showConsoleMsg('log', ' ... actualización de la interfaz de la clase manejadora '+ar[i]['clase'] ); if ( jQuery.isFunction( nameFuncion ) && (nameFuncion != undefined)) { nameFuncion(); } } } /** * Para resolver las recargas de página en gvHidra. * Debe contener toda funcionalidad que deba ser inicializada expresamente, * y debe invocarse tras regenerar una página (especialmente si se destruye el * cuerpo/main de la página. */ gvh.rewireMain = function() { console.groupCollapsed('gvh_onready : gvh.rewireMain'); // Inicializamos la barra de progreso Pace.start(); gvh.initTypeFields(); if (gvh.orderFieldTable != undefined) { $('[data-gvhFunction=orderTable][id*=order_'+gvh.orderFieldTable+']').css({"color": "rgb(210, 0, 0)"}); gvh.showConsoleMsg('log', ' - orderTable : '+gvh.orderFieldTable+' orden '+gvh.orderTable ); if (gvh.orderTable == 'asc') { $('span[id=arrowOrder_'+gvh.orderFieldTable+']').addClass('fa-caret-up'); $('span[id=arrowOrder_'+gvh.orderFieldTable+']').removeClass('fa-caret-down'); $('span[id=arrowOrder_'+gvh.orderFieldTable+']').removeClass('arrowIni'); } else { $('span[id=arrowOrder_'+gvh.orderFieldTable+']').addClass('fa-caret-down'); $('span[id=arrowOrder_'+gvh.orderFieldTable+']').removeClass('fa-caret-up'); $('span[id=arrowOrder_'+gvh.orderFieldTable+']').removeClass('arrowIni'); } //$('span[id=arrowOrder_'+gvh.orderFieldTable+']').show(); } // // Activamos tooltips de bootstrap (+ gvHidra) // if ($.fn.tooltip) { gvh.showConsoleMsg('log', ' - tooltip : Inicializando...' ); $('[data-toggle="tooltip"]').tooltip(); $('.gvh-tooltip').tooltip(); $('[data-toggle="popover"]').each(function () { $(this).popover({ trigger: 'manual', html: true, content: function() { $(this).attr('data-content').html() } }); }) } else if(gvh.DEBUG) { console.warn( 'gvh_onready : WARNING : $.fn.tooltip no disponible' ); if(gvh.STOPONWARNING) { debugger; } } // // Activamos el menú principal // if ($.fn.dropdown) { gvh.showConsoleMsg('log', ' - gvh_menu : Inicializando menú principal...' ); $('#gvhHeader .dropdown-toggle').dropdown(); } else if(gvh.DEBUG) { gvh.showConsoleMsg('warn','gvh_onready : WARNING : $.fn.dropdown no disponible' ); if(gvh.STOPONWARNING) { debugger; } } // // Activamos los submenús para el menú principal // // For v2 [data-toggle="dropdown"] is required for [data-submenu]. // For v2 .dropdown-submenu > [data-toggle="dropdown"] is forbidden. if ($.fn.submenupicker) { gvh.showConsoleMsg('log', ' - gvh_menu : Inicializando submenús...' ); $('#gvhHeader [data-submenu]').submenupicker(); } else if(gvh.DEBUG) { gvh.showConsoleMsg('warn','gvh_onready : WARNING : $.fn.submenupicker no disponible' ); //if(gvh.STOPONWARNING) { debugger; } } // // Permite maximizar/restaurar un panel // if (gvh.resizePanel) { gvh.showConsoleMsg('log', ' - gvh_resizePanel : Inicializando...' ); $('#gvhPage').offon( 'click', '[data-toggle="panel-fullscreen"]', gvh.resizePanel ); } else if(gvh.DEBUG) { gvh.showConsoleMsg('warn','gvh_onready : WARNING : gvh.resizePanel no disponible' ); if(gvh.STOPONWARNING) { debugger; } } // // Permite maximizar/restaurar una ventana modal // if (gvh.resizeModal) { gvh.showConsoleMsg('log', ' - gvh_resizeModal : Inicializando...' ); $('#gvhPage').offon( 'click', '[data-toggle="modal-fullscreen"]', gvh.resizeModal ); } else if(gvh.DEBUG) { gvh.showConsoleMsg('warn','gvh_onready : WARNING : gvh.resizeModal no disponible' ); if(gvh.STOPONWARNING) { debugger; } } // // Activamos el menú lateral // if (gvh.collapseSidebarBranch) { $('#gvhPage').offon('hidden.bs.collapse', '#gvhSidebar ul.collapse', gvh.collapseSidebarBranch); } else if(gvh.DEBUG) { gvh.showConsoleMsg('warn','gvh_onready : WARNING : gvh.activateSidebarToggler no disponible' ); //if(gvh.STOPONWARNING) { debugger; } } if (gvh.activateSidebarToggler) { gvh.showConsoleMsg('log', ' - gvh_side-bar : Enlazando gvh.activateSidebarToggler ...' ); $('#gvhPage').offon('click', '#gvhSidebar-toggler', gvh.activateSidebarToggler); } else if(gvh.DEBUG) { gvh.showConsoleMsg('warn','gvh_onready : WARNING : gvh.activateSidebarToggler no disponible' ); //if(gvh.STOPONWARNING) { debugger; } } if (gvh.determineSidebar) { gvh.showConsoleMsg('log', ' - gvh_side-bar : Enlazando gvh.determineSidebar ...' ); $(window).bind("load resize", gvh.determineSidebar); } else if(gvh.DEBUG) { gvh.showConsoleMsg('warn','gvh_onready : WARNING : gvh.determineSidebar no disponible' ); //if(gvh.STOPONWARNING) { debugger; } } /* if (gvh.calculateContentMinHeight) { gvh.showConsoleMsg('log', ' - gvh_side-bar : Enlazando calculateContentMinHeight ...' ); $(window).bind("load resize scroll", function () { gvh.calculateContentMinHeight(); }); } else if(gvh.DEBUG) { gvh.showConsoleMsg('warn','gvh_onready : WARNING : gvh.calculateContentMinHeight no disponible' ); if(gvh.STOPONWARNING) { debugger; } } */ if( gvh.rewirePage_onready ) { gvh.rewirePage_onready(); } else if(gvh.DEBUG) { gvh.showConsoleMsg('warn','gvh_onready : WARNING : gvh.rewirePage no disponible' ); if(gvh.STOPONWARNING) { debugger; } } console.groupEnd(); } if( gvh.rewireMain ) { gvh.rewireMain(); } else if(gvh.DEBUG) { gvh.showConsoleMsg('warn','gvh_onready : WARNING : gvh.rewireMain no disponible' ); if(gvh.STOPONWARNING) { debugger; } } }); }(jQuery);