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   '155ca6a755e25c15ad7ce45e2f638f10' :"Displaying Companies{0} - {1} of {2}",
18   '5a787141d53b573ec9b86e900bfe0d79' :"Expire Date",
19   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
20   'e3030abfa75de4573fb37032affa11e7' :"IP Access"
21  },
22
23   part     :  ["BAdmin", "IPAccess" ],
24   order    : '006-Pman.Tab.BAdminIPAccess',
25   region   : 'center',
26   parent   : 'Pman.Tab.BAdmin',
27   name     : "unnamed module",
28   disabled : false, 
29   permname : '', 
30   _tree : function(_data)
31   {
32    var _this = this;
33    var MODULE = this;
34    return {
35    xtype : 'Nest',
36    background : true,
37    title : _this._strings['e3030abfa75de4573fb37032affa11e7'] /* IP Access */,
38    xns : Roo.bootstrap.panel,
39    '|xns' : 'Roo.bootstrap.panel',
40    layout : {
41     xtype : 'Border',
42     xns : Roo.bootstrap.layout,
43     '|xns' : 'Roo.bootstrap.layout',
44     center : {
45      xtype : 'Region',
46      tabPosition : 'top',
47      xns : Roo.bootstrap.layout,
48      '|xns' : 'Roo.bootstrap.layout'
49     },
50     items  : [
51      {
52       xtype : 'Grid',
53       closable : false,
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.table) {
64                 _this.table.footer.onClick('first');
65             }
66         },
67        render : function (_self)
68         {
69             _this.grid = _self;
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        cls : 'table-fixed',
176        hover : true,
177        loadMask : true,
178        responsive : true,
179        rowSelection : true,
180        striped : false,
181        listeners : {
182         render : function (_self)
183          {
184              _this.table = this;
185          },
186         rowclick : function (_self, el, rowIndex, e)
187          {
188              (function(){
189                  
190                  _this.edit_btn.hide();
191                  _this.delete_btn.hide();
192                  
193                  var s = _this.table.getSelectionModel().getSelected();
194                  
195                  if (!s || s.data.id * 1 < 1)  {
196                      return;
197                  }
198                  
199                  _this.edit_btn.show();
200                  _this.delete_btn.show();
201                  
202              }).defer(100);
203              
204          },
205         rowdblclick : function (_self, el, rowIndex, e)
206          {
207              var s = _this.table.store.getAt(rowIndex);
208              
209              if(!s || s.data.id * 1 < 1){
210                  return;
211              }
212              
213              Pman.Dialog.BAdminCompany.show({
214                  id : s.data.id
215              }, function() {
216                  if (_this.table) {
217                      _this.table.footer.onClick('refresh');
218                  }
219              });
220          }
221        },
222        xns : Roo.bootstrap,
223        '|xns' : 'Roo.bootstrap',
224        footer : {
225         xtype : 'PagingToolbar',
226         displayInfo : false,
227         displayMsg : _this._strings['155ca6a755e25c15ad7ce45e2f638f10'] /* Displaying Companies{0} - {1} of {2} */,
228         emptyMsg : _this._strings['fc6f97505d89fe9277965c126744647a'] /* No Companies found */,
229         name : 'footer',
230         pageSize : 25,
231         xns : Roo.bootstrap,
232         '|xns' : 'Roo.bootstrap'
233        },
234        store : {
235         xtype : 'Store',
236         remoteSort : true,
237         sortinfo : { field : 'display_name', direction: 'ASC' },
238         listeners : {
239          beforeload : function (_self, o)
240           {
241               o.params = o.params || {};
242               
243               
244           },
245          load : function (_self, records, options)
246           {
247               _this.edit_btn.hide();
248               _this.delete_btn.hide();
249           }
250         },
251         xns : Roo.data,
252         '|xns' : 'Roo.data',
253         proxy : {
254          xtype : 'HttpProxy',
255          method : 'GET',
256          url : baseURL + '/Roo/Core_ip_access.php',
257          xns : Roo.data,
258          '|xns' : 'Roo.data'
259         },
260         reader : {
261          xtype : 'JsonReader',
262          fields : [
263              {
264                  'name': 'id',
265                  'type': 'int'
266              },
267              {
268                  'name': 'created_dt',
269                  'type': 'date',
270                  'formatDate' : 'Y-m-d'
271              },
272              {
273                  'name': 'status',
274                  'type': 'int'
275              },
276              {
277                  'name': 'authorized_by',
278                  'type': 'int'
279              },
280              {
281                  'name': 'authorized_by_name',
282                  'type': 'string'
283              },
284              {
285                  'name': 'authorized_by_email',
286                  'type': 'string'
287              },
288              {
289                  'name': 'authorized_key',
290                  'type': 'string'
291              },
292              {
293                  'name': 'email',
294                  'type': 'string'
295              },
296              {
297                  'name': 'expire_dt',
298                  'type': 'date',
299                  'formatDate' : 'Y-m-d'
300              },
301              {
302                  'name': 'user_agent',
303                  'type': 'string'
304              },
305              {
306                  'name': 'updated_by',
307                  'type': 'int'
308              },
309              {
310                  'name': 'updated_by_name',
311                  'type': 'string'
312              },
313              {
314                  'name': 'updated_by_email',
315                  'type': 'string'
316              }
317              
318          ],
319          id : 'id',
320          root : 'data',
321          totalProperty : 'total',
322          xns : Roo.data,
323          '|xns' : 'Roo.data'
324         }
325        },
326        sm : {
327         xtype : 'RowSelectionModel',
328         singleSelect : true,
329         listeners : {
330          selectionchange : function (_self)
331           {
332               _this.edit_btn.hide();
333               _this.delete_btn.hide();
334               
335               if (!this.getSelected()) {
336                   return;
337               }
338               
339               _this.edit_btn.show();
340               _this.delete_btn.show();
341               
342           }
343         },
344         xns : Roo.bootstrap.Table,
345         '|xns' : 'Roo.bootstrap.Table'
346        },
347        cm : [
348         {
349          xtype : 'ColumnModel',
350          cursor : 'pointer',
351          dataIndex : 'created_dt',
352          header : _this._strings['11e8622b4aa4b1924aee81a9ec54c555'] /* Create Date */,
353          renderer : function(v,x,r) { 
354              return String.format('{0}', v ? v.format('Y-m-d') : '');
355          },
356          sortable : true,
357          xs : 2,
358          xns : Roo.grid,
359          '|xns' : 'Roo.grid'
360         },
361         {
362          xtype : 'ColumnModel',
363          cursor : 'pointer',
364          dataIndex : 'ip',
365          header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */,
366          renderer : function(v,x,r) { 
367              return String.format('{0}', 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 : 'email',
378          header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
379          renderer : function(v,x,r) 
380          { 
381              return String.format('<a href="mailto:{0}">{0}</a>', v ? v : '')
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 : 'authorized_by',
392          header : _this._strings['86f16ddf147752b95ffe69e2dfa769a1'] /* Authorized By */,
393          renderer : function(v,x,r) 
394          { 
395              if(v * 1 == 0){
396                  return '';
397              }
398              
399              return String.format('{0}', r.data.authorized_by_name);
400          },
401          sortable : true,
402          xs : 2,
403          xns : Roo.grid,
404          '|xns' : 'Roo.grid'
405         },
406         {
407          xtype : 'ColumnModel',
408          cursor : 'pointer',
409          dataIndex : 'status',
410          header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
411          renderer : function(v,x,r) 
412          {
413              v = v * 1;
414              
415              var status = 'Pending';
416              
417              switch (v) {
418                  case 1 :
419                      status = 'Approve';
420                      break;
421                  case -1 :
422                      status = 'Reject';
423                      break;
424                  case -2 :
425                      status = 'Temporary';
426                      break;
427                  default : 
428                      break;
429              }
430              
431              return String.format('{0}', status);
432              
433          },
434          sortable : true,
435          xs : 2,
436          xns : Roo.grid,
437          '|xns' : 'Roo.grid'
438         },
439         {
440          xtype : 'ColumnModel',
441          cursor : 'pointer',
442          dataIndex : 'expire_dt',
443          header : _this._strings['5a787141d53b573ec9b86e900bfe0d79'] /* Expire Date */,
444          renderer : function(v,x,r) { 
445              
446              if(r.data.status * 1 != -2){
447                  return '';
448              }
449              
450              return String.format('{0}', v ? v.format('Y-m-d') : '');
451          },
452          sortable : true,
453          xs : 2,
454          xns : Roo.grid,
455          '|xns' : 'Roo.grid'
456         }
457        ]
458       }
459      }
460     ]
461    }
462   };  }
463 });