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.store.load({});
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        store : {
209         xtype : 'Store',
210         remoteSort : true,
211         sortinfo : { field : 'display_name', direction: 'ASC' },
212         listeners : {
213          beforeload : function (_self, o)
214           {
215               o.params = o.params || {};
216               
217               
218           },
219          load : function (_self, records, options)
220           {
221               _this.edit_btn.hide();
222               _this.delete_btn.hide();
223           }
224         },
225         xns : Roo.data,
226         '|xns' : 'Roo.data',
227         proxy : {
228          xtype : 'HttpProxy',
229          method : 'GET',
230          url : baseURL + '/Roo/Core_ip_access.php',
231          xns : Roo.data,
232          '|xns' : 'Roo.data'
233         },
234         reader : {
235          xtype : 'JsonReader',
236          fields : [
237              {
238                  'name': 'id',
239                  'type': 'int'
240              },
241              {
242                  'name': 'created_dt',
243                  'type': 'date',
244                  'formatDate' : 'Y-m-d'
245              },
246              {
247                  'name': 'status',
248                  'type': 'int'
249              },
250              {
251                  'name': 'authorized_by',
252                  'type': 'int'
253              },
254              {
255                  'name': 'authorized_by_name',
256                  'type': 'string'
257              },
258              {
259                  'name': 'authorized_by_email',
260                  'type': 'string'
261              },
262              {
263                  'name': 'authorized_key',
264                  'type': 'string'
265              },
266              {
267                  'name': 'email',
268                  'type': 'string'
269              },
270              {
271                  'name': 'expire_dt',
272                  'type': 'date',
273                  'formatDate' : 'Y-m-d'
274              },
275              {
276                  'name': 'user_agent',
277                  'type': 'string'
278              },
279              {
280                  'name': 'updated_by',
281                  'type': 'int'
282              },
283              {
284                  'name': 'updated_by_name',
285                  'type': 'string'
286              },
287              {
288                  'name': 'updated_by_email',
289                  'type': 'string'
290              }
291              
292          ],
293          id : 'id',
294          root : 'data',
295          totalProperty : 'total',
296          xns : Roo.data,
297          '|xns' : 'Roo.data'
298         }
299        },
300        sm : {
301         xtype : 'RowSelectionModel',
302         singleSelect : true,
303         listeners : {
304          selectionchange : function (_self)
305           {
306               _this.edit_btn.hide();
307               _this.delete_btn.hide();
308               
309               if (!this.getSelected()) {
310                   return;
311               }
312               
313               _this.edit_btn.show();
314               _this.delete_btn.show();
315               
316           }
317         },
318         xns : Roo.bootstrap.Table,
319         '|xns' : 'Roo.bootstrap.Table'
320        },
321        cm : [
322         {
323          xtype : 'ColumnModel',
324          cursor : 'pointer',
325          dataIndex : 'created_dt',
326          header : _this._strings['11e8622b4aa4b1924aee81a9ec54c555'] /* Create Date */,
327          renderer : function(v,x,r) { 
328              return String.format('{0}', v ? v.format('Y-m-d') : '');
329          },
330          sortable : true,
331          xs : 2,
332          xns : Roo.grid,
333          '|xns' : 'Roo.grid'
334         },
335         {
336          xtype : 'ColumnModel',
337          cursor : 'pointer',
338          dataIndex : 'ip',
339          header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */,
340          renderer : function(v,x,r) { 
341              return String.format('{0}', v ? v : '');
342          },
343          sortable : true,
344          xs : 2,
345          xns : Roo.grid,
346          '|xns' : 'Roo.grid'
347         },
348         {
349          xtype : 'ColumnModel',
350          cursor : 'pointer',
351          dataIndex : 'email',
352          header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
353          renderer : function(v,x,r) 
354          { 
355              return String.format('<a href="mailto:{0}">{0}</a>', v ? v : '')
356          },
357          sortable : true,
358          xs : 2,
359          xns : Roo.grid,
360          '|xns' : 'Roo.grid'
361         },
362         {
363          xtype : 'ColumnModel',
364          cursor : 'pointer',
365          dataIndex : 'authorized_by',
366          header : _this._strings['86f16ddf147752b95ffe69e2dfa769a1'] /* Authorized By */,
367          renderer : function(v,x,r) 
368          { 
369              if(v * 1 == 0){
370                  return '';
371              }
372              
373              return String.format('{0}', r.data.authorized_by_name);
374          },
375          sortable : true,
376          xs : 2,
377          xns : Roo.grid,
378          '|xns' : 'Roo.grid'
379         },
380         {
381          xtype : 'ColumnModel',
382          cursor : 'pointer',
383          dataIndex : 'status',
384          header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
385          renderer : function(v,x,r) 
386          {
387              v = v * 1;
388              
389              var status = 'Pending';
390              
391              switch (v) {
392                  case 1 :
393                      status = 'Approve';
394                      break;
395                  case -1 :
396                      status = 'Reject';
397                      break;
398                  case -2 :
399                      status = 'Temporary';
400                      break;
401                  default : 
402                      break;
403              }
404              
405              return String.format('{0}', status);
406              
407          },
408          sortable : true,
409          xs : 2,
410          xns : Roo.grid,
411          '|xns' : 'Roo.grid'
412         },
413         {
414          xtype : 'ColumnModel',
415          cursor : 'pointer',
416          dataIndex : 'expire_dt',
417          header : _this._strings['5a787141d53b573ec9b86e900bfe0d79'] /* Expire Date */,
418          renderer : function(v,x,r) { 
419              
420              if(r.data.status * 1 != -2){
421                  return '';
422              }
423              
424              return String.format('{0}', v ? v.format('Y-m-d') : '');
425          },
426          sortable : true,
427          xs : 2,
428          xns : Roo.grid,
429          '|xns' : 'Roo.grid'
430         }
431        ]
432       }
433      }
434     ]
435    }
436   };  }
437 });