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