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