Pman.Tab.BAdminCoreEnum.bjs
[Pman.BAdmin] / Pman.Tab.BAdminCoreEnum.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.BAdminCoreEnum = new Roo.XComponent({
8
9  _strings : {
10   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
11   '2df80d5febcde0c10a66818488622b7c' :"Pulldown Options",
12   'aba9f7d7443652e858969bfc280690b1' :"Manage Groups ",
13   '7dce122004969d56ae2e0245cb754d35' :"Edit",
14   'dae8ace18bdcbcc6ae5aece263e14fe8' :"Options",
15   'f2d346b1bb7c1c85ab6f7f21e3666b9f' :"Types",
16   '4d1c8263ba1036754f8db14a98f9f006' :"Reload",
17   '49ee3087348e8d44e1feda1917443987' :"Name",
18   'f2a6c498fb90ee345d997f888fce3b18' :"Delete"
19  },
20
21   part     :  ["BAdmin", "CoreEnum" ],
22   order    : '005-Pman.Tab.BAdminCoreEnum',
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['2df80d5febcde0c10a66818488622b7c'] /* Pulldown Options */,
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     west : {
50      xtype : 'Region',
51      hideTabs : true,
52      split : true,
53      tabPosition : 'top',
54      width : 350,
55      xns : Roo.bootstrap.layout,
56      '|xns' : 'Roo.bootstrap.layout'
57     },
58     items  : [
59      {
60       xtype : 'Grid',
61       background : false,
62       closable : false,
63       fitContainer : true,
64       fitToFrame : true,
65       region : 'west',
66       title : _this._strings['f2d346b1bb7c1c85ab6f7f21e3666b9f'] /* Types */,
67       listeners : {
68        activate : function (_self)
69         {
70             if(_this.type_grid) {
71                 _this.type_grid.footer.onClick('first');
72             }
73         },
74        render : function (_self)
75         {
76             _this.type_panel = _self; 
77         }
78       },
79       xns : Roo.bootstrap.panel,
80       '|xns' : 'Roo.bootstrap.panel',
81       toolbar : {
82        xtype : 'NavSimplebar',
83        xns : Roo.bootstrap,
84        '|xns' : 'Roo.bootstrap',
85        items  : [
86         {
87          xtype : 'NavGroup',
88          xns : Roo.bootstrap,
89          '|xns' : 'Roo.bootstrap',
90          items  : [
91           {
92            xtype : 'NavItem',
93            xns : Roo.bootstrap,
94            '|xns' : 'Roo.bootstrap',
95            items  : [
96             {
97              xtype : 'Button',
98              glyphicon : 'plus',
99              html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
100              style : 'margin: 10px;',
101              weight : 'primary',
102              listeners : {
103               click : function (_self, e)
104                {
105                    Pman.Dialog.BAdminStaff.show({ 
106                        id : 0,
107                        company_id : Pman.Login.authUser.company_id
108                    }, function(res) {
109                    
110                        if(res.length_oath_key * 1 < 1){
111                            _this.member_grid.footer.onClick('first');
112                            return;
113                        }
114                        
115                        Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
116                            id : res.id
117                        }, function(res){
118                            _this.member_grid.footer.onClick('first');
119                        });
120                    }); 
121                
122                }
123              },
124              xns : Roo.bootstrap,
125              '|xns' : 'Roo.bootstrap'
126             }
127            ]
128           }
129          ]
130         }
131        ]
132       },
133       grid : {
134        xtype : 'Table',
135        cellSelection : true,
136        cls : 'table-fixed',
137        hover : true,
138        loadMask : true,
139        responsive : true,
140        rowSelection : true,
141        striped : false,
142        listeners : {
143         render : function (_self)
144          {
145              _this.type_grid = _self; 
146             
147          }
148        },
149        xns : Roo.bootstrap,
150        '|xns' : 'Roo.bootstrap',
151        footer : {
152         xtype : 'PagingToolbar',
153         displayInfo : false,
154         name : 'footer',
155         pageSize : 25,
156         xns : Roo.bootstrap,
157         '|xns' : 'Roo.bootstrap'
158        },
159        store : {
160         xtype : 'Store',
161         listeners : {
162          beforeload : function (_self, o)
163           {
164               o.params = o.params || {};
165               
166               o.params['query[empty_etype]'] = 1;
167               
168           }
169         },
170         xns : Roo.data,
171         '|xns' : 'Roo.data',
172         proxy : {
173          xtype : 'HttpProxy',
174          method : 'GET',
175          url : baseURL + '/Roo/core_enum.php',
176          xns : Roo.data,
177          '|xns' : 'Roo.data'
178         },
179         reader : {
180          xtype : 'JsonReader',
181          fields : [
182              {
183                  'name': 'id',
184                  'type': 'int'
185              },
186              {
187                  'name': 'etype',
188                  'type': 'string'
189              },
190              {
191                  'name': 'name',
192                  'type': 'string'
193              },
194              {
195                  'name': 'display_name',
196                  'type': 'string'
197              },
198              {
199                  'name': 'active',
200                  'type': 'int'
201              },
202              {
203                  'name': 'seqid',
204                  'type': 'int'
205              }
206          ],
207          id : 'id',
208          root : 'data',
209          totalProperty : 'total',
210          xns : Roo.data,
211          '|xns' : 'Roo.data'
212         }
213        },
214        sm : {
215         xtype : 'RowSelectionModel',
216         singleSelect : true,
217         listeners : {
218          selectionchange : function (_self)
219           {
220               _this.option_grid.footer.onClick('first');
221           }
222         },
223         xns : Roo.bootstrap.Table,
224         '|xns' : 'Roo.bootstrap.Table'
225        },
226        cm : [
227         {
228          xtype : 'ColumnModel',
229          dataIndex : 'display_name',
230          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
231          renderer : function(v,x,r) { 
232              return String.format('<span tooltip="{1}">{0}</span>', v, r.data.name); 
233          },
234          sortable : true,
235          xs : 12,
236          xns : Roo.grid,
237          '|xns' : 'Roo.grid'
238         }
239        ]
240       }
241      },
242      {
243       xtype : 'Grid',
244       background : false,
245       fitContainer : true,
246       fitToFrame : true,
247       region : 'center',
248       title : _this._strings['dae8ace18bdcbcc6ae5aece263e14fe8'] /* Options */,
249       listeners : {
250        activate : function (_self)
251         {
252             if (_this.option_grid) {
253                 _this.option_grid.footer.onClick('first');
254             }
255         },
256        render : function (_self)
257         {
258             _this.options_panel = _self;
259         }
260       },
261       xns : Roo.bootstrap.panel,
262       '|xns' : 'Roo.bootstrap.panel',
263       toolbar : {
264        xtype : 'NavSimplebar',
265        xns : Roo.bootstrap,
266        '|xns' : 'Roo.bootstrap',
267        items  : [
268         {
269          xtype : 'NavGroup',
270          xns : Roo.bootstrap,
271          '|xns' : 'Roo.bootstrap',
272          items  : [
273           {
274            xtype : 'NavSidebarItem',
275            glyphicon : 'menu-hamburger',
276            html : _this._strings['aba9f7d7443652e858969bfc280690b1'] /* Manage Groups  */,
277            preventDefault : true,
278            xns : Roo.bootstrap,
279            '|xns' : 'Roo.bootstrap',
280            menu : {
281             xtype : 'Menu',
282             xns : Roo.bootstrap,
283             '|xns' : 'Roo.bootstrap',
284             items  : [
285              {
286               xtype : 'MenuItem',
287               fa : 'fa fa-plus',
288               html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
289               isContainer : false,
290               preventDefault : true,
291               listeners : {
292                click : function (_self, e)
293                 {
294                     Pman.Dialog.BAdminGroups.show({ id : 0 }, function(res){
295                         _this.group_grid.store.load({});
296                     });
297                 }
298               },
299               xns : Roo.bootstrap,
300               '|xns' : 'Roo.bootstrap'
301              },
302              {
303               xtype : 'MenuItem',
304               fa : 'fa fa-pencil',
305               html : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
306               isContainer : false,
307               preventDefault : true,
308               listeners : {
309                click : function (_self, e)
310                 {
311                     var sel = _this.group_grid.getSelectionModel().getSelected();
312                     
313                     if(!sel){
314                         Roo.bootstrap.MessageBox.alert('Error', 'Please select a group');
315                         return;
316                     }
317                     
318                     if(sel.data.id * 1 < 1){
319                         Roo.bootstrap.MessageBox.alert('Error', 'The selected group is not editable');
320                         return;
321                     }
322                     
323                     Pman.Dialog.BAdminGroups.show({ id : sel.data.id }, function(res){
324                         _this.group_grid.store.load({});
325                     });
326                 }
327               },
328               xns : Roo.bootstrap,
329               '|xns' : 'Roo.bootstrap'
330              },
331              {
332               xtype : 'MenuItem',
333               fa : 'fa fa-trash',
334               html : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
335               isContainer : false,
336               preventDefault : true,
337               listeners : {
338                click : function (_self, e)
339                 {
340                     var sel = _this.group_grid.getSelectionModel().getSelected();
341                     
342                     if(!sel){
343                         Roo.bootstrap.MessageBox.alert('Error', 'Please select a group');
344                         return;
345                     }
346                     
347                     if(sel.data.id * 1 < 1){
348                         Roo.bootstrap.MessageBox.alert('Error', 'The selected group is not editable');
349                         return;
350                     }
351                     
352                     var deleteIt = function()
353                     {
354                         new Pman.Request({
355                             url: baseURL + '/Roo/Core_group',
356                             method: 'POST',
357                             params: {
358                                 _delete : sel.data.id
359                             },
360                             success: function(res){
361                                 _this.group_grid.store.load({});
362                                 return;
363                             }
364                         });
365                     }
366                     
367                     Roo.bootstrap.MessageBox.confirm('Confirm', 'Are you sure to delete the group?',function(ret) {
368                         
369                         if(ret == 'no'){
370                             return;
371                         }
372                         
373                         deleteIt();
374                         
375                      }, this);
376                     
377                     
378                 }
379               },
380               xns : Roo.bootstrap,
381               '|xns' : 'Roo.bootstrap'
382              },
383              {
384               xtype : 'MenuItem',
385               fa : 'fa fa-refresh',
386               html : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
387               isContainer : false,
388               preventDefault : true,
389               listeners : {
390                click : function (_self, e)
391                 {
392                     _this.group_grid.store.load({});
393                 }
394               },
395               xns : Roo.bootstrap,
396               '|xns' : 'Roo.bootstrap'
397              }
398             ]
399            }
400           }
401          ]
402         }
403        ]
404       },
405       grid : {
406        xtype : 'Table',
407        cls : 'table-fixed',
408        footerShow : false,
409        hover : true,
410        loadMask : true,
411        responsive : true,
412        rowSelection : true,
413        striped : true,
414        listeners : {
415         render : function (_self)
416          {
417              _this.option_grid = _self; 
418          
419              if (_this.option_panel.active) {
420                  _this.option_grid.footer.onClick('first');
421              }
422          }
423        },
424        xns : Roo.bootstrap,
425        '|xns' : 'Roo.bootstrap',
426        store : {
427         xtype : 'Store',
428         remoteSort : true,
429         sortinfo : { field : 'name', direction: 'ASC' },
430         listeners : {
431          beforeload : function (_self, options)
432           {
433               options.params = options.params || {};
434               
435               options.params.type = 0;
436               
437               options.params._add_everyone = 1;
438           }
439         },
440         xns : Roo.data,
441         '|xns' : 'Roo.data',
442         proxy : {
443          xtype : 'HttpProxy',
444          method : 'GET',
445          url : baseURL + '/Roo/core_group',
446          xns : Roo.data,
447          '|xns' : 'Roo.data'
448         },
449         reader : {
450          xtype : 'JsonReader',
451          id : 'id',
452          root : 'data',
453          totalProperty : 'total',
454          xns : Roo.data,
455          '|xns' : 'Roo.data'
456         }
457        },
458        sm : {
459         xtype : 'RowSelectionModel',
460         singleSelect : true,
461         xns : Roo.bootstrap.Table,
462         '|xns' : 'Roo.bootstrap.Table'
463        },
464        cm : [
465         {
466          xtype : 'ColumnModel',
467          dataIndex : 'name',
468          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
469          md : 12,
470          renderer : function(v,x,r) { 
471              
472              if (r.data.id == 0) {
473                  return '<b>' + "All Staff" + '</b>';
474              }
475              
476              if (r.data.id == -1) {
477                  return '<b>' + "Not in a Group" + '</b>';
478              }
479              
480              if (v == 'Administrators') {
481                  return '<b>' + "Adminstrators" + '</b>';
482              }
483              
484              if (r.data.leader) {
485                  return v + ' (' + r.data.leader_name + ')';
486              }
487              
488              return v;
489          },
490          sm : 12,
491          sortable : false,
492          xs : 12,
493          xns : Roo.grid,
494          '|xns' : 'Roo.grid'
495         }
496        ]
497       }
498      }
499     ]
500    }
501   };  }
502 });