PHP8
[Pman.BAdmin] / Pman.Tab.BAdminIPAccess.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.BAdminIPAccess = new Roo.XComponent({
8
9  _strings : {
10   'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
11   '86f16ddf147752b95ffe69e2dfa769a1' :"Authorized By",
12   'ec53a8c4f07baed5d8825072c89799be' :"Status",
13   '7dce122004969d56ae2e0245cb754d35' :"Edit",
14   'fc6f97505d89fe9277965c126744647a' :"No Companies found",
15   '11e8622b4aa4b1924aee81a9ec54c555' :"Create Date",
16   'a12a3079e14ced46e69ba52b8a90b21a' :"IP",
17   '155ca6a755e25c15ad7ce45e2f638f10' :"Displaying Companies{0} - {1} of {2}",
18   '5a787141d53b573ec9b86e900bfe0d79' :"Expire Date",
19   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
20   'e3030abfa75de4573fb37032affa11e7' :"IP Access"
21  },
22  _named_strings : {
23   'footer_displayMsg' : '155ca6a755e25c15ad7ce45e2f638f10' /* Displaying Companies{0} - {1} of {2} */ ,
24   'footer_emptyMsg' : 'fc6f97505d89fe9277965c126744647a' /* No Companies found */ 
25  },
26
27   part     :  ["BAdmin", "IPAccess" ],
28   order    : '006-Pman.Tab.BAdminIPAccess',
29   region   : 'center',
30   parent   : 'Pman.Tab.BAdmin',
31   name     : "unnamed module",
32   disabled : false, 
33   permname : '', 
34   _tree : function(_data)
35   {
36    var _this = this;
37    var MODULE = this;
38    return {
39    xtype : 'Nest',
40    background : true,
41    title : _this._strings['e3030abfa75de4573fb37032affa11e7'] /* IP Access */,
42    xns : Roo.bootstrap.panel,
43    '|xns' : 'Roo.bootstrap.panel',
44    layout : {
45     xtype : 'Border',
46     xns : Roo.bootstrap.layout,
47     '|xns' : 'Roo.bootstrap.layout',
48     center : {
49      xtype : 'Region',
50      hideTabs : true,
51      tabPosition : 'top',
52      xns : Roo.bootstrap.layout,
53      '|xns' : 'Roo.bootstrap.layout'
54     },
55     items  : [
56      {
57       xtype : 'Grid',
58       closable : false,
59       fitToFrame : true,
60       region : 'center',
61       title : _this._strings['e3030abfa75de4573fb37032affa11e7'] /* IP Access */,
62       listeners : {
63        activate : function (_self)
64         {
65             _this.edit_btn.hide();
66             _this.delete_btn.hide();
67             
68             if (_this.table) {
69                 _this.table.footer.onClick('first');
70             }
71         },
72        render : function (_self)
73         {
74             _this.grid = _self;
75         }
76       },
77       xns : Roo.bootstrap.panel,
78       '|xns' : 'Roo.bootstrap.panel',
79       toolbar : {
80        xtype : 'NavSimplebar',
81        xns : Roo.bootstrap,
82        '|xns' : 'Roo.bootstrap',
83        items  : [
84         {
85          xtype : 'NavGroup',
86          xns : Roo.bootstrap,
87          '|xns' : 'Roo.bootstrap',
88          items  : [
89           {
90            xtype : 'NavItem',
91            xns : Roo.bootstrap,
92            '|xns' : 'Roo.bootstrap',
93            items  : [
94             {
95              xtype : 'Element',
96              xns : Roo.bootstrap,
97              '|xns' : 'Roo.bootstrap',
98              items  : [
99               {
100                xtype : 'Row',
101                cls : 'roo-toolbar',
102                xns : Roo.bootstrap,
103                '|xns' : 'Roo.bootstrap',
104                items  : [
105                 {
106                  xtype : 'Column',
107                  md : 3,
108                  xns : Roo.bootstrap,
109                  '|xns' : 'Roo.bootstrap',
110                  items  : [
111                   {
112                    xtype : 'ComboBox',
113                    allowBlank : false,
114                    displayField : 'value',
115                    editable : false,
116                    hiddenName : 'status',
117                    mode : 'local',
118                    name : 'status_name',
119                    tpl : '<div class=\"roo-select2-result\"><b>{value}</b></div>',
120                    triggerAction : 'all',
121                    valueField : 'code',
122                    listeners : {
123                     render : function (_self)
124                      {
125                          _this.status = this;
126                          
127                          this.setValue(0);
128                      },
129                     select : function (combo, record, index)
130                      {
131                          _this.table.footer.onClick('first'); 
132                      }
133                    },
134                    xns : Roo.bootstrap,
135                    '|xns' : 'Roo.bootstrap',
136                    store : {
137                     xtype : 'SimpleStore',
138                     data : [
139                         ['0', 'Pending'],
140                         ['1', 'Approve'],
141                         ['-2', 'Temporary'],
142                         ['-1', 'Reject']
143                     ],
144                     fields : [ 'code', 'value' ],
145                     xns : Roo.data,
146                     '|xns' : 'Roo.data'
147                    }
148                   }
149                  ]
150                 },
151                 {
152                  xtype : 'Column',
153                  md : 9,
154                  style : 'text-align: right;',
155                  xns : Roo.bootstrap,
156                  '|xns' : 'Roo.bootstrap',
157                  items  : [
158                   {
159                    xtype : 'Button',
160                    cls : 'roo-toolbar-button',
161                    glyphicon : 'edit',
162                    html : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
163                    weight : 'default',
164                    listeners : {
165                     click : function (_self, e)
166                      {
167                          var sel = _this.table.getSelectionModel().getSelected();
168                          
169                          if(!sel || sel.data.id * 1 < 1){
170                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a row');
171                              return;
172                          }
173                      
174                          Pman.Dialog.BAdminIPAccess.show({ 
175                              id : sel.data.id
176                          }, function(res) {
177                              _this.table.store.load({});
178                          });
179                      
180                      },
181                     render : function (_self)
182                      {
183                          _this.edit_btn = this;
184                          
185                          this.hide();
186                      }
187                    },
188                    xns : Roo.bootstrap,
189                    '|xns' : 'Roo.bootstrap'
190                   },
191                   {
192                    xtype : 'Button',
193                    cls : 'roo-toolbar-button',
194                    glyphicon : 'trash',
195                    html : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
196                    weight : 'primary',
197                    listeners : {
198                     click : function (_self, e)
199                      {
200                          Pman.genericDelete(_this.grid, 'core_ip_access'); 
201                      
202                      },
203                     render : function (_self)
204                      {
205                          _this.delete_btn = this;
206                          
207                          this.hide();
208                      }
209                    },
210                    xns : Roo.bootstrap,
211                    '|xns' : 'Roo.bootstrap'
212                   }
213                  ]
214                 }
215                ]
216               }
217              ]
218             }
219            ]
220           }
221          ]
222         }
223        ]
224       },
225       grid : {
226        xtype : 'Table',
227        cls : 'table-fixed',
228        hover : true,
229        loadMask : true,
230        rowSelection : true,
231        striped : false,
232        listeners : {
233         render : function (_self)
234          {
235              _this.table = this;
236          },
237         rowdblclick : function (_self, el, rowIndex, e)
238          {
239              var s = _this.table.store.getAt(rowIndex);
240              
241              if(!s || s.data.id * 1 < 1){
242                  return;
243              }
244              
245              Pman.Dialog.BAdminIPAccess.show({ 
246                  id : s.data.id
247              }, function(res) {
248                  _this.table.footer.onClick('first');
249              });
250          }
251        },
252        xns : Roo.bootstrap,
253        '|xns' : 'Roo.bootstrap',
254        footer : {
255         xtype : 'PagingToolbar',
256         displayInfo : false,
257         displayMsg : _this._strings['155ca6a755e25c15ad7ce45e2f638f10'] /* Displaying Companies{0} - {1} of {2} */,
258         emptyMsg : _this._strings['fc6f97505d89fe9277965c126744647a'] /* No Companies found */,
259         name : 'footer',
260         pageSize : 25,
261         xns : Roo.bootstrap,
262         '|xns' : 'Roo.bootstrap'
263        },
264        store : {
265         xtype : 'Store',
266         remoteSort : true,
267         sortInfo : { field : 'display_name', direction: 'ASC' },
268         listeners : {
269          beforeload : function (_self, o)
270           {
271                if (!Pman.buildCompleted) {
272                   return false;
273               }
274           
275               o.params = o.params || {};
276               
277               var status = _this.status.getValue() * 1;
278               
279               o.params.status = status;
280               
281           },
282          load : function (_self, records, options)
283           {
284               _this.edit_btn.hide();
285               _this.delete_btn.hide();
286           }
287         },
288         xns : Roo.data,
289         '|xns' : 'Roo.data',
290         proxy : {
291          xtype : 'HttpProxy',
292          method : 'GET',
293          url : baseURL + '/Roo/Core_ip_access.php',
294          xns : Roo.data,
295          '|xns' : 'Roo.data'
296         },
297         reader : {
298          xtype : 'JsonReader',
299          fields : [
300              {
301                  'name': 'id',
302                  'type': 'int'
303              },
304              {
305                  'name': 'created_dt',
306                  'type': 'date',
307                  'formatDate' : 'Y-m-d'
308              },
309              {
310                  'name': 'status',
311                  'type': 'int'
312              },
313              {
314                  'name': 'authorized_by',
315                  'type': 'int'
316              },
317              {
318                  'name': 'authorized_by_name',
319                  'type': 'string'
320              },
321              {
322                  'name': 'authorized_by_email',
323                  'type': 'string'
324              },
325              {
326                  'name': 'authorized_key',
327                  'type': 'string'
328              },
329              {
330                  'name': 'email',
331                  'type': 'string'
332              },
333              {
334                  'name': 'expire_dt',
335                  'type': 'date',
336                  'formatDate' : 'Y-m-d'
337              },
338              {
339                  'name': 'user_agent',
340                  'type': 'string'
341              },
342              {
343                  'name': 'updated_by',
344                  'type': 'int'
345              },
346              {
347                  'name': 'updated_by_name',
348                  'type': 'string'
349              },
350              {
351                  'name': 'updated_by_email',
352                  'type': 'string'
353              }
354              
355          ],
356          id : 'id',
357          root : 'data',
358          totalProperty : 'total',
359          xns : Roo.data,
360          '|xns' : 'Roo.data'
361         }
362        },
363        sm : {
364         xtype : 'RowSelectionModel',
365         singleSelect : true,
366         listeners : {
367          selectionchange : function (_self)
368           {
369               _this.edit_btn.hide();
370               _this.delete_btn.hide();
371               
372               if (!this.getSelected()) {
373                   return;
374               }
375               
376               _this.edit_btn.show();
377               _this.delete_btn.show();
378               
379           }
380         },
381         xns : Roo.bootstrap.Table,
382         '|xns' : 'Roo.bootstrap.Table'
383        },
384        cm : [
385         {
386          xtype : 'ColumnModel',
387          cursor : 'pointer',
388          dataIndex : 'created_dt',
389          header : _this._strings['11e8622b4aa4b1924aee81a9ec54c555'] /* Create Date */,
390          renderer : function(v,x,r) { 
391              return String.format('{0}', v ? v.format('Y-m-d') : '');
392          },
393          sortable : true,
394          xs : 2,
395          xns : Roo.grid,
396          '|xns' : 'Roo.grid'
397         },
398         {
399          xtype : 'ColumnModel',
400          cursor : 'pointer',
401          dataIndex : 'ip',
402          header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */,
403          renderer : function(v,x,r) { 
404              return String.format('{0}', v ? v : '');
405          },
406          sortable : true,
407          xs : 2,
408          xns : Roo.grid,
409          '|xns' : 'Roo.grid'
410         },
411         {
412          xtype : 'ColumnModel',
413          cursor : 'pointer',
414          dataIndex : 'email',
415          header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
416          renderer : function(v,x,r) 
417          { 
418              return String.format('<a href="mailto:{0}">{0}</a>', v ? v : '')
419          },
420          sortable : true,
421          xs : 2,
422          xns : Roo.grid,
423          '|xns' : 'Roo.grid'
424         },
425         {
426          xtype : 'ColumnModel',
427          cursor : 'pointer',
428          dataIndex : 'authorized_by',
429          header : _this._strings['86f16ddf147752b95ffe69e2dfa769a1'] /* Authorized By */,
430          renderer : function(v,x,r) 
431          { 
432              if(v * 1 == 0){
433                  return '';
434              }
435              
436              return String.format('{0}', r.data.authorized_by_name);
437          },
438          sortable : true,
439          xs : 2,
440          xns : Roo.grid,
441          '|xns' : 'Roo.grid'
442         },
443         {
444          xtype : 'ColumnModel',
445          cursor : 'pointer',
446          dataIndex : 'status',
447          header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
448          renderer : function(v,x,r) 
449          {
450              v = v * 1;
451              
452              var status = 'Pending';
453              
454              switch (v) {
455                  case 1 :
456                      status = 'Approve';
457                      break;
458                  case -1 :
459                      status = 'Reject';
460                      break;
461                  case -2 :
462                      status = 'Temporary';
463                      break;
464                  default : 
465                      break;
466              }
467              
468              return String.format('{0}', status);
469              
470          },
471          sortable : true,
472          xs : 2,
473          xns : Roo.grid,
474          '|xns' : 'Roo.grid'
475         },
476         {
477          xtype : 'ColumnModel',
478          cursor : 'pointer',
479          dataIndex : 'expire_dt',
480          header : _this._strings['5a787141d53b573ec9b86e900bfe0d79'] /* Expire Date */,
481          renderer : function(v,x,r) { 
482              
483              if(r.data.status * 1 != -2){
484                  return '';
485              }
486              
487              return String.format('{0}', v ? v.format('Y-m-d') : '');
488          },
489          sortable : true,
490          xs : 2,
491          xns : Roo.grid,
492          '|xns' : 'Roo.grid'
493         }
494        ]
495       }
496      }
497     ]
498    }
499   };  }
500 });