Fix #5680 - testing BS4 / envato
[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             _this.type_edit_btn.hide();
72             
73             if(_this.type_grid) {
74                 _this.type_grid.footer.onClick('first');
75             }
76         },
77        render : function (_self)
78         {
79             _this.type_panel = _self; 
80         }
81       },
82       xns : Roo.bootstrap.panel,
83       '|xns' : 'Roo.bootstrap.panel',
84       toolbar : {
85        xtype : 'NavSimplebar',
86        xns : Roo.bootstrap,
87        '|xns' : 'Roo.bootstrap',
88        items  : [
89         {
90          xtype : 'NavGroup',
91          xns : Roo.bootstrap,
92          '|xns' : 'Roo.bootstrap',
93          items  : [
94           {
95            xtype : 'NavItem',
96            xns : Roo.bootstrap,
97            '|xns' : 'Roo.bootstrap',
98            items  : [
99             {
100              xtype : 'Element',
101              xns : Roo.bootstrap,
102              '|xns' : 'Roo.bootstrap',
103              items  : [
104               {
105                xtype : 'Row',
106                cls : 'roo-toolbar',
107                xns : Roo.bootstrap,
108                '|xns' : 'Roo.bootstrap',
109                items  : [
110                 {
111                  xtype : 'Column',
112                  md : 12,
113                  xns : Roo.bootstrap,
114                  '|xns' : 'Roo.bootstrap',
115                  items  : [
116                   {
117                    xtype : 'Button',
118                    cls : 'roo-toolbar-button',
119                    glyphicon : 'plus',
120                    html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
121                    weight : 'default',
122                    listeners : {
123                     click : function (_self, e)
124                      {
125                          Pman.Dialog.BAdminCoreEnum.show({ 
126                              id : 0
127                          }, function(res) {
128                              _this.type_grid.footer.onClick('first');
129                          });
130                      
131                      }
132                    },
133                    xns : Roo.bootstrap,
134                    '|xns' : 'Roo.bootstrap'
135                   },
136                   {
137                    xtype : 'Button',
138                    cls : 'roo-toolbar-button',
139                    glyphicon : 'edit',
140                    html : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
141                    weight : 'default',
142                    listeners : {
143                     click : function (_self, e)
144                      {
145                          var sel = _this.type_grid.getSelectionModel().getSelected();
146                          
147                          if(!sel || sel.data.id * 1 < 1){
148                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');
149                              return;
150                          }
151                      
152                          Pman.Dialog.BAdminCoreEnum.show({ 
153                              id : sel.data.id
154                          }, function(res) {
155                              _this.type_grid.footer.onClick('first');
156                          });
157                      },
158                     render : function (_self)
159                      {
160                          _this.type_edit_btn = this;
161                          
162                          this.hide();
163                      }
164                    },
165                    xns : Roo.bootstrap,
166                    '|xns' : 'Roo.bootstrap'
167                   }
168                  ]
169                 }
170                ]
171               }
172              ]
173             }
174            ]
175           }
176          ]
177         }
178        ]
179       },
180       grid : {
181        xtype : 'Table',
182        cellSelection : true,
183        cls : 'table-fixed',
184        hover : true,
185        loadMask : true,
186        responsive : true,
187        rowSelection : true,
188        striped : false,
189        listeners : {
190         render : function (_self)
191          {
192              _this.type_grid = _self; 
193             
194          },
195         rowdblclick : function (_self, el, rowIndex, e)
196          {
197              var r = _this.type_grid.store.getAt(rowIndex);
198              
199              if(!r || r.data.id * 1 < 1){
200                  return;
201              }
202              
203              Pman.Dialog.BAdminCoreEnum.show({ 
204                  id : r.data.id
205              }, function(res) {
206                  _this.type_grid.footer.onClick('first');
207              });
208          }
209        },
210        xns : Roo.bootstrap,
211        '|xns' : 'Roo.bootstrap',
212        footer : {
213         xtype : 'PagingToolbar',
214         displayInfo : false,
215         name : 'footer',
216         pageSize : 100,
217         xns : Roo.bootstrap,
218         '|xns' : 'Roo.bootstrap'
219        },
220        store : {
221         xtype : 'Store',
222         remoteSort : true,
223         sortInfo : { field : 'display_name', direction: 'ASC' },
224         listeners : {
225          beforeload : function (_self, o)
226           {
227                 if (!Pman.buildCompleted) {
228                   return false;
229               }
230               
231               o.params = o.params || {};
232               
233               o.params['query[empty_etype]'] = 1;
234               
235           },
236          load : function (_self, records, options)
237           {
238               _this.type_edit_btn.hide();
239           }
240         },
241         xns : Roo.data,
242         '|xns' : 'Roo.data',
243         proxy : {
244          xtype : 'HttpProxy',
245          method : 'GET',
246          url : baseURL + '/Roo/core_enum.php',
247          xns : Roo.data,
248          '|xns' : 'Roo.data'
249         },
250         reader : {
251          xtype : 'JsonReader',
252          fields : [
253              {
254                  'name': 'id',
255                  'type': 'int'
256              },
257              {
258                  'name': 'etype',
259                  'type': 'string'
260              },
261              {
262                  'name': 'name',
263                  'type': 'string'
264              },
265              {
266                  'name': 'display_name',
267                  'type': 'string'
268              },
269              {
270                  'name': 'active',
271                  'type': 'int'
272              },
273              {
274                  'name': 'seqid',
275                  'type': 'int'
276              }
277          ],
278          id : 'id',
279          root : 'data',
280          totalProperty : 'total',
281          xns : Roo.data,
282          '|xns' : 'Roo.data'
283         }
284        },
285        sm : {
286         xtype : 'RowSelectionModel',
287         singleSelect : true,
288         listeners : {
289          selectionchange : function (_self)
290           {
291               _this.type_edit_btn.hide();
292               
293               if(this.getSelected()){
294                   _this.type_edit_btn.show();
295               }
296               
297               _this.option_grid.store.load({});
298           }
299         },
300         xns : Roo.bootstrap.Table,
301         '|xns' : 'Roo.bootstrap.Table'
302        },
303        cm : [
304         {
305          xtype : 'ColumnModel',
306          cursor : 'pointer',
307          dataIndex : 'display_name',
308          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
309          renderer : function(v,x,r) {
310              if (v.match(/Coba/g) || v.match(/Risk Question/g)) {
311                  return String.format('<span tooltip="{1}">Coba: {0}</span>', v, r.data.name);
312              }
313              
314              return String.format('<span tooltip="{1}">{0}</span>', v, r.data.name); 
315          },
316          sortable : true,
317          xs : 12,
318          xns : Roo.grid,
319          '|xns' : 'Roo.grid'
320         }
321        ]
322       }
323      },
324      {
325       xtype : 'Grid',
326       background : false,
327       fitContainer : true,
328       fitToFrame : true,
329       region : 'center',
330       title : _this._strings['dae8ace18bdcbcc6ae5aece263e14fe8'] /* Options */,
331       listeners : {
332        activate : function (_self)
333         {
334             _this.edit_btn.hide();
335             _this.delete_btn.hide();
336             
337             if (_this.option_grid) {
338                 _this.option_grid.store.load({});
339             }
340         },
341        render : function (_self)
342         {
343             _this.option_panel = _self;
344         }
345       },
346       xns : Roo.bootstrap.panel,
347       '|xns' : 'Roo.bootstrap.panel',
348       toolbar : {
349        xtype : 'NavSimplebar',
350        xns : Roo.bootstrap,
351        '|xns' : 'Roo.bootstrap',
352        items  : [
353         {
354          xtype : 'NavGroup',
355          xns : Roo.bootstrap,
356          '|xns' : 'Roo.bootstrap',
357          items  : [
358           {
359            xtype : 'NavItem',
360            xns : Roo.bootstrap,
361            '|xns' : 'Roo.bootstrap',
362            items  : [
363             {
364              xtype : 'Element',
365              xns : Roo.bootstrap,
366              '|xns' : 'Roo.bootstrap',
367              items  : [
368               {
369                xtype : 'Row',
370                cls : 'roo-toolbar',
371                xns : Roo.bootstrap,
372                '|xns' : 'Roo.bootstrap',
373                items  : [
374                 {
375                  xtype : 'Column',
376                  md : 12,
377                  xns : Roo.bootstrap,
378                  '|xns' : 'Roo.bootstrap',
379                  items  : [
380                   {
381                    xtype : 'Button',
382                    cls : 'roo-toolbar-button',
383                    glyphicon : 'plus',
384                    html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
385                    weight : 'default',
386                    listeners : {
387                     click : function (_self, e)
388                      {
389                          var sel = _this.type_grid.getSelectionModel().getSelected();
390                          
391                          if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length ){
392                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');
393                              return;
394                          }
395                      
396                          Pman.Dialog.BAdminCoreEnum.show({ 
397                              id : 0,
398                              etype : sel.data.name
399                          }, function(res) {
400                              _this.option_grid.store.load({});
401                          });
402                      
403                      }
404                    },
405                    xns : Roo.bootstrap,
406                    '|xns' : 'Roo.bootstrap'
407                   },
408                   {
409                    xtype : 'Button',
410                    cls : 'roo-toolbar-button',
411                    glyphicon : 'edit',
412                    html : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
413                    weight : 'default',
414                    listeners : {
415                     click : function (_self, e)
416                      {
417                          var sel = _this.option_grid.getSelectionModel().getSelected();
418                          
419                          if(!sel || sel.data.id * 1 < 1){
420                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');
421                              return;
422                          }
423                      
424                          Pman.Dialog.BAdminCoreEnum.show({ 
425                              id : sel.data.id
426                          }, function(res) {
427                              _this.option_grid.store.load({});
428                          });
429                      
430                      },
431                     render : function (_self)
432                      {
433                          _this.edit_btn = this;
434                          
435                          this.hide();
436                      }
437                    },
438                    xns : Roo.bootstrap,
439                    '|xns' : 'Roo.bootstrap'
440                   },
441                   {
442                    xtype : 'Button',
443                    cls : 'roo-toolbar-button',
444                    glyphicon : 'trash',
445                    html : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
446                    weight : 'primary',
447                    listeners : {
448                     click : function (_self, e)
449                      {
450                          var sel = _this.option_grid.getSelectionModel().getSelected();
451                          
452                          if(!sel || sel.data.id * 1 < 1){
453                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');
454                              return;
455                          }
456                      
457                          new Pman.Request({
458                              url: baseURL + '/Roo/Core_enum.php',
459                              method : 'POST',
460                              params : {
461                                  _delete : sel.data.id
462                              }, 
463                              success : function(res) {
464                                  _this.option_grid.store.load({});
465                              }
466                          });
467                      
468                      },
469                     render : function (_self)
470                      {
471                          _this.delete_btn = this;
472                          
473                          this.hide();
474                      }
475                    },
476                    xns : Roo.bootstrap,
477                    '|xns' : 'Roo.bootstrap'
478                   }
479                  ]
480                 }
481                ]
482               }
483              ]
484             }
485            ]
486           }
487          ]
488         }
489        ]
490       },
491       grid : {
492        xtype : 'Table',
493        cellSelection : true,
494        cls : 'table-fixed',
495        footerShow : false,
496        hover : true,
497        loadMask : true,
498        responsive : true,
499        rowSelection : true,
500        striped : true,
501        listeners : {
502         cellclick : function (_self, el, rowIndex, columnIndex, e)
503          {
504              var di = _this.option_grid.colModel.getDataIndex(columnIndex);
505              
506              if (di != 'active') {
507                  return;
508              }
509               
510              var rec = _this.option_grid.store.getAt(rowIndex);
511              
512              rec.set('active', rec.data.active ? 0 : 1);
513              
514              rec.commit();
515              
516              /*if(rec.data.active * 1 != 1){
517                  var el = _this.option_grid.getRowDom(rowIndex);
518                  
519                  el.addClass('x-grid-row-fadeout');
520                  
521                  el.on('transitionend',function(){
522                      _this.option_grid.ds.remove(rec);
523                      el.remove();
524                  },this,{single:true});
525              }*/
526          },
527         render : function (_self)
528          {
529              _this.option_grid = _self; 
530          
531          },
532         rowdblclick : function (_self, el, rowIndex, e)
533          {
534              var sel = _this.option_grid.store.getAt(rowIndex);
535              
536              if(!sel || sel.data.id * 1 < 1){
537                  return;
538              }
539              
540              Pman.Dialog.BAdminCoreEnum.show({ 
541                  id : sel.data.id
542              }, function(res) {
543                  _this.option_grid.store.load({});
544              });
545              
546          }
547        },
548        xns : Roo.bootstrap,
549        '|xns' : 'Roo.bootstrap',
550        store : {
551         xtype : 'Store',
552         remoteSort : true,
553         sortInfo : { field : 'display_name', direction: 'ASC' },
554         listeners : {
555          beforeload : function (_self, o)
556           {
557               if (!Pman.buildCompleted) {
558                   return false;
559               }
560               
561               o.params = o.params || {};
562               
563               var sel = _this.type_grid.getSelectionModel().getSelected();
564               
565               if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length){
566                   this.removeAll();
567                   return false;
568               }
569               
570               o.params.etype = sel.data.name;
571               
572           },
573          load : function (_self, records, options)
574           {
575               _this.edit_btn.hide();
576               _this.delete_btn.hide();
577           },
578          update : function (_self, record, operation)
579           {
580               if (operation != 'commit') {
581                   return;
582               }
583           
584               new Pman.Request({
585                   url : baseURL + '/Roo/Core_enum',
586                   method :'POST',
587                   params : {
588                       id : record.data.id,
589                       active: record.data.active
590                   },
591                   success : function() {
592           
593                   },
594                   failure : function() 
595                   {
596                       Roo.bootstrap.MessageBox.alert("Error", "saving failed", function() {
597                           _this.grid.footer.onClick('first');
598                       });
599                   }
600               });
601           }
602         },
603         xns : Roo.data,
604         '|xns' : 'Roo.data',
605         proxy : {
606          xtype : 'HttpProxy',
607          method : 'GET',
608          url : baseURL + '/Roo/core_enum.php',
609          xns : Roo.data,
610          '|xns' : 'Roo.data'
611         },
612         reader : {
613          xtype : 'JsonReader',
614          fields : [
615              {
616                  'name': 'id',
617                  'type': 'int'
618              },
619              {
620                  'name': 'etype',
621                  'type': 'string'
622              },
623              {
624                  'name': 'name',
625                  'type': 'string'
626              },
627              {
628                  'name': 'display_name',
629                  'type': 'string'
630              },
631              {
632                  'name': 'active',
633                  'type': 'int'
634              },
635              {
636                  'name': 'seqid',
637                  'type': 'int'
638              }
639          ],
640          id : 'id',
641          root : 'data',
642          totalProperty : 'total',
643          xns : Roo.data,
644          '|xns' : 'Roo.data'
645         }
646        },
647        sm : {
648         xtype : 'RowSelectionModel',
649         singleSelect : true,
650         listeners : {
651          selectionchange : function (_self)
652           {
653               _this.edit_btn.hide();
654               _this.delete_btn.hide();
655               
656               if (!this.getSelected()) {
657                   return;
658               }
659               
660               _this.edit_btn.show();
661               _this.delete_btn.show();
662               
663           }
664         },
665         xns : Roo.bootstrap.Table,
666         '|xns' : 'Roo.bootstrap.Table'
667        },
668        cm : [
669         {
670          xtype : 'ColumnModel',
671          cursor : 'pointer',
672          dataIndex : 'id',
673          header : _this._strings['01abfc750a0c942167651c40d088531d'] /* # */,
674          md : 2,
675          renderer : function(v,x,r) {
676              //console.log(r.data.seqid);
677              //return String.format('{0}', v ? v : '');
678              
679              return 
680                  String.format('{0}', r.data.seqid ? r.data.seqid : '')
681                  +" <span style='color:lightgrey'>"
682                  + String.format('{0}', r.data.id ? r.data.id : '')
683                  +"</span>";
684          },
685          sm : 2,
686          sortable : false,
687          xs : 2,
688          xns : Roo.grid,
689          '|xns' : 'Roo.grid'
690         },
691         {
692          xtype : 'ColumnModel',
693          cursor : 'pointer',
694          dataIndex : 'name',
695          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
696          md : 4,
697          renderer : function(v,x,r) { 
698              return String.format('{0}', v ? v : '');
699          },
700          sm : 4,
701          sortable : false,
702          xs : 4,
703          xns : Roo.grid,
704          '|xns' : 'Roo.grid'
705         },
706         {
707          xtype : 'ColumnModel',
708          cursor : 'pointer',
709          dataIndex : 'display_name',
710          header : _this._strings['b48968e1c912da07df5e8d6d246291ec'] /* Display Name */,
711          md : 4,
712          renderer : function(v,x,r) { 
713              return String.format('{0}', v ? v : '');
714          },
715          sm : 4,
716          sortable : false,
717          xs : 4,
718          xns : Roo.grid,
719          '|xns' : 'Roo.grid'
720         },
721         {
722          xtype : 'ColumnModel',
723          cursor : 'pointer',
724          dataIndex : 'active',
725          header : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
726          md : 2,
727          renderer : function(v,x,r) { 
728              
729              var state = v > 0 ? 'check-' : '';
730              
731              //return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';
732              return '<i class="far fa-'+ state + 'square-o fa-2x" aria-hidden="true"></i>';
733          },
734          sm : 2,
735          sortable : false,
736          xs : 2,
737          xns : Roo.grid,
738          '|xns' : 'Roo.grid'
739         }
740        ]
741       }
742      }
743     ]
744    }
745   };  }
746 });