Advertisement
MX37S

mostusuarios.jsp

Aug 9th, 2021
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 15.83 KB | None | 0 0
  1. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  2.     <html>
  3.     <head>
  4.         <link rel="shortcut icon" href="${ctx}/images/favicon.ico" type="image/x-icon">
  5.         <style type="text/css">
  6.             .accept {
  7.                 background-image: url(./resources/extjs/resources/images/default/icons/fam/accept.png) !important;
  8.             }
  9.             .delete {
  10.                 background-image: url(./resources/extjs/resources/images/default/icons/fam/delete.png) !important;
  11.             }
  12.         </style>
  13.  
  14.         <link rel="stylesheet" type="text/css" href="./resources/extjs/resources/css/ext-all.css">
  15.         <link rel="stylesheet" type="text/css" href="./resources/extjs/resources/css/ext-tca.css">
  16.         <link rel="stylesheet" type="text/css" href="./resources/extjs/ux/gridfilters/css/GridFilters.css">
  17.         <link rel="stylesheet" type="text/css" href="./resources/extjs/ux/gridfilters/css/RangeMenu.css">
  18.  
  19.  
  20.         <script type="text/javascript" src="./resources/extjs/adapter/ext/ext-base.js"></script>
  21.         <script type="text/javascript" src="./resources/extjs/ext-all.js"></script>
  22.         <script type="text/javascript" src="./resources/extjs/locale/ext-lang-es.js"></script>
  23.  
  24.         <script type="text/javascript" src="./resources/extjs/ux/gridfilters/GridFilters.js"></script>
  25.         <script type="text/javascript" src="./resources/extjs/ux/gridfilters/menu/RangeMenu.js"></script>
  26.         <script type="text/javascript" src="./resources/extjs/ux/gridfilters/menu/ListMenu.js"></script>
  27.         <script type="text/javascript" src="./resources/extjs/ux/gridfilters/filter/Filter.js"></script>
  28.         <script type="text/javascript" src="./resources/extjs/ux/gridfilters/filter/StringFilter.js"></script>
  29.         <script type="text/javascript" src="./resources/extjs/ux/gridfilters/filter/DateFilter.js"></script>
  30.         <script type="text/javascript" src="./resources/extjs/ux/gridfilters/filter/ListFilter.js"></script>
  31.         <script type="text/javascript" src="./resources/extjs/ux/gridfilters/filter/NumericFilter.js"></script>
  32.         <script type="text/javascript" src="./resources/extjs/ux/gridfilters/filter/BooleanFilter.js"></script>
  33.         <script type="text/javascript" src="./js/UsuariosServicesGrid.js"></script>
  34.         <link rel="shortcut icon" href="./images/favicon.ico" type="image/x-icon" />
  35.  
  36.         <script type="text/javascript">
  37.  
  38.             Ext.BLANK_IMAGE_URL = './resources/extjs/resources/images/default/s.gif';
  39.             Ext.ns('Ext.ux');
  40.  
  41.             Ext.onReady(function () {
  42.  
  43.                 var win;
  44.                 var rolAutog;
  45.                 var rolAutogRest;
  46.                 var rolFe;
  47.                 var scliSeleccionado;
  48.                 var cuit;
  49.  
  50.                 Ext.QuickTips.init();
  51.  
  52.                 var grid = new Ext.ux.UsuariosServicesGrid({
  53.                     renderTo: 'grid',
  54.                     width: 1000,
  55.                     height: 400,
  56.                     style: 'text-align: left;',
  57.                     title: 'Detalle de Usuarios',
  58.                     aprobar: function () {
  59.                         if (this.getSelectionModel().hasSelection()) {
  60.                             var record = this.getSelectionModel().getSelected();
  61.  
  62.                             // llamar a una fx para recuperar el user seleccionado y traer la lista de roles
  63.                             showDataAccept(record);
  64.                             //  recuperarRoles();
  65.                             //  var params = {id: record.get('id')}
  66.                             //  ajaxReq('./usuarios-aprobar.html', params, 'Usuario aprobado con &eacute;xito');
  67.  
  68.                         } else {
  69.                             Ext.Msg.show({
  70.                                 title: 'AVISO',
  71.                                 msg: 'Debe seleccionar un usuario',
  72.                                 buttons: Ext.Msg.OK,
  73.                                 icon: Ext.Msg.WARNING,
  74.                                 width: 350
  75.                             });
  76.                         }
  77.                     }
  78.  
  79.                     ,desaprobar: function () {
  80.                         if (this.getSelectionModel().hasSelection()) {
  81.                             var record = this.getSelectionModel().getSelected();
  82.                             showDataDecline(record);
  83.                         } else {
  84.                             Ext.Msg.show({
  85.                                 title: 'AVISO',
  86.                                 msg: 'Debe seleccionar un usuario',
  87.                                 buttons: Ext.Msg.OK,
  88.                                 icon: Ext.Msg.WARNING,
  89.                                 width: 350
  90.                             });
  91.                         }
  92.                     }
  93.                    
  94.                 });
  95.  
  96.                 var store = grid.getStore();
  97.                 store.load({
  98.                     params: {
  99.                         start: 0,
  100.                         limit: 15
  101.                     },
  102.                     callback: loaded
  103.                 });
  104.  
  105.                 function loaded(r, options, success) {
  106.                     if (!success) {
  107.                         Ext.Msg.show({
  108.                             title: 'ERROR'
  109.                             , msg: 'Error buscando datos'
  110.                             , modal: true
  111.                             , icon: Ext.Msg.ERROR
  112.                             , buttons: Ext.Msg.OK
  113.                             , width: 350
  114.                         });
  115.                         return;
  116.                     }
  117.                     if (this.getCount() == 0) {
  118.                         Ext.Msg.show({
  119.                             title: 'AVISO',
  120.                             msg: 'No hay usuarios pendientes ',
  121.                             buttons: Ext.Msg.OK,
  122.                             icon: Ext.Msg.WARNING,
  123.                             width: 350
  124.                         });
  125.                     }
  126.                 }
  127.  
  128.                 function ajaxReq(url, params, successMsg) {
  129.                     var msg = Ext.MessageBox.wait('Procesando...');
  130.                     Ext.Ajax.request({
  131.                         url: url,
  132.                         method: 'POST',
  133.                         params: params,
  134.                         success: function (response) {
  135.                             msg.hide();
  136.                             var result = Ext.decode(response.responseText);
  137.                             if (result.success) {
  138.                                 if (url == './usuarios-desaprobar.html'){
  139.                                     Ext.Msg.show({
  140.                                         title: 'CONFIRMACION',
  141.                                         msg: successMsg,
  142.                                         buttons: Ext.Msg.OK,
  143.                                         icon: Ext.Msg.INFO,
  144.                                         fn: function(){location.reload()},
  145.                                         width: 350
  146.                                     });
  147.                                 }
  148.                                 else{
  149.                                     Ext.Msg.show({
  150.                                         title: 'CONFIRMACION',
  151.                                         msg: successMsg,
  152.                                         buttons: Ext.Msg.OK,
  153.                                         icon: Ext.Msg.INFO,
  154.                                         fn: redirect,
  155.                                         width: 350
  156.                                     });
  157.                                 }
  158.                             } else {
  159.                                 Ext.Msg.show({
  160.                                     title: 'ERROR',
  161.                                     msg: result.errors.code,
  162.                                     buttons: Ext.Msg.OK,
  163.                                     icon: Ext.Msg.ERROR,
  164.                                     width: 350
  165.                                 });
  166.                             }
  167.                         },
  168.                         failure: function () {
  169.                             msg.hide();
  170.                             Ext.Msg.show({
  171.                                 title: 'ERROR'
  172.                                 , msg: 'Error procesando datos'
  173.                                 , modal: true
  174.                                 , icon: Ext.Msg.ERROR
  175.                                 , buttons: Ext.Msg.OK
  176.                             });
  177.                         }
  178.                     });
  179.                 }
  180.  
  181.                 function showDataAccept(record) {
  182.  
  183.                     if (!win) {
  184.                         rolSeleccionado = null;
  185.                         scliSeleccionado = null;
  186.                         var u_id = record.get('id');
  187.                         var u_usuario = record.get('userName');
  188.                         var u_nombre = record.get('nombre');
  189.                         var u_apellido = record.get('apellido');
  190.                         var u_email = record.get('email');
  191.                         var u_numeroDocumento = record.get('tpo_Nro_Documento');
  192.                         //aca armo el panel    
  193.  
  194.                         var form = new Ext.form.FormPanel({
  195.  
  196.                             border: false,
  197.                             frame: true,
  198.                             width: 1000,
  199.                             height: 400,
  200.                             bodyPadding: 20,
  201.                             fieldDefaults: {
  202.                                 labelAlign: 'top',
  203.                                 labelWidth: 300,
  204.                                 labelStyle: 'font-weight:bold'
  205.                             },
  206.                             defaults: {
  207.                                 margins: '20 0 20 0'
  208.                             },
  209.                             items: [{
  210.                                 xtype: 'displayfield',
  211.                                 name: 'displayfield1',
  212.                                 fieldLabel: 'Usuario',
  213.                                 value: '<span style="color:blue;">' + u_usuario + '</span>'
  214.                             }, {
  215.                                 xtype: 'displayfield',
  216.                                 name: 'displayfield2',
  217.                                 fieldLabel: 'Nombre',
  218.                                 value: '<span style="color:blue;">' + u_nombre + '</span>'
  219.                             }, {
  220.                                 xtype: 'displayfield',
  221.                                 name: 'displayfield3',
  222.                                 fieldLabel: 'Apellido',
  223.                                 value: '<span style="color:blue;">' + u_apellido + '</span>'
  224.                             }, {
  225.                                 xtype: 'displayfield',
  226.                                 name: 'displayfield4',
  227.                                 fieldLabel: 'Email',
  228.                                 value: '<span style="color:blue;">' + u_email + '</span>'
  229.                             }, {
  230.                                 xtype: 'displayfield',
  231.                                 name: 'displayfield5',
  232.                                 fieldLabel: 'Documento',
  233.                                 value: '<span style="color:blue;">' + u_numeroDocumento + '</span>'
  234.                             }, {
  235.  
  236.                                 xtype: 'checkboxgroup',
  237.                                 fieldLabel: 'Roles',
  238.                                 columns: 3,
  239.                                 allowBlank: false,
  240.                                 itemId: 'Roles',
  241.                                 bodyPadding: 10,
  242.                                 items: [
  243.                                     {
  244.                                         xtype: 'checkbox',
  245.                                         boxLabel: 'Autogestion',
  246.                                         name: 'autogestion',
  247.                                         checked: true,
  248.                                         inputValue: '14',
  249.                                         id: 'autogestion'
  250.  
  251.                                     }, {
  252.                                         xtype: 'checkbox',
  253.                                         boxLabel: 'Restringido',
  254.                                         name: 'restringido',
  255.                                         inputValue: '38',
  256.                                         id: 'restringido'
  257.                                     }, {
  258.                                         xtype: 'checkbox',
  259.                                         boxLabel: 'Factura Electronica',
  260.                                         name: 'fe',
  261.                                         inputValue: '57',
  262.                                         id: 'fe',
  263.                                         handler: function () {
  264.                                             if (Ext.getCmp('fe').checked) {
  265.                                                 Ext.getCmp('cuit').enable();
  266.                                                 Ext.getCmp('botonCuit').enable();
  267.                                                 Ext.getCmp('confirmar').disable();
  268.                                             } else {
  269.                                                 Ext.getCmp('cuit').disable();
  270.                                                 Ext.getCmp('botonCuit').disable();
  271.                                                 Ext.getCmp('confirmar').enable();
  272.                                             }
  273.  
  274.                                         }
  275.                                     }
  276.  
  277.                                 ]
  278.                             }, {
  279.  
  280.                                 xtype: 'container',
  281.                                 layout: 'hbox',
  282.                                 fieldLabel: 'Cuit Cliente',
  283.                                 id: 'containerCuit',
  284.  
  285.                                 items: [{
  286.                                     xtype: 'textfield',
  287.                                     width: 200,
  288.                                     id: 'cuit',
  289.                                     allowBlank: false
  290.                                 }, {
  291.                                     xtype: 'button',
  292.                                     text: 'Buscar',
  293.                                     id: 'botonCuit',
  294.                                     handler: function () {
  295.                                         cuit = document.getElementById("cuit");
  296.                                         if (cuit.value.length > 0 && cuit.value.length == 11) {
  297.  
  298.                                             cuit = cuit.value;
  299.                                             var paramCuit = { cuit: cuit };
  300.                                             var respuesta = ajaxReqCliente('./buscarCliente.html', paramCuit, 'Cliente encontrado');
  301.                                             Ext.getCmp('confirmar').enable();
  302.                                         } else {
  303.                                             Ext.getCmp('confirmar').disable();
  304.                                             Ext.Msg.show({
  305.                                                 title: 'ERROR',
  306.                                                 //   msg: result.errors.code,
  307.                                                 msg: 'Verifique la longitud del Cuit ingresado',
  308.                                                 buttons: Ext.Msg.OK,
  309.                                                 icon: Ext.Msg.ERROR,
  310.                                                 width: 350
  311.                                             });
  312.  
  313.                                         }
  314.                                     }
  315.                                 }]
  316.  
  317.                             }, {
  318.  
  319.                                 xtype: 'container',
  320.                                 layout: 'hbox',
  321.                                 fieldLabel: 'Nombre Cliente',
  322.                                 id: 'containerNombre',
  323.                                 disabled: true,
  324.                                 items: [{
  325.                                     xtype: 'textfield',
  326.                                     width: 200,
  327.                                     id: 'nombre',
  328.                                     style: { textTransform: "uppercase" },
  329.  
  330.                                     /*         TODO: Esto se usaria si necesitamos buscar por nombre y que traiga una lista
  331.                                     },{
  332.                                                 xtype: 'button',
  333.                                                 text: 'Buscar',
  334.                                                 handler: function() {
  335.                                                                          
  336.                                                    var nombre = document.getElementById("nombre").value;
  337.                                                    var paramNombre = {nombre: nombre};
  338.                                                    var respuesta=ajaxReqCliente('./buscarCliente.html', paramNombre, 'Cliente encontrado');
  339.                                                     }    */
  340.  
  341.                                 }]
  342.  
  343.                             }
  344.  
  345.                             ]
  346.                         });
  347.  
  348.                         //aca lo confirma                      
  349.  
  350.                         var win = new Ext.Window({
  351.                             title: 'Ud. va a procesar la aprobaci&oacute;n del siguiente usuario'
  352.                             , modal: true
  353.                             , resizable: false
  354.                             , closable: false
  355.                             , width: 400
  356.                             , height: 350
  357.                             , items: form
  358.                             , renderTo: Ext.getBody()
  359.                             , layout: 'fit',
  360.                             buttons: [{
  361.                                 text: 'Confirmar',
  362.                                 id: 'confirmar',
  363.                                 handler: function () {
  364.  
  365.                                     var params = { id: record.get('id') };
  366.  
  367.  
  368.                                     if (document.getElementById("autogestion").checked) {
  369.                                         rolAutog = document.getElementById("autogestion").value;
  370.                                         params.rolAutog = rolAutog;
  371.                                     }
  372.  
  373.                                     if (document.getElementById("restringido").checked) {
  374.                                         rolAutogRest = document.getElementById("restringido").value;
  375.                                         params.rolAutogRest = rolAutogRest;
  376.                                     }
  377.  
  378.                                     if (document.getElementById("fe").checked) {
  379.                                         rolFe = document.getElementById("fe").value;
  380.                                         params.rolFe = rolFe;
  381.                                         params.scli = scliSeleccionado;
  382.                                     }
  383.  
  384.                                     var respuesta = ajaxReq('./usuarios-aprobar.html', params, 'Usuario aprobado con &eacute;xito');
  385.                                 }
  386.  
  387.                             }, {
  388.                                 text: 'Cancelar',
  389.                                 handler: function () {
  390.                                     win.close();
  391.                                 }
  392.                             }]
  393.                         });
  394.  
  395.  
  396.                     }
  397.                     Ext.getCmp('cuit').disable();
  398.                     Ext.getCmp('botonCuit').disable();
  399.  
  400.                     win.show();
  401.                 }
  402.  
  403.                 function showDataDecline(record){
  404.                     if (!win) {
  405.                         rolSeleccionado = null;
  406.                         scliSeleccionado = null;
  407.                         var u_id = record.get('id');
  408.                         var u_usuario = record.get('userName');
  409.                         var u_nombre = record.get('nombre');
  410.                         var u_apellido = record.get('apellido');
  411.                         var u_email = record.get('email');
  412.                         var u_numeroDocumento = record.get('tpo_Nro_Documento');
  413.                         //aca armo el panel    
  414.  
  415.                         var form = new Ext.form.FormPanel({
  416.  
  417.                             border: false,
  418.                             frame: true,
  419.                             width: 1000,
  420.                             height: 400,
  421.                             bodyPadding: 20,
  422.                             fieldDefaults: {
  423.                                 labelAlign: 'top',
  424.                                 labelWidth: 300,
  425.                                 labelStyle: 'font-weight:bold'
  426.                             },
  427.                             defaults: {
  428.                                 margins: '20 0 20 0'
  429.                             },
  430.                             items: [{
  431.                                 xtype: 'displayfield',
  432.                                 name: 'displayfield1',
  433.                                 fieldLabel: 'Usuario',
  434.                                 value: '<span style="color:blue;">' + u_usuario + '</span>'
  435.                             }, {
  436.                                 xtype: 'displayfield',
  437.                                 name: 'displayfield2',
  438.                                 fieldLabel: 'Nombre',
  439.                                 value: '<span style="color:blue;">' + u_nombre + '</span>'
  440.                             }, {
  441.                                 xtype: 'displayfield',
  442.                                 name: 'displayfield3',
  443.                                 fieldLabel: 'Apellido',
  444.                                 value: '<span style="color:blue;">' + u_apellido + '</span>'
  445.                             }, {
  446.                                 xtype: 'displayfield',
  447.                                 name: 'displayfield4',
  448.                                 fieldLabel: 'Email',
  449.                                 value: '<span style="color:blue;">' + u_email + '</span>'
  450.                             }, {
  451.                                 xtype: 'displayfield',
  452.                                 name: 'displayfield5',
  453.                                 fieldLabel: 'Documento',
  454.                                 value: '<span style="color:blue;">' + u_numeroDocumento + '</span>'
  455.                             }
  456.                         ]
  457.                         });
  458.  
  459.                         //aca lo desaprueba                
  460.                         var win = new Ext.Window({
  461.                             title: 'Ud. va a procesar la DESAPROBACI&Oacute;N del siguiente usuario'
  462.                             , modal: true
  463.                             , resizable: false
  464.                             , closable: false
  465.                             , width: 400
  466.                             , height: 200
  467.                             , items: form
  468.                             , renderTo: Ext.getBody()
  469.                             , layout: 'fit',
  470.                             buttons: [{
  471.                                 text: 'Confirmar',
  472.                                 id: 'confirmar',
  473.                                 handler: function () {
  474.                                     var params = { id: record.get('id') };
  475.                                     var respuesta = ajaxReq('./usuarios-desaprobar.html', params, 'Usuario desaprobado con &eacute;xito');
  476.                                 }
  477.  
  478.                             }, {
  479.                                 text: 'Cancelar',
  480.                                 handler: function () {
  481.                                     win.close();
  482.                                 }
  483.                             }]
  484.                         });
  485.                     }
  486.  
  487.                     win.show();
  488.                 }
  489.  
  490.                 function redirect() {
  491.                     var record = grid.getSelectionModel().getSelected();
  492.                     var url = '/autogestion/tca-autogestion-web/admin/gestionarCliente.html?COD_GESTOR=' + record.get('userName') + '&aprobado=OK';
  493.                     document.location.href = url;
  494.                 }
  495.  
  496.                 function ajaxReqCliente(url, params, successMsg) {
  497.                     var msg = Ext.MessageBox.wait('Buscando...');
  498.                     Ext.Ajax.request({
  499.                         url: url,
  500.                         method: 'POST',
  501.                         params: params,
  502.                         success: function (response) {
  503.                             msg.hide();
  504.                             var result = Ext.decode(response.responseText);
  505.                             if (result.success) {
  506.                                 //vino un solo objeto
  507.                                 //   alert(result.data.numeroDocumento);
  508.                                 //      alert(result.data.nombre);
  509.                                 document.getElementById("nombre").value = result.data.nombre;
  510.                                 scliSeleccionado = result.data.scli;
  511.  
  512.                             } else {
  513.                                 Ext.Msg.show({
  514.                                     title: 'ERROR',
  515.                                     //   msg: result.errors.code,
  516.                                     msg: 'Error al buscar el cliente',
  517.                                     buttons: Ext.Msg.OK,
  518.                                     icon: Ext.Msg.ERROR,
  519.                                     width: 350
  520.                                 });
  521.                             }
  522.                         },
  523.                         failure: function () {
  524.                             msg.hide();
  525.                             Ext.Msg.show({
  526.                                 title: 'ERROR'
  527.                                 , msg: 'Error procesando datos'
  528.                                 , modal: true
  529.                                 , icon: Ext.Msg.ERROR
  530.                                 , buttons: Ext.Msg.OK
  531.                             });
  532.                         }
  533.                     });
  534.                 }
  535.                 /*  function validateCuit(value) {
  536.                      if(cuit.value.length > 0 && cuit.value.length == 11 ){
  537.                          return true;
  538.                      }else{
  539.                          return false;
  540.                      }
  541.                        
  542.                     } */
  543.             });
  544.  
  545.         </script>
  546.     </head>
  547.  
  548.     <body>
  549.         <div id="grid" align="center"></div>
  550.     </body>
  551.  
  552.     </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement