/* * Codificación UTF-8 * Eventos asociados a los botones */ /* *********************************************************************************************************************** * BOTÓN BUSCAR ************************************************************************************************************************ */ $('button[data-gvhWindow='+ambito+'][data-gvhFunction=buscar]').on({ click: function(e) { console.log('gvh_boton.js - BUSCAR'); e.stopPropagation(); idForm = $(this).closest('form').attr('id'); panel = $(this).attr('data-gvhPanelOn'); claseM = $(this).attr('data-gvhClaseManejadora'); destinoLength = $(this).attr('data-gvhDestino').length; if (destinoLength <= 0) { destino = $(this).closest('form').attr('action'); } else { destino = $(this).attr('data-gvhDestino'); } claseM = $(this).attr('data-gvhClaseManejadora'); if ($(this).attr('data-gvhConfirm')) { var confirm = $(this).attr('data-gvhConfirm'); $datos = confirm.split('___'); $(this).showConfirm({ id: $(this).attr('id'), codigo: $datos[0], descBreve: desescapeIGEPjs($datos[1]), text: desescapeIGEPjs($datos[2]), btnOk: desescapeIGEPjs($datos[3]), btnCancel: desescapeIGEPjs($datos[4]), destino: destino, claseM: claseM, panel: $(this).attr('data-gvhPanelOn') }) } else { id = $('div').filter('[data-gvhCWSource=CWFilter]').attr('id'); if ((id != undefined)) { $('#'+id).getRulesFilter({ idFilter: id, claseM: claseM, panel: panel }) } $(this).controllerJS({ id: $(this).attr('id'), panel: panel, destino: destino, newWindow: $(this).attr('data-gvhNewWindow'), confirm: $(this).attr('data-gvhConfirm'), claseM: claseM, message: 'buscar' }); } } }) /* *********************************************************************************************************************** * BOTÓN GUARDAR ************************************************************************************************************************ */ $('button[data-gvhFunction=guardar][data-gvhWindow='+ambito+']').on({ click: function(e) { console.log('gvh_boton.js - GUARDAR'); e.stopPropagation(); accionActivaP = 'accionActivaP_'+$(this).closest('form').attr('id'); modo = $('#'+accionActivaP).val(); panel = $(this).attr('data-gvhPanelOn'); idGuardar = $(this).attr('id'); claseManejadora = $(this).attr('data-gvhClaseManejadora'); estadoPanel = $('#P_'+panel).attr('data-gvhestadopanel'); //estadoPanel = datosJSON[claseManejadora][panel]['panel']['modo']; destinoLength = $(this).attr('data-gvhDestino').length; if (destinoLength > 0) { destino = $(this).attr('data-gvhDestino'); } else { destino = $(this).closest('form').attr('action'); } // comprobar solamente los de las filas a insertar fields = $(this).fieldsRequired({ id : idGuardar, panel : panel, estadoPanel : estadoPanel, claseM : claseManejadora }); if (fields != '') { $(this).showMessage('gvhlang_msj901','alert',fields); } else { // FALTA data-gvhConfirm con JSON var confirm = $(this).attr('data-gvhConfirm'); if ((confirm != '') && (confirm != undefined)) { destinoCancelar = $(this).attr('data-gvhConfirmCancel'); $datos = confirm.split('___'); $(this).showConfirm({ id: idGuardar, codigo: $datos[0], descBreve: desescapeIGEPjs($datos[1]), text: desescapeIGEPjs($datos[2]), btnOk: desescapeIGEPjs($datos[3]), btnCancel: desescapeIGEPjs($datos[4]), destino: destino, destinoNO: destinoCancelar, claseM: claseManejadora, panel: panel }) } else { $(this).controllerJS({ id: idGuardar, panel: panel, destino: destino, newWindow: 'false', confirm: '', claseM: claseManejadora, message: 'guardar' }) } } } }); /* *********************************************************************************************************************** * BOTÓN CANCELAR ************************************************************************************************************************ */ $('button[data-gvhFunction=cancelar][data-gvhWindow='+ambito+']').on({ click: function(e) { console.log('gvh_boton.js - CANCELAR'); e.stopPropagation(); var panel = $(this).attr('data-gvhPanelOn'); var formulario = $(this).closest('form'); // Cambiamos el estado de bloqueo de salida del panel $('div[id=P_'+panel+'][data-gvhWindow='+ambito+']').attr('data-gvhestadopanel','R'); $('#capa_menuFalso').hide(); $('#capa_menuReal').show(); modificado = panel+'_imgModificado'; $('#'+modificado).hide(); var destino = $(this).attr('data-gvhDestino'); if ((destino != 'cancelar') && (destino != '')) { destino = $(this).attr('data-gvhDestino'); $(this).controllerJS({ id: $(this).attr('id'), panel: panel, destino: destino, newWindow: $(this).attr('data-gvhNewWindow'), confirm: $(this).attr('data-gvhConfirm'), claseM: $(this).attr('data-gvhClaseManejadora'), message: 'cancelar' }) } else { $(this).loading({ message: 'Cancelando...' }); setTimeout('window.top.location.reload()', 100); } } }); /* *********************************************************************************************************************** * BOTÓN VOLVER ************************************************************************************************************************ */ $('button[data-gvhFunction=volver][data-gvhWindow='+ambito+']').on({ click: function(e) { console.log('gvh_boton.js - VOLVER'); e.stopPropagation(); $(this).controllerJS({ id: $(this).attr('id'), panel: $(this).attr('data-gvhPanelOn'), destino: $(this).attr('data-gvhDestino'), newWindow: $(this).attr('data-gvhNewWindow'), confirm: $(this).attr('data-gvhConfirm'), claseM: $(this).attr('data-gvhClaseManejadora'), message: 'volver' }) } }); /* *********************************************************************************************************************** * BOTÓN SALTAR ************************************************************************************************************************ */ $('button[data-gvhFunction=saltar][data-gvhWindow='+ambito+']').on({ click: function(e) { console.log('gvh_boton.js - SALTAR'); e.stopPropagation(); $(this).controllerJS({ id: $(this).attr('id'), panel: $(this).attr('data-gvhPanelOn'), destino: $(this).attr('data-gvhDestino'), newWindow: $(this).attr('data-gvhNewWindow'), confirm: $(this).attr('data-gvhConfirm'), claseM: $(this).attr('data-gvhClaseManejadora'), message: 'cargar' }) } }); /* *********************************************************************************************************************** * BOTÓN LISTAR ************************************************************************************************************************ */ $('button[data-gvhFunction=listar][data-gvhWindow='+ambito+']').on({ click: function(e) { console.log('gvh_boton.js - LISTAR'); e.stopPropagation(); $(this).controllerJS({ id: $(this).attr('id'), panel: $(this).attr('data-gvhPanelOn'), destino: $(this).attr('data-gvhDestino'), newWindow: $(this).attr('data-gvhNewWindow'), confirm: $(this).attr('data-gvhConfirm'), claseM: $(this).attr('data-gvhClaseManejadora'), message: 'cargar' }) } }); /* *********************************************************************************************************************** * BOTÓN PARTICULAR ************************************************************************************************************************ */ $('button[data-gvhFunction=particular][data-gvhWindow='+ambito+']').not('[class=btnToolTip]').on({ click: function(e) { console.log('gvh_boton.js - PARTICULAR'); console.log(datosJSON); e.stopPropagation(); className = $(this).attr('class'); if (className != 'btnTooltip') { if ($(this).attr('data-gvhConfirm')) { var confirm = $(this).attr('data-gvhConfirm'); $datos = confirm.split('___'); $(this).showConfirm({ id: $(this).attr('id'), codigo: $datos[0], descBreve: desescapeIGEPjs($datos[1]), text: desescapeIGEPjs($datos[2]), btnOk: desescapeIGEPjs($datos[3]), btnCancel: desescapeIGEPjs($datos[4]), destino: $(this).attr('data-gvhDestino'), claseM: $(this).attr('data-gvhClaseManejadora'), panel: $(this).attr('data-gvhPanelOn') }) } else { $(this).controllerJS({ id: $(this).attr('id'), panel: $(this).attr('data-gvhPanelOn'), destino: $(this).attr('data-gvhDestino'), newWindow: $(this).attr('data-gvhNewWindow'), confirm: $(this).attr('data-gvhConfirm'), claseM: $(this).attr('data-gvhClaseManejadora'), message: 'cargar' }) } } } }); /* * BOTÓN CANCELAR DE VENTANA DE SELECCIӓN */ $('button[data-gvhFunction=cancelarvs][data-gvhWindow='+ambito+']').on({ click: function(e) { e.stopPropagation(); var panel = $(this).attr('data-gvhPanelOn'); var formulario = $(this).closest('form'); if ($(this).attr('data-gvhConfirm')) { var confirm = $(this).attr('data-gvhConfirm'); $datos = confirm.split('___'); $(this).showConfirm({ id: $(this).attr('id'), codigo: $datos[0], descBreve: desescapeIGEPjs($datos[1]), text: desescapeIGEPjs($datos[2]), btnOk: desescapeIGEPjs($datos[3]), btnCancel: desescapeIGEPjs($datos[4]), destino: $(this).attr('data-gvhDestino'), claseM: $(this).attr('data-gvhClaseManejadora') }) } else { dialogWS.dialog("destroy").remove(); } } }); /* * BOTÓN ACEPTAR DE VENTANA DE SELECCIӓN */ $('button[data-gvhFunction=aceptarvs][data-gvhWindow='+ambito+']').on({ click: function(e) { e.stopPropagation(); console.log($(this).attr('id')); var panel = $(this).attr('data-gvhPanelOn'); var formulario = $(this).closest('form'); if ($(this).attr('data-gvhConfirm')) { var confirm = $(this).attr('data-gvhConfirm'); //$datos = confirm.split('/'); $datos = confirm.split('___'); $(this).showConfirm({ id: $(this).attr('id'), codigo: $datos[0], descBreve: desescapeIGEPjs($datos[1]), text: desescapeIGEPjs($datos[2]), btnOk: desescapeIGEPjs($datos[3]), btnCancel: desescapeIGEPjs($datos[4]), destino: $(this).attr('data-gvhDestino'), claseM: $(this).attr('data-gvhClaseManejadora') }) } else { var destino = $(this).attr('data-gvhDestino'); var fieldsWS = $(this).attr('data-gvhFieldsWS').split(','); var fieldsSource = $(this).attr('data-gvhFieldsSource').split(','); var action = $('#actionOrigen').val(); var panel = $(this).attr('data-gvhPanelOn'); id = $('input:radio[name=vsRadio]:checked').attr('id'); if (id == undefined) { $.getJSON(urlLang, function(data) { var cod = desescapeIGEPjs(data['gvhlang_msj16']['cod']); var title = desescapeIGEPjs(data['gvhlang_msj16']['title']); var descrip = desescapeIGEPjs(data['gvhlang_msj16']['descr']); }) .done(function(){ alertify.suggest(cod,title,descrip); }) } else { fila = id.split('_')[2]; // check_Tabla1_1 modoPanel = $(this).attr('data-gvhModoPanelOn'); $(this).okWS({ actionOrigen: action, fila: fila, panel: panel, fieldsSource: fieldsSource, fieldsWS: fieldsWS, modoPanel: modoPanel, claseMO: $(this).attr('data-gvhClaseMOrigen') }); } } } });