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