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   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
11   '0eceeb45861f9585dd7a97a3e36f85c6' :"Created",
12   '7dce122004969d56ae2e0245cb754d35' :"Edit",
13   '01abfc750a0c942167651c40d088531d' :"#",
14   'a12a3079e14ced46e69ba52b8a90b21a' :"IP",
15   'dae8ace18bdcbcc6ae5aece263e14fe8' :"Options",
16   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
17   '4d3d769b812b6faa6b76e1a8abaece2d' :"Active",
18   'e3030abfa75de4573fb37032affa11e7' :"IP Access"
19  },
20
21   part     :  ["BAdmin", "IPAccess" ],
22   order    : '006-Pman.Tab.BAdminIPAccess',
23   region   : 'center',
24   parent   : false,
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['dae8ace18bdcbcc6ae5aece263e14fe8'] /* Options */,
57       listeners : {
58        activate : function (_self)
59         {
60             _this.edit_btn.hide();
61             _this.delete_btn.hide();
62             
63             if (_this.option_grid) {
64                 _this.option_grid.store.load({});
65             }
66         },
67        render : function (_self)
68         {
69             _this.option_panel = _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 : 'plus',
110                    html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
111                    weight : 'default',
112                    listeners : {
113                     click : function (_self, e)
114                      {
115                          var sel = _this.type_grid.getSelectionModel().getSelected();
116                          
117                          if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length ){
118                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');
119                              return;
120                          }
121                      
122                          Pman.Dialog.BAdminCoreEnum.show({ 
123                              id : 0,
124                              etype : sel.data.name
125                          }, function(res) {
126                              _this.option_grid.store.load({});
127                          });
128                      
129                      }
130                    },
131                    xns : Roo.bootstrap,
132                    '|xns' : 'Roo.bootstrap'
133                   },
134                   {
135                    xtype : 'Button',
136                    cls : 'roo-toolbar-button',
137                    glyphicon : 'edit',
138                    html : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
139                    weight : 'default',
140                    listeners : {
141                     click : function (_self, e)
142                      {
143                          var sel = _this.option_grid.getSelectionModel().getSelected();
144                          
145                          if(!sel || sel.data.id * 1 < 1){
146                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');
147                              return;
148                          }
149                      
150                          Pman.Dialog.BAdminCoreEnum.show({ 
151                              id : sel.data.id
152                          }, function(res) {
153                              _this.option_grid.store.load({});
154                          });
155                      
156                      },
157                     render : function (_self)
158                      {
159                          _this.edit_btn = this;
160                          
161                          this.hide();
162                      }
163                    },
164                    xns : Roo.bootstrap,
165                    '|xns' : 'Roo.bootstrap'
166                   },
167                   {
168                    xtype : 'Button',
169                    cls : 'roo-toolbar-button',
170                    glyphicon : 'trash',
171                    html : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
172                    weight : 'primary',
173                    listeners : {
174                     click : function (_self, e)
175                      {
176                          var sel = _this.option_grid.getSelectionModel().getSelected();
177                          
178                          if(!sel || sel.data.id * 1 < 1){
179                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');
180                              return;
181                          }
182                      
183                          new Pman.Request({
184                              url: baseURL + '/Roo/Core_enum.php',
185                              method : 'POST',
186                              params : {
187                                  _delete : sel.data.id
188                              }, 
189                              success : function(res) {
190                                  _this.option_grid.store.load({});
191                              }
192                          });
193                      
194                      },
195                     render : function (_self)
196                      {
197                          _this.delete_btn = this;
198                          
199                          this.hide();
200                      }
201                    },
202                    xns : Roo.bootstrap,
203                    '|xns' : 'Roo.bootstrap'
204                   }
205                  ]
206                 }
207                ]
208               }
209              ]
210             }
211            ]
212           }
213          ]
214         }
215        ]
216       },
217       grid : {
218        xtype : 'Table',
219        cellSelection : true,
220        cls : 'table-fixed',
221        footerShow : false,
222        hover : true,
223        loadMask : true,
224        responsive : true,
225        rowSelection : true,
226        striped : true,
227        listeners : {
228         cellclick : function (_self, el, rowIndex, columnIndex, e)
229          {
230              var di = _this.option_grid.colModel.getDataIndex(columnIndex);
231              
232              if (di != 'active') {
233                  return;
234              }
235               
236              var rec = _this.option_grid.store.getAt(rowIndex);
237              
238              rec.set('active', rec.data.active ? 0 : 1);
239              
240              rec.commit();
241          },
242         render : function (_self)
243          {
244              _this.option_grid = _self; 
245          
246          },
247         rowdblclick : function (_self, el, rowIndex, e)
248          {
249              var sel = _this.option_grid.store.getAt(rowIndex);
250              
251              if(!sel || sel.data.id * 1 < 1){
252                  return;
253              }
254              
255              Pman.Dialog.BAdminCoreEnum.show({ 
256                  id : sel.data.id
257              }, function(res) {
258                  _this.option_grid.store.load({});
259              });
260              
261          }
262        },
263        xns : Roo.bootstrap,
264        '|xns' : 'Roo.bootstrap',
265        store : {
266         xtype : 'Store',
267         remoteSort : true,
268         sortinfo : { field : 'display_name', direction: 'ASC' },
269         listeners : {
270          beforeload : function (_self, o)
271           {
272               o.params = o.params || {};
273               
274               
275           },
276          load : function (_self, records, options)
277           {
278               _this.edit_btn.hide();
279               _this.delete_btn.hide();
280           },
281          update : function (_self, record, operation)
282           {
283               if (operation != 'commit') {
284                   return;
285               }
286           
287               new Pman.Request({
288                   url : baseURL + '/Roo/Core_enum',
289                   method :'POST',
290                   params : {
291                       id : record.data.id,
292                       active: record.data.active
293                   },
294                   success : function() {
295           
296                   },
297                   failure : function() 
298                   {
299                       Roo.bootstrap.MessageBox.alert("Error", "saving failed", function() {
300                           _this.grid.footer.onClick('first');
301                       });
302                   }
303               });
304           }
305         },
306         xns : Roo.data,
307         '|xns' : 'Roo.data',
308         proxy : {
309          xtype : 'HttpProxy',
310          method : 'GET',
311          url : baseURL + '/Roo/Core_ip_access.php',
312          xns : Roo.data,
313          '|xns' : 'Roo.data'
314         },
315         reader : {
316          xtype : 'JsonReader',
317          fields : [
318              {
319                  'name': 'id',
320                  'type': 'int'
321              },
322              {
323                  'name': 'created_dt',
324                  'type': 'date',
325                  'formatDate' : 'Y-m-d'
326              },
327              {
328                  'name': 'status',
329                  'type': 'int'
330              },
331              {
332                  'name': 'authorized_by',
333                  'type': 'int'
334              },
335              {
336                  'name': 'authorized_by_name',
337                  'type': 'string'
338              },
339              {
340                  'name': 'authorized_by_email',
341                  'type': 'string'
342              },
343              {
344                  'name': 'authorized_key',
345                  'type': 'string'
346              },
347              {
348                  'name': 'email',
349                  'type': 'string'
350              },
351              {
352                  'name': 'expire_dt',
353                  'type': 'date',
354                  'formatDate' : 'Y-m-d'
355              },
356              {
357                  'name': 'user_agent',
358                  'type': 'string'
359              },
360              {
361                  'name': 'updated_by',
362                  'type': 'int'
363              },
364              {
365                  'name': 'updated_by_name',
366                  'type': 'string'
367              },
368              {
369                  'name': 'updated_by_email',
370                  'type': 'string'
371              }
372              
373          ],
374          id : 'id',
375          root : 'data',
376          totalProperty : 'total',
377          xns : Roo.data,
378          '|xns' : 'Roo.data'
379         }
380        },
381        sm : {
382         xtype : 'RowSelectionModel',
383         singleSelect : true,
384         listeners : {
385          selectionchange : function (_self)
386           {
387               _this.edit_btn.hide();
388               _this.delete_btn.hide();
389               
390               if (!this.getSelected()) {
391                   return;
392               }
393               
394               _this.edit_btn.show();
395               _this.delete_btn.show();
396               
397           }
398         },
399         xns : Roo.bootstrap.Table,
400         '|xns' : 'Roo.bootstrap.Table'
401        },
402        cm : [
403         {
404          xtype : 'ColumnModel',
405          cursor : 'pointer',
406          dataIndex : 'id',
407          header : _this._strings['01abfc750a0c942167651c40d088531d'] /* # */,
408          renderer : function(v,x,r) 
409          {
410              return String.format('{0}', v ? v : '');
411          },
412          sortable : true,
413          xns : Roo.grid,
414          '|xns' : 'Roo.grid'
415         },
416         {
417          xtype : 'ColumnModel',
418          cursor : 'pointer',
419          dataIndex : 'created_dt',
420          header : _this._strings['0eceeb45861f9585dd7a97a3e36f85c6'] /* Created */,
421          renderer : function(v,x,r) { 
422              return String.format('{0}', v ? v : '');
423          },
424          sortable : true,
425          xns : Roo.grid,
426          '|xns' : 'Roo.grid'
427         },
428         {
429          xtype : 'ColumnModel',
430          cursor : 'pointer',
431          dataIndex : 'ip',
432          header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */,
433          renderer : function(v,x,r) { 
434              return String.format('{0}', v ? v : '');
435          },
436          sortable : true,
437          xns : Roo.grid,
438          '|xns' : 'Roo.grid'
439         },
440         {
441          xtype : 'ColumnModel',
442          cursor : 'pointer',
443          dataIndex : 'active',
444          header : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
445          md : 2,
446          renderer : function(v,x,r) { 
447              var state = v > 0 ?  '-checked' : '';
448          
449              return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
450          },
451          sm : 2,
452          sortable : false,
453          xs : 2,
454          xns : Roo.grid,
455          '|xns' : 'Roo.grid'
456         }
457        ]
458       }
459      }
460     ]
461    }
462   };  }
463 });