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   '7dce122004969d56ae2e0245cb754d35' :"Edit",
13   '01abfc750a0c942167651c40d088531d' :"#",
14   'dae8ace18bdcbcc6ae5aece263e14fe8' :"Options",
15   'b48968e1c912da07df5e8d6d246291ec' :"Display Name",
16   'f2d346b1bb7c1c85ab6f7f21e3666b9f' :"Types",
17   '49ee3087348e8d44e1feda1917443987' :"Name",
18   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
19   '4d3d769b812b6faa6b76e1a8abaece2d' :"Active"
20  },
21
22   part     :  ["BAdmin", "CoreEnum" ],
23   order    : '005-Pman.Tab.BAdminCoreEnum',
24   region   : 'center',
25   parent   : 'Pman.Tab.BAdmin',
26   name     : "unnamed module",
27   disabled : false, 
28   permname : '', 
29   _tree : function(_data)
30   {
31    var _this = this;
32    var MODULE = this;
33    return {
34    xtype : 'Nest',
35    background : true,
36    title : _this._strings['2df80d5febcde0c10a66818488622b7c'] /* Pulldown Options */,
37    xns : Roo.bootstrap.panel,
38    '|xns' : 'Roo.bootstrap.panel',
39    layout : {
40     xtype : 'Border',
41     xns : Roo.bootstrap.layout,
42     '|xns' : 'Roo.bootstrap.layout',
43     center : {
44      xtype : 'Region',
45      hideTabs : true,
46      tabPosition : 'top',
47      xns : Roo.bootstrap.layout,
48      '|xns' : 'Roo.bootstrap.layout'
49     },
50     west : {
51      xtype : 'Region',
52      hideTabs : true,
53      split : true,
54      tabPosition : 'top',
55      width : 350,
56      xns : Roo.bootstrap.layout,
57      '|xns' : 'Roo.bootstrap.layout'
58     },
59     items  : [
60      {
61       xtype : 'Grid',
62       background : false,
63       closable : false,
64       fitContainer : true,
65       fitToFrame : true,
66       region : 'west',
67       title : _this._strings['f2d346b1bb7c1c85ab6f7f21e3666b9f'] /* Types */,
68       listeners : {
69        activate : function (_self)
70         {
71             if(_this.type_grid) {
72                 _this.type_grid.footer.onClick('first');
73             }
74         },
75        render : function (_self)
76         {
77             _this.type_panel = _self; 
78         }
79       },
80       xns : Roo.bootstrap.panel,
81       '|xns' : 'Roo.bootstrap.panel',
82       toolbar : {
83        xtype : 'NavSimplebar',
84        xns : Roo.bootstrap,
85        '|xns' : 'Roo.bootstrap',
86        items  : [
87         {
88          xtype : 'NavGroup',
89          xns : Roo.bootstrap,
90          '|xns' : 'Roo.bootstrap',
91          items  : [
92           {
93            xtype : 'NavItem',
94            xns : Roo.bootstrap,
95            '|xns' : 'Roo.bootstrap',
96            items  : [
97             {
98              xtype : 'Button',
99              glyphicon : 'plus',
100              html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
101              style : 'margin: 10px;',
102              weight : 'default',
103              listeners : {
104               click : function (_self, e)
105                {
106                    Pman.Dialog.BAdminCoreEnum.show({ 
107                        id : 0
108                    }, function(res) {
109                        _this.type_grid.footer.onClick('first');
110                    });
111                
112                }
113              },
114              xns : Roo.bootstrap,
115              '|xns' : 'Roo.bootstrap'
116             }
117            ]
118           }
119          ]
120         }
121        ]
122       },
123       grid : {
124        xtype : 'Table',
125        cellSelection : true,
126        cls : 'table-fixed',
127        hover : true,
128        loadMask : true,
129        responsive : true,
130        rowSelection : true,
131        striped : false,
132        listeners : {
133         render : function (_self)
134          {
135              _this.type_grid = _self; 
136             
137          },
138         rowdblclick : function (_self, el, rowIndex, e)
139          {
140              var r = _this.type_grid.store.getAt(rowIndex);
141              
142              if(!r || r.data.id * 1 < 1){
143                  return;
144              }
145              
146              Pman.Dialog.BAdminCoreEnum.show({ 
147                  id : r.data.id
148              }, function(res) {
149                  _this.type_grid.footer.onClick('first');
150              });
151          }
152        },
153        xns : Roo.bootstrap,
154        '|xns' : 'Roo.bootstrap',
155        footer : {
156         xtype : 'PagingToolbar',
157         displayInfo : false,
158         name : 'footer',
159         pageSize : 100,
160         xns : Roo.bootstrap,
161         '|xns' : 'Roo.bootstrap'
162        },
163        store : {
164         xtype : 'Store',
165         remoteSort : true,
166         sortInfo : { field : 'display_name', direction: 'ASC' },
167         listeners : {
168          beforeload : function (_self, o)
169           {
170               o.params = o.params || {};
171               
172               o.params['query[empty_etype]'] = 1;
173               
174           }
175         },
176         xns : Roo.data,
177         '|xns' : 'Roo.data',
178         proxy : {
179          xtype : 'HttpProxy',
180          method : 'GET',
181          url : baseURL + '/Roo/core_enum.php',
182          xns : Roo.data,
183          '|xns' : 'Roo.data'
184         },
185         reader : {
186          xtype : 'JsonReader',
187          fields : [
188              {
189                  'name': 'id',
190                  'type': 'int'
191              },
192              {
193                  'name': 'etype',
194                  'type': 'string'
195              },
196              {
197                  'name': 'name',
198                  'type': 'string'
199              },
200              {
201                  'name': 'display_name',
202                  'type': 'string'
203              },
204              {
205                  'name': 'active',
206                  'type': 'int'
207              },
208              {
209                  'name': 'seqid',
210                  'type': 'int'
211              }
212          ],
213          id : 'id',
214          root : 'data',
215          totalProperty : 'total',
216          xns : Roo.data,
217          '|xns' : 'Roo.data'
218         }
219        },
220        sm : {
221         xtype : 'RowSelectionModel',
222         singleSelect : true,
223         listeners : {
224          selectionchange : function (_self)
225           {
226               _this.option_grid.store.load({});
227           }
228         },
229         xns : Roo.bootstrap.Table,
230         '|xns' : 'Roo.bootstrap.Table'
231        },
232        cm : [
233         {
234          xtype : 'ColumnModel',
235          dataIndex : 'display_name',
236          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
237          renderer : function(v,x,r) { 
238              return String.format('<span tooltip="{1}">{0}</span>', v, r.data.name); 
239          },
240          sortable : true,
241          xs : 12,
242          xns : Roo.grid,
243          '|xns' : 'Roo.grid'
244         }
245        ]
246       }
247      },
248      {
249       xtype : 'Grid',
250       background : false,
251       fitContainer : true,
252       fitToFrame : true,
253       region : 'center',
254       title : _this._strings['dae8ace18bdcbcc6ae5aece263e14fe8'] /* Options */,
255       listeners : {
256        activate : function (_self)
257         {
258             if (_this.option_grid) {
259                 _this.option_grid.store.load({});
260         //        _this.option_grid.footer.onClick('first');
261             }
262         },
263        render : function (_self)
264         {
265             _this.option_panel = _self;
266         }
267       },
268       xns : Roo.bootstrap.panel,
269       '|xns' : 'Roo.bootstrap.panel',
270       toolbar : {
271        xtype : 'NavSimplebar',
272        xns : Roo.bootstrap,
273        '|xns' : 'Roo.bootstrap',
274        items  : [
275         {
276          xtype : 'NavGroup',
277          xns : Roo.bootstrap,
278          '|xns' : 'Roo.bootstrap',
279          items  : [
280           {
281            xtype : 'NavItem',
282            xns : Roo.bootstrap,
283            '|xns' : 'Roo.bootstrap',
284            items  : [
285             {
286              xtype : 'Button',
287              glyphicon : 'plus',
288              html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
289              style : 'margin: 10px;',
290              weight : 'default',
291              listeners : {
292               click : function (_self, e)
293                {
294                    var sel = _this.type_grid.getSelectionModel().getSelected();
295                    
296                    if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length ){
297                        Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');
298                        return;
299                    }
300                
301                    Pman.Dialog.BAdminCoreEnum.show({ 
302                        id : 0,
303                        etype : sel.data.name
304                    }, function(res) {
305                        _this.option_grid.store.load({});
306                    });
307                
308                }
309              },
310              xns : Roo.bootstrap,
311              '|xns' : 'Roo.bootstrap'
312             },
313             {
314              xtype : 'Button',
315              glyphicon : 'pencil',
316              html : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
317              style : 'margin: 10px;',
318              weight : 'default',
319              listeners : {
320               click : function (_self, e)
321                {
322                    var sel = _this.option_grid.getSelectionModel().getSelected();
323                    
324                    if(!sel || sel.data.id * 1 < 1){
325                        Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');
326                        return;
327                    }
328                
329                    Pman.Dialog.BAdminCoreEnum.show({ 
330                        id : sel.data.id
331                    }, function(res) {
332                        _this.option_grid.store.load({});
333                    });
334                
335                }
336              },
337              xns : Roo.bootstrap,
338              '|xns' : 'Roo.bootstrap'
339             },
340             {
341              xtype : 'Button',
342              glyphicon : 'trash',
343              html : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
344              style : 'margin: 10px;',
345              weight : 'primary',
346              listeners : {
347               click : function (_self, e)
348                {
349                    var sel = _this.option_grid.getSelectionModel().getSelected();
350                    
351                    if(!sel || sel.data.id * 1 < 1){
352                        Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');
353                        return;
354                    }
355                
356                    new Pman.Request({
357                        url: baseURL + '/Roo/Core_enum.php',
358                        method : 'POST',
359                        params : {
360                            _delete : sel.data.id
361                        }, 
362                        success : function(res) {
363                            _this.option_grid.store.load({});
364                        }
365                    });
366                
367                }
368              },
369              xns : Roo.bootstrap,
370              '|xns' : 'Roo.bootstrap'
371             }
372            ]
373           }
374          ]
375         }
376        ]
377       },
378       grid : {
379        xtype : 'Table',
380        cellSelection : true,
381        cls : 'table-fixed',
382        footerShow : false,
383        hover : true,
384        loadMask : true,
385        responsive : true,
386        rowSelection : true,
387        striped : true,
388        listeners : {
389         cellclick : function (_self, el, rowIndex, columnIndex, e)
390          {
391              var di = _this.option_grid.colModel.getDataIndex(columnIndex);
392              
393              if (di != 'active') {
394                  return;
395              }
396               
397              var rec = _this.option_grid.store.getAt(rowIndex);
398              
399              rec.set('active', rec.data.active ? 0 : 1);
400              
401              rec.commit();
402          },
403         render : function (_self)
404          {
405              _this.option_grid = _self; 
406          
407          },
408         rowdblclick : function (_self, el, rowIndex, e)
409          {
410              var sel = _this.option_grid.store.getAt(rowIndex);
411              
412              if(!sel || sel.data.id * 1 < 1){
413                  return;
414              }
415              
416              Pman.Dialog.BAdminCoreEnum.show({ 
417                  id : sel.data.id
418              }, function(res) {
419                  _this.option_grid.store.load({});
420              });
421              
422          }
423        },
424        xns : Roo.bootstrap,
425        '|xns' : 'Roo.bootstrap',
426        store : {
427         xtype : 'Store',
428         remoteSort : true,
429         sortinfo : { field : 'display_name', direction: 'ASC' },
430         listeners : {
431          beforeload : function (_self, o)
432           {
433               o.params = o.params || {};
434               
435               var sel = _this.type_grid.getSelectionModel().getSelected();
436               
437               if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length){
438                   this.removeAll();
439                   return false;
440               }
441               
442               o.params.etype = sel.data.name;
443               
444           },
445          update : function (_self, record, operation)
446           {
447               if (operation != 'commit') {
448                   return;
449               }
450           
451               new Pman.Request({
452                   url : baseURL + '/Roo/Core_enum',
453                   method :'POST',
454                   params : {
455                       id : record.data.id,
456                       active: record.data.active
457                   },
458                   success : function() {
459           
460                   },
461                   failure : function() 
462                   {
463                       Roo.bootstrap.MessageBox.alert("Error", "saving failed", function() {
464                           _this.grid.footer.onClick('first');
465                       });
466                   }
467               });
468           }
469         },
470         xns : Roo.data,
471         '|xns' : 'Roo.data',
472         proxy : {
473          xtype : 'HttpProxy',
474          method : 'GET',
475          url : baseURL + '/Roo/core_enum.php',
476          xns : Roo.data,
477          '|xns' : 'Roo.data'
478         },
479         reader : {
480          xtype : 'JsonReader',
481          fields : [
482              {
483                  'name': 'id',
484                  'type': 'int'
485              },
486              {
487                  'name': 'etype',
488                  'type': 'string'
489              },
490              {
491                  'name': 'name',
492                  'type': 'string'
493              },
494              {
495                  'name': 'display_name',
496                  'type': 'string'
497              },
498              {
499                  'name': 'active',
500                  'type': 'int'
501              },
502              {
503                  'name': 'seqid',
504                  'type': 'int'
505              }
506          ],
507          id : 'id',
508          root : 'data',
509          totalProperty : 'total',
510          xns : Roo.data,
511          '|xns' : 'Roo.data'
512         }
513        },
514        sm : {
515         xtype : 'RowSelectionModel',
516         singleSelect : true,
517         xns : Roo.bootstrap.Table,
518         '|xns' : 'Roo.bootstrap.Table'
519        },
520        cm : [
521         {
522          xtype : 'ColumnModel',
523          dataIndex : 'id',
524          header : _this._strings['01abfc750a0c942167651c40d088531d'] /* # */,
525          md : 2,
526          renderer : function(v,x,r) {
527              //console.log(r.data.seqid);
528              //return String.format('{0}', v ? v : '');
529              
530              return String.format('{0}', r.data.seqid ? r.data.seqid : '')+"<light grey>"+ String.format('{0}', r.data.id ? r.data.id : '') +"</light grey>";
531          },
532          sm : 2,
533          sortable : false,
534          xs : 2,
535          xns : Roo.grid,
536          '|xns' : 'Roo.grid'
537         },
538         {
539          xtype : 'ColumnModel',
540          dataIndex : 'name',
541          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
542          md : 4,
543          renderer : function(v,x,r) { 
544              return String.format('{0}', v ? v : '');
545          },
546          sm : 4,
547          sortable : false,
548          xs : 4,
549          xns : Roo.grid,
550          '|xns' : 'Roo.grid'
551         },
552         {
553          xtype : 'ColumnModel',
554          dataIndex : 'display_name',
555          header : _this._strings['b48968e1c912da07df5e8d6d246291ec'] /* Display Name */,
556          md : 4,
557          renderer : function(v,x,r) { 
558              return String.format('{0}', v ? v : '');
559          },
560          sm : 4,
561          sortable : false,
562          xs : 4,
563          xns : Roo.grid,
564          '|xns' : 'Roo.grid'
565         },
566         {
567          xtype : 'ColumnModel',
568          dataIndex : 'active',
569          header : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
570          md : 2,
571          renderer : function(v,x,r) { 
572              var state = v > 0 ?  '-checked' : '';
573          
574              return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
575          },
576          sm : 2,
577          sortable : false,
578          xs : 2,
579          xns : Roo.grid,
580          '|xns' : 'Roo.grid'
581         }
582        ]
583       }
584      }
585     ]
586    }
587   };  }
588 });