PHP8
[Pman.BAdmin] / Pman.Tab.BAdminIPAccess.js
index 60b12b1..81b391e 100644 (file)
@@ -7,21 +7,27 @@ Roo.namespace('Pman.Tab');
 Pman.Tab.BAdminIPAccess = new Roo.XComponent({
 
  _strings : {
-  'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
-  '0eceeb45861f9585dd7a97a3e36f85c6' :"Created",
+  'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
+  '86f16ddf147752b95ffe69e2dfa769a1' :"Authorized By",
+  'ec53a8c4f07baed5d8825072c89799be' :"Status",
   '7dce122004969d56ae2e0245cb754d35' :"Edit",
-  '01abfc750a0c942167651c40d088531d' :"#",
+  'fc6f97505d89fe9277965c126744647a' :"No Companies found",
+  '11e8622b4aa4b1924aee81a9ec54c555' :"Create Date",
   'a12a3079e14ced46e69ba52b8a90b21a' :"IP",
-  'dae8ace18bdcbcc6ae5aece263e14fe8' :"Options",
+  '155ca6a755e25c15ad7ce45e2f638f10' :"Displaying Companies{0} - {1} of {2}",
+  '5a787141d53b573ec9b86e900bfe0d79' :"Expire Date",
   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
-  '4d3d769b812b6faa6b76e1a8abaece2d' :"Active",
   'e3030abfa75de4573fb37032affa11e7' :"IP Access"
  },
+ _named_strings : {
+  'footer_displayMsg' : '155ca6a755e25c15ad7ce45e2f638f10' /* Displaying Companies{0} - {1} of {2} */ ,
+  'footer_emptyMsg' : 'fc6f97505d89fe9277965c126744647a' /* No Companies found */ 
+ },
 
   part     :  ["BAdmin", "IPAccess" ],
   order    : '006-Pman.Tab.BAdminIPAccess',
   region   : 'center',
-  parent   : false,
+  parent   : 'Pman.Tab.BAdmin',
   name     : "unnamed module",
   disabled : false, 
   permname : '', 
@@ -49,24 +55,23 @@ Pman.Tab.BAdminIPAccess = new Roo.XComponent({
     items  : [
      {
       xtype : 'Grid',
-      background : false,
-      fitContainer : true,
+      closable : false,
       fitToFrame : true,
       region : 'center',
-      title : _this._strings['dae8ace18bdcbcc6ae5aece263e14fe8'] /* Options */,
+      title : _this._strings['e3030abfa75de4573fb37032affa11e7'] /* IP Access */,
       listeners : {
        activate : function (_self)
         {
             _this.edit_btn.hide();
             _this.delete_btn.hide();
             
-            if (_this.option_grid) {
-                _this.option_grid.store.load({});
+            if (_this.table) {
+                _this.table.footer.onClick('first');
             }
         },
        render : function (_self)
         {
-            _this.option_panel = _self;
+            _this.grid = _self;
         }
       },
       xns : Roo.bootstrap.panel,
@@ -99,38 +104,57 @@ Pman.Tab.BAdminIPAccess = new Roo.XComponent({
                items  : [
                 {
                  xtype : 'Column',
-                 md : 12,
+                 md : 3,
                  xns : Roo.bootstrap,
                  '|xns' : 'Roo.bootstrap',
                  items  : [
                   {
-                   xtype : 'Button',
-                   cls : 'roo-toolbar-button',
-                   glyphicon : 'plus',
-                   html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
-                   weight : 'default',
+                   xtype : 'ComboBox',
+                   allowBlank : false,
+                   displayField : 'value',
+                   editable : false,
+                   hiddenName : 'status',
+                   mode : 'local',
+                   name : 'status_name',
+                   tpl : '<div class=\"roo-select2-result\"><b>{value}</b></div>',
+                   triggerAction : 'all',
+                   valueField : 'code',
                    listeners : {
-                    click : function (_self, e)
+                    render : function (_self)
                      {
-                         var sel = _this.type_grid.getSelectionModel().getSelected();
+                         _this.status = this;
                          
-                         if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length ){
-                             Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');
-                             return;
-                         }
-                     
-                         Pman.Dialog.BAdminCoreEnum.show({ 
-                             id : 0,
-                             etype : sel.data.name
-                         }, function(res) {
-                             _this.option_grid.store.load({});
-                         });
-                     
+                         this.setValue(0);
+                     },
+                    select : function (combo, record, index)
+                     {
+                         _this.table.footer.onClick('first'); 
                      }
                    },
                    xns : Roo.bootstrap,
-                   '|xns' : 'Roo.bootstrap'
-                  },
+                   '|xns' : 'Roo.bootstrap',
+                   store : {
+                    xtype : 'SimpleStore',
+                    data : [
+                        ['0', 'Pending'],
+                        ['1', 'Approve'],
+                        ['-2', 'Temporary'],
+                        ['-1', 'Reject']
+                    ],
+                    fields : [ 'code', 'value' ],
+                    xns : Roo.data,
+                    '|xns' : 'Roo.data'
+                   }
+                  }
+                 ]
+                },
+                {
+                 xtype : 'Column',
+                 md : 9,
+                 style : 'text-align: right;',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap',
+                 items  : [
                   {
                    xtype : 'Button',
                    cls : 'roo-toolbar-button',
@@ -140,17 +164,17 @@ Pman.Tab.BAdminIPAccess = new Roo.XComponent({
                    listeners : {
                     click : function (_self, e)
                      {
-                         var sel = _this.option_grid.getSelectionModel().getSelected();
+                         var sel = _this.table.getSelectionModel().getSelected();
                          
                          if(!sel || sel.data.id * 1 < 1){
-                             Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');
+                             Roo.bootstrap.MessageBox.alert('Error', 'Please select a row');
                              return;
                          }
                      
-                         Pman.Dialog.BAdminCoreEnum.show({ 
+                         Pman.Dialog.BAdminIPAccess.show({ 
                              id : sel.data.id
                          }, function(res) {
-                             _this.option_grid.store.load({});
+                             _this.table.store.load({});
                          });
                      
                      },
@@ -173,23 +197,7 @@ Pman.Tab.BAdminIPAccess = new Roo.XComponent({
                    listeners : {
                     click : function (_self, e)
                      {
-                         var sel = _this.option_grid.getSelectionModel().getSelected();
-                         
-                         if(!sel || sel.data.id * 1 < 1){
-                             Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');
-                             return;
-                         }
-                     
-                         new Pman.Request({
-                             url: baseURL + '/Roo/Core_enum.php',
-                             method : 'POST',
-                             params : {
-                                 _delete : sel.data.id
-                             }, 
-                             success : function(res) {
-                                 _this.option_grid.store.load({});
-                             }
-                         });
+                         Pman.genericDelete(_this.grid, 'core_ip_access'); 
                      
                      },
                     render : function (_self)
@@ -216,91 +224,65 @@ Pman.Tab.BAdminIPAccess = new Roo.XComponent({
       },
       grid : {
        xtype : 'Table',
-       cellSelection : true,
        cls : 'table-fixed',
-       footerShow : false,
        hover : true,
        loadMask : true,
-       responsive : true,
        rowSelection : true,
-       striped : true,
+       striped : false,
        listeners : {
-        cellclick : function (_self, el, rowIndex, columnIndex, e)
-         {
-             var di = _this.option_grid.colModel.getDataIndex(columnIndex);
-             
-             if (di != 'active') {
-                 return;
-             }
-              
-             var rec = _this.option_grid.store.getAt(rowIndex);
-             
-             rec.set('active', rec.data.active ? 0 : 1);
-             
-             rec.commit();
-         },
         render : function (_self)
          {
-             _this.option_grid = _self; 
-         
+             _this.table = this;
          },
         rowdblclick : function (_self, el, rowIndex, e)
          {
-             var sel = _this.option_grid.store.getAt(rowIndex);
+             var s = _this.table.store.getAt(rowIndex);
              
-             if(!sel || sel.data.id * 1 < 1){
+             if(!s || s.data.id * 1 < 1){
                  return;
              }
              
-             Pman.Dialog.BAdminCoreEnum.show({ 
-                 id : sel.data.id
+             Pman.Dialog.BAdminIPAccess.show({ 
+                 id : s.data.id
              }, function(res) {
-                 _this.option_grid.store.load({});
+                 _this.table.footer.onClick('first');
              });
-             
          }
        },
        xns : Roo.bootstrap,
        '|xns' : 'Roo.bootstrap',
+       footer : {
+        xtype : 'PagingToolbar',
+        displayInfo : false,
+        displayMsg : _this._strings['155ca6a755e25c15ad7ce45e2f638f10'] /* Displaying Companies{0} - {1} of {2} */,
+        emptyMsg : _this._strings['fc6f97505d89fe9277965c126744647a'] /* No Companies found */,
+        name : 'footer',
+        pageSize : 25,
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       },
        store : {
         xtype : 'Store',
         remoteSort : true,
-        sortinfo : { field : 'display_name', direction: 'ASC' },
+        sortInfo : { field : 'display_name', direction: 'ASC' },
         listeners : {
          beforeload : function (_self, o)
           {
+               if (!Pman.buildCompleted) {
+                  return false;
+              }
+          
               o.params = o.params || {};
               
+              var status = _this.status.getValue() * 1;
+              
+              o.params.status = status;
               
           },
          load : function (_self, records, options)
           {
               _this.edit_btn.hide();
               _this.delete_btn.hide();
-          },
-         update : function (_self, record, operation)
-          {
-              if (operation != 'commit') {
-                  return;
-              }
-          
-              new Pman.Request({
-                  url : baseURL + '/Roo/Core_enum',
-                  method :'POST',
-                  params : {
-                      id : record.data.id,
-                      active: record.data.active
-                  },
-                  success : function() {
-          
-                  },
-                  failure : function() 
-                  {
-                      Roo.bootstrap.MessageBox.alert("Error", "saving failed", function() {
-                          _this.grid.footer.onClick('first');
-                      });
-                  }
-              });
           }
         },
         xns : Roo.data,
@@ -358,15 +340,15 @@ Pman.Tab.BAdminIPAccess = new Roo.XComponent({
                  'type': 'string'
              },
              {
-                 'name': 'authorized_by',
+                 'name': 'updated_by',
                  'type': 'int'
              },
              {
-                 'name': 'authorized_by_name',
+                 'name': 'updated_by_name',
                  'type': 'string'
              },
              {
-                 'name': 'authorized_by_email',
+                 'name': 'updated_by_email',
                  'type': 'string'
              }
              
@@ -403,53 +385,108 @@ Pman.Tab.BAdminIPAccess = new Roo.XComponent({
         {
          xtype : 'ColumnModel',
          cursor : 'pointer',
-         dataIndex : 'id',
-         header : _this._strings['01abfc750a0c942167651c40d088531d'] /* # */,
-         renderer : function(v,x,r) 
-         {
-             return String.format('{0}', v ? v : '');
+         dataIndex : 'created_dt',
+         header : _this._strings['11e8622b4aa4b1924aee81a9ec54c555'] /* Create Date */,
+         renderer : function(v,x,r) { 
+             return String.format('{0}', v ? v.format('Y-m-d') : '');
          },
          sortable : true,
+         xs : 2,
          xns : Roo.grid,
          '|xns' : 'Roo.grid'
         },
         {
          xtype : 'ColumnModel',
          cursor : 'pointer',
-         dataIndex : 'created_dt',
-         header : _this._strings['0eceeb45861f9585dd7a97a3e36f85c6'] /* Created */,
+         dataIndex : 'ip',
+         header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */,
          renderer : function(v,x,r) { 
              return String.format('{0}', v ? v : '');
          },
          sortable : true,
+         xs : 2,
          xns : Roo.grid,
          '|xns' : 'Roo.grid'
         },
         {
          xtype : 'ColumnModel',
          cursor : 'pointer',
-         dataIndex : 'ip',
-         header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */,
-         renderer : function(v,x,r) { 
-             return String.format('{0}', v ? v : '');
+         dataIndex : 'email',
+         header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
+         renderer : function(v,x,r) 
+         { 
+             return String.format('<a href="mailto:{0}">{0}</a>', v ? v : '')
          },
          sortable : true,
+         xs : 2,
          xns : Roo.grid,
          '|xns' : 'Roo.grid'
         },
         {
          xtype : 'ColumnModel',
          cursor : 'pointer',
-         dataIndex : 'active',
-         header : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
-         md : 2,
+         dataIndex : 'authorized_by',
+         header : _this._strings['86f16ddf147752b95ffe69e2dfa769a1'] /* Authorized By */,
+         renderer : function(v,x,r) 
+         { 
+             if(v * 1 == 0){
+                 return '';
+             }
+             
+             return String.format('{0}', r.data.authorized_by_name);
+         },
+         sortable : true,
+         xs : 2,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         cursor : 'pointer',
+         dataIndex : 'status',
+         header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
+         renderer : function(v,x,r) 
+         {
+             v = v * 1;
+             
+             var status = 'Pending';
+             
+             switch (v) {
+                 case 1 :
+                     status = 'Approve';
+                     break;
+                 case -1 :
+                     status = 'Reject';
+                     break;
+                 case -2 :
+                     status = 'Temporary';
+                     break;
+                 default : 
+                     break;
+             }
+             
+             return String.format('{0}', status);
+             
+         },
+         sortable : true,
+         xs : 2,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         cursor : 'pointer',
+         dataIndex : 'expire_dt',
+         header : _this._strings['5a787141d53b573ec9b86e900bfe0d79'] /* Expire Date */,
          renderer : function(v,x,r) { 
-             var state = v > 0 ?  '-checked' : '';
-         
-             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+             
+             if(r.data.status * 1 != -2){
+                 return '';
+             }
+             
+             return String.format('{0}', v ? v.format('Y-m-d') : '');
          },
-         sm : 2,
-         sortable : false,
+         sortable : true,
          xs : 2,
          xns : Roo.grid,
          '|xns' : 'Roo.grid'