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