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