Pman.Dialog.BAdminStaff.bjs
[Pman.BAdmin] / Pman.Dialog.BAdminStaff.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.Dialog');
6
7 Pman.Dialog.BAdminStaff= function() {}
8 Roo.apply(Pman.Dialog.BAdminStaff.prototype, {
9
10  _strings : {
11   'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
12   '566a352f95c879ff26e50bad767a28dc' :"Group Membership",
13   '4910043d0b2c8c864a0e8672716fee94' :"Is a Member",
14   'a60cdd3642fbe81545a3b93fe2b19dd6' :"Two-Factor Authentication",
15   '28974c2c793e780427dfb571b26443e6' :"Group Name",
16   'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
17   'a6b81fd617c4f1b94f83049793cac3cd' :"Show QR Code",
18   'a0f852ef8bfccd86a0e7217d7959e3e8' :"Add / Edit User",
19   '3ec365dd533ddb7ef3d1c111186ce872' :"Details",
20   '0bfe42db3eb05bf39f03812166391939' :"Use Secure Passwords",
21   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
22   '73b00356c62eb391f571b6468be7c372' :"Generate QR Code",
23   '6f958ddaf50fd5ade7858ef1d1a63e51' :"Type again to confirm",
24   '49ee3087348e8d44e1feda1917443987' :"Name",
25   'bbbabdbe1b262f75d99d62880b953be1' :"Role",
26   '1960f813085537c64f981132e34181ca' :"Delete QR Code",
27   'c9cc8cce247e49bae79f15173ce97354' :"Save",
28   '828e70f83623b262e14187c039df99c0' :"Enable Two-Factor Authentication",
29   'acf45fd8829f809b29c601a3a193804f' :"Set / Change Password",
30   '01028205a11cf95a503c4c1d005989da' :"Generate One"
31  },
32  _named_strings : {
33   'email_placeholder' : 'ce8ae9da5b7cd6c3df2929543a9af92d' /* Email */ ,
34   'secure_passwords_boxLabel' : '0bfe42db3eb05bf39f03812166391939' /* Use Secure Passwords */ ,
35   'name_placeholder' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
36   'role_fieldLabel' : 'bbbabdbe1b262f75d99d62880b953be1' /* Role */ ,
37   'name_fieldLabel' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
38   'role_placeholder' : 'bbbabdbe1b262f75d99d62880b953be1' /* Role */ ,
39   'phone_fieldLabel' : 'bcc254b55c4a1babdf1dcb82c207506b' /* Phone */ ,
40   '_enable_oath_key_boxLabel' : '828e70f83623b262e14187c039df99c0' /* Enable Two-Factor Authentication */ ,
41   'email_fieldLabel' : 'ce8ae9da5b7cd6c3df2929543a9af92d' /* Email */ ,
42   'passwd2_placeholder' : '6f958ddaf50fd5ade7858ef1d1a63e51' /* Type again to confirm */ 
43  },
44
45  dialog : false,
46  callback:  false,
47
48  show : function(data, cb)
49  {
50   if (!this.dialog) {
51    this.create();
52   }
53
54   this.callback = cb;
55   this.data = data;
56   this.dialog.show(this.data._el);
57   if (this.form) {
58    this.form.reset();
59    this.form.setValues(data);
60    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
61   }
62
63  },
64
65  create : function()
66  {
67   var _this = this;
68   this.dialog = Roo.factory({
69     xtype : 'Modal',
70     cls : 'add-user-dialog',
71     max_width : 650,
72     title : _this._strings['a0f852ef8bfccd86a0e7217d7959e3e8'] /* Add / Edit User */,
73     listeners : {
74      render : function (_self)
75       {
76           this.bodyEl.setHeight(600);
77       },
78      show : function (_self)
79       {
80           //_this.dialog.items[0].getRegion('center').showPanel(0); 
81       
82           //setting first adminstrator in open system
83           
84           if(typeof(_this.data.role) != 'undefined' && _this.data.role == 'Administrators') {
85               
86               Roo.select('.add-user-dialog .modal-title').first().dom.innerHTML = "Create Adminstrator";
87               
88               _this.form.findField('role').inputEl().dom.disabled = true;
89           }
90           _this.layout.showPanel('DetailPanel');
91       }
92     },
93     xns : Roo.bootstrap,
94     '|xns' : 'Roo.bootstrap',
95     buttons : [
96      {
97       xtype : 'Button',
98       html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
99       listeners : {
100        click : function (_self, e)
101         {
102             _this.dialog.hide(); 
103         }
104       },
105       xns : Roo.bootstrap,
106       '|xns' : 'Roo.bootstrap'
107      },
108      {
109       xtype : 'Button',
110       html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
111       weight : 'primary',
112       listeners : {
113        click : function (_self, e)
114         {
115             if(!_this.form.isValid()){
116                 //Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
117                 return;
118             }
119             
120             var myID = _this.form.findField('id').getValue() * 1;
121             var myName = _this.form.findField('name').getValue();
122         
123             if (_this.form.findField('company_id') && !_this.form.findField('company_id').getValue()) {
124                 Roo.bootstrap.MessageBox.alert("Error", "Select a Company");
125                 return;
126             }
127                 
128                // validate password match (only needed if we are not using generated one..
129             if (_this.form.findField('passwd1') 
130                     && _this.form.findField('passwd1').getValue().length > 0 
131                     && _this.form.findField('passwd1').inputEl().dom.type == "password") {
132                     
133                 var p1 = _this.form.findField('passwd1').getValue();
134                 var p2 = _this.form.findField('passwd2').getValue();
135                     
136                     
137                 if (Pman.Login.authUser.id < 0 && !p1.length) {
138                     Roo.bootstrap.MessageBox.alert("Error", "You must create a password for the admin account");
139                     return;
140                 }
141                     
142                     
143                 if (p1.length || p2.length) {
144                     if (p1 != p2) {
145                         Roo.bootstrap.MessageBox.alert("Error", "Passwords do not match");
146                         return;
147                     }
148                 }
149                     
150                 
151             }
152             
153             // get the list of record with tick
154             
155             _this.form.doAction("submit");
156             
157             return;
158         
159         }
160       },
161       xns : Roo.bootstrap,
162       '|xns' : 'Roo.bootstrap'
163      }
164     ],
165     items  : [
166      {
167       xtype : 'Border',
168       listeners : {
169        render : function (_self)
170         {
171             _this.layout = _self;
172         }
173       },
174       xns : Roo.bootstrap.layout,
175       '|xns' : 'Roo.bootstrap.layout',
176       center : {
177        xtype : 'Region',
178        alwaysShowTabs : true,
179        tabPosition : 'top',
180        xns : Roo.bootstrap.layout,
181        '|xns' : 'Roo.bootstrap.layout'
182       },
183       items  : [
184        {
185         xtype : 'Content',
186         autoScroll : true,
187         background : false,
188         fitContainer : true,
189         fitToFrame : true,
190         id : 'DetailPanel',
191         region : 'center',
192         title : _this._strings['3ec365dd533ddb7ef3d1c111186ce872'] /* Details */,
193         listeners : {
194          activate : function (_self)
195           {
196               /*var url = 'about:blank';
197               
198               if(_this.data.id * 1 > 0){
199                   url = baseURL + '/Coba/Report/ApplicationSummary/' + _this.data.id;
200               }
201                
202               _this.app_summary_frame.el.dom.src = url;*/
203               
204           },
205          render : function (_self)
206           {
207               _this.detail_tab = _self;
208           }
209         },
210         xns : Roo.bootstrap.panel,
211         '|xns' : 'Roo.bootstrap.panel',
212         items  : [
213          {
214           xtype : 'Container',
215           cls : 'col-md-12',
216           xns : Roo.bootstrap,
217           '|xns' : 'Roo.bootstrap',
218           items  : [
219            {
220             xtype : 'Form',
221             errorMask : true,
222             labelAlign : 'top',
223             style : 'margin-top: 20px;',
224             url : baseURL + '/Roo/core_person',
225             listeners : {
226              actioncomplete : function (_self, action)
227               {
228                   if(action.type == 'setdata'){
229                       
230                       _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
231                       _this.form.findField('passwd2').show();
232                       _this.passwordbox.collapse();
233                       
234                       _this.qrCodeBox.collapse();
235                       _this.qrCodeBox.el.hide();
236                       _this.form.findField('_enable_oath_key').setValue(1);
237                       _this.form.findField('_enable_oath_key').el.show();
238                       
239                       _this.generate_qrcode_btn.el.hide();
240                       _this.delete_qrcode_btn.el.hide();
241                       _this.show_qrcode_btn.el.hide();
242                       
243                       if(_this.data.id * 1 > 0) {
244                           this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
245                       }
246                       
247                       this.clearInvalid();
248                       
249                       return;
250                   }
251                  
252                   if (action.type == 'load') {
253                   
254                       _this.data = action.result.data;
255                       
256                       _this.qrCodeBox.el.show();
257                       _this.form.findField('_enable_oath_key').setValue(0);
258                       _this.form.findField('_enable_oath_key').el.hide();
259                       
260                       _this.generate_qrcode_btn.el.show();
261                       _this.delete_qrcode_btn.el.hide();
262                       _this.show_qrcode_btn.el.hide();
263                           
264                       _this.qrCodeBox.collapse();
265                       
266                       if(_this.data.length_oath_key * 1 > 0){
267                           _this.delete_qrcode_btn.el.show();
268                           _this.show_qrcode_btn.el.show();
269                           _this.qrCodeBox.expand();
270                       }
271                       
272                       return;
273                   }
274                   
275                   if (action.type == 'submit') { // only submitted here if we are 
276                   
277                       _this.dialog.hide();
278                      
279                       if (_this.callback) {
280                           _this.callback.call(this, action.result.data);
281                       }
282                       
283                       return;
284                       
285                   }
286               },
287              beforeaction : function (_self, action)
288               {
289               
290               },
291              render : function (_self)
292               {
293                   _this.form = _self;
294                   
295                   //_this.findField('group_membership').setValue
296                   
297                   console.log(_this.form.data);
298               }
299             },
300             xns : Roo.bootstrap,
301             '|xns' : 'Roo.bootstrap',
302             items  : [
303              {
304               xtype : 'Row',
305               xns : Roo.bootstrap,
306               '|xns' : 'Roo.bootstrap',
307               items  : [
308                {
309                 xtype : 'Column',
310                 md : 12,
311                 xns : Roo.bootstrap,
312                 '|xns' : 'Roo.bootstrap',
313                 items  : [
314                  {
315                   xtype : 'Input',
316                   allowBlank : false,
317                   fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
318                   labelAlign : 'left',
319                   name : 'name',
320                   placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
321                   xns : Roo.bootstrap,
322                   '|xns' : 'Roo.bootstrap'
323                  }
324                 ]
325                }
326               ]
327              },
328              {
329               xtype : 'Row',
330               xns : Roo.bootstrap,
331               '|xns' : 'Roo.bootstrap',
332               items  : [
333                {
334                 xtype : 'Column',
335                 md : 12,
336                 xns : Roo.bootstrap,
337                 '|xns' : 'Roo.bootstrap',
338                 items  : [
339                  {
340                   xtype : 'Input',
341                   fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
342                   labelAlign : 'left',
343                   name : 'role',
344                   placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
345                   xns : Roo.bootstrap,
346                   '|xns' : 'Roo.bootstrap'
347                  }
348                 ]
349                }
350               ]
351              },
352              {
353               xtype : 'Row',
354               xns : Roo.bootstrap,
355               '|xns' : 'Roo.bootstrap',
356               items  : [
357                {
358                 xtype : 'Column',
359                 md : 12,
360                 xns : Roo.bootstrap,
361                 '|xns' : 'Roo.bootstrap',
362                 items  : [
363                  {
364                   xtype : 'Input',
365                   allowBlank : false,
366                   fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
367                   labelAlign : 'left',
368                   name : 'email',
369                   placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
370                   vtype : 'email',
371                   xns : Roo.bootstrap,
372                   '|xns' : 'Roo.bootstrap'
373                  }
374                 ]
375                }
376               ]
377              },
378              {
379               xtype : 'Row',
380               xns : Roo.bootstrap,
381               '|xns' : 'Roo.bootstrap',
382               items  : [
383                {
384                 xtype : 'Column',
385                 md : 12,
386                 xns : Roo.bootstrap,
387                 '|xns' : 'Roo.bootstrap',
388                 items  : [
389                  {
390                   xtype : 'Input',
391                   fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
392                   labelAlign : 'left',
393                   name : 'phone',
394                   xns : Roo.bootstrap,
395                   '|xns' : 'Roo.bootstrap'
396                  }
397                 ]
398                }
399               ]
400              },
401              {
402               xtype : 'Row',
403               xns : Roo.bootstrap,
404               '|xns' : 'Roo.bootstrap',
405               items  : [
406                {
407                 xtype : 'Column',
408                 md : 12,
409                 xns : Roo.bootstrap,
410                 '|xns' : 'Roo.bootstrap',
411                 items  : [
412                  {
413                   xtype : 'CheckBox',
414                   boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
415                   checked : true,
416                   name : '_enable_oath_key',
417                   listeners : {
418                    render : function (_self)
419                     {
420                         this.el.setVisibilityMode(Roo.Element.DISPLAY);
421                         
422                         this.el.hide();
423                     }
424                   },
425                   xns : Roo.bootstrap,
426                   '|xns' : 'Roo.bootstrap'
427                  }
428                 ]
429                }
430               ]
431              },
432              {
433               xtype : 'Row',
434               xns : Roo.bootstrap,
435               '|xns' : 'Roo.bootstrap',
436               items  : [
437                {
438                 xtype : 'Column',
439                 md : 12,
440                 xns : Roo.bootstrap,
441                 '|xns' : 'Roo.bootstrap',
442                 items  : [
443                  {
444                   xtype : 'Container',
445                   expandable : true,
446                   expanded : false,
447                   header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
448                   panel : 'primary',
449                   listeners : {
450                    render : function (_self)
451                     {
452                         _this.passwordbox = this;
453                     }
454                   },
455                   xns : Roo.bootstrap,
456                   '|xns' : 'Roo.bootstrap',
457                   items  : [
458                    {
459                     xtype : 'Row',
460                     xns : Roo.bootstrap,
461                     '|xns' : 'Roo.bootstrap',
462                     items  : [
463                      {
464                       xtype : 'Column',
465                       xs : 8,
466                       xns : Roo.bootstrap,
467                       '|xns' : 'Roo.bootstrap',
468                       items  : [
469                        {
470                         xtype : 'Input',
471                         inputType : 'password',
472                         name : 'passwd1',
473                         xns : Roo.bootstrap,
474                         '|xns' : 'Roo.bootstrap'
475                        }
476                       ]
477                      },
478                      {
479                       xtype : 'Column',
480                       xs : 4,
481                       xns : Roo.bootstrap,
482                       '|xns' : 'Roo.bootstrap',
483                       items  : [
484                        {
485                         xtype : 'Button',
486                         html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
487                         style : 'width:100%',
488                         listeners : {
489                          click : function (_self, e)
490                           {
491                               var pw = Math.random().toString(36).slice(-12);
492                               _this.form.findField('passwd1').el.select('input',true).first().dom.type="input";
493                               _this.form.findField('passwd1').setValue(pw);
494                               _this.form.findField('passwd2').hide();
495                               
496                               
497                           }
498                         },
499                         xns : Roo.bootstrap,
500                         '|xns' : 'Roo.bootstrap'
501                        }
502                       ]
503                      }
504                     ]
505                    },
506                    {
507                     xtype : 'Input',
508                     inputType : 'password',
509                     name : 'passwd2',
510                     placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
511                     xns : Roo.bootstrap,
512                     '|xns' : 'Roo.bootstrap'
513                    },
514                    {
515                     xtype : 'CheckBox',
516                     boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
517                     name : 'secure_passwords',
518                     xns : Roo.bootstrap,
519                     '|xns' : 'Roo.bootstrap'
520                    }
521                   ]
522                  }
523                 ]
524                }
525               ]
526              },
527              {
528               xtype : 'Row',
529               xns : Roo.bootstrap,
530               '|xns' : 'Roo.bootstrap',
531               items  : [
532                {
533                 xtype : 'Column',
534                 md : 12,
535                 xns : Roo.bootstrap,
536                 '|xns' : 'Roo.bootstrap',
537                 items  : [
538                  {
539                   xtype : 'Container',
540                   expandable : true,
541                   expanded : false,
542                   header : _this._strings['a60cdd3642fbe81545a3b93fe2b19dd6'] /* Two-Factor Authentication */,
543                   panel : 'primary',
544                   listeners : {
545                    render : function (_self)
546                     {
547                         _this.qrCodeBox = this;
548                         
549                         this.el.setVisibilityMode(Roo.Element.DISPLAY);
550                         
551                         this.el.hide();
552                     }
553                   },
554                   xns : Roo.bootstrap,
555                   '|xns' : 'Roo.bootstrap',
556                   items  : [
557                    {
558                     xtype : 'Row',
559                     xns : Roo.bootstrap,
560                     '|xns' : 'Roo.bootstrap',
561                     items  : [
562                      {
563                       xtype : 'Column',
564                       xs : 4,
565                       xns : Roo.bootstrap,
566                       '|xns' : 'Roo.bootstrap',
567                       items  : [
568                        {
569                         xtype : 'Button',
570                         html : _this._strings['73b00356c62eb391f571b6468be7c372'] /* Generate QR Code */,
571                         style : 'width:100%',
572                         listeners : {
573                          click : function (_self, e)
574                           {
575                               if(_this.data.id * 1 < 1){
576                                   Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
577                                   return;
578                               }
579                               
580                               new Pman.Request({
581                                   url: baseURL + '/Roo/Core_person.php',
582                                   method : 'POST',
583                                   mask : 'Loading...',
584                                   params : {
585                                       id : _this.data.id,
586                                       _generate_oath_key : 1
587                                   }, 
588                                   success : function(res) {
589                                       _this.delete_qrcode_btn.el.show();
590                                       _this.show_qrcode_btn.el.show();
591                                       
592                                       Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
593                                           id : _this.data.id
594                                       });
595                                       
596                                       return;
597                                   }
598                               });
599                           },
600                          render : function (_self)
601                           {
602                               _this.generate_qrcode_btn = this;
603                           
604                               this.el.setVisibilityMode(Roo.Element.DISPLAY);
605                               
606                               this.el.hide();
607                           }
608                         },
609                         xns : Roo.bootstrap,
610                         '|xns' : 'Roo.bootstrap'
611                        }
612                       ]
613                      },
614                      {
615                       xtype : 'Column',
616                       xs : 4,
617                       xns : Roo.bootstrap,
618                       '|xns' : 'Roo.bootstrap',
619                       items  : [
620                        {
621                         xtype : 'Button',
622                         html : _this._strings['1960f813085537c64f981132e34181ca'] /* Delete QR Code */,
623                         style : 'width:100%',
624                         listeners : {
625                          click : function (_self, e)
626                           {
627                               if(_this.data.id * 1 < 1){
628                                   Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
629                                   return;
630                               }
631                               
632                               new Pman.Request({
633                                   url: baseURL + '/Roo/Core_person.php',
634                                   method : 'POST',
635                                   mask : 'Loading...',
636                                   params : {
637                                       id : _this.data.id,
638                                       oath_key : ''
639                                   }, 
640                                   success : function(res) {
641                                       _this.delete_qrcode_btn.el.hide();
642                                       _this.show_qrcode_btn.el.hide();
643                                       
644                                       return;
645                                   }
646                               });
647                           },
648                          render : function (_self)
649                           {
650                               _this.delete_qrcode_btn = this;
651                           
652                               this.el.setVisibilityMode(Roo.Element.DISPLAY);
653                               
654                               this.el.hide();
655                           }
656                         },
657                         xns : Roo.bootstrap,
658                         '|xns' : 'Roo.bootstrap'
659                        }
660                       ]
661                      },
662                      {
663                       xtype : 'Column',
664                       xs : 4,
665                       xns : Roo.bootstrap,
666                       '|xns' : 'Roo.bootstrap',
667                       items  : [
668                        {
669                         xtype : 'Button',
670                         html : _this._strings['a6b81fd617c4f1b94f83049793cac3cd'] /* Show QR Code */,
671                         style : 'width:100%',
672                         listeners : {
673                          click : function (_self, e)
674                           {
675                               if(_this.data.id * 1 < 1){
676                                   Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
677                                   return;
678                               }
679                               
680                               Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
681                                   id : _this.data.id
682                               });
683                           },
684                          render : function (_self)
685                           {
686                               _this.show_qrcode_btn = this;
687                           
688                               this.el.setVisibilityMode(Roo.Element.DISPLAY);
689                               
690                               this.el.hide();
691                           }
692                         },
693                         xns : Roo.bootstrap,
694                         '|xns' : 'Roo.bootstrap'
695                        }
696                       ]
697                      }
698                     ]
699                    }
700                   ]
701                  }
702                 ]
703                }
704               ]
705              },
706              {
707               xtype : 'Input',
708               inputType : 'hidden',
709               labelAlign : 'left',
710               name : 'id',
711               listeners : {
712                render : function (_self)
713                 {
714                     _this.userID = _self;
715                 }
716               },
717               xns : Roo.bootstrap,
718               '|xns' : 'Roo.bootstrap'
719              },
720              {
721               xtype : 'Input',
722               inputType : 'hidden',
723               name : 'company_id',
724               xns : Roo.bootstrap,
725               '|xns' : 'Roo.bootstrap'
726              },
727              {
728               xtype : 'Input',
729               inputType : 'hidden',
730               labelAlign : 'left',
731               name : 'membership_list',
732               xns : Roo.bootstrap,
733               '|xns' : 'Roo.bootstrap'
734              }
735             ]
736            }
737           ]
738          }
739         ]
740        },
741        {
742         xtype : 'Grid',
743         background : true,
744         fitContainer : true,
745         fitToFrame : true,
746         region : 'center',
747         title : _this._strings['566a352f95c879ff26e50bad767a28dc'] /* Group Membership */,
748         listeners : {
749          activate : function (_self)
750           {
751               if(_this.option_grid){
752                   _this.option_grid.store.load({});
753               }
754               
755           },
756          render : function (_self)
757           {
758               _this.option_panel = this;
759               
760               
761           }
762         },
763         xns : Roo.bootstrap.panel,
764         '|xns' : 'Roo.bootstrap.panel',
765         grid : {
766          xtype : 'Table',
767          cellSelection : false,
768          cls : 'table-fixed',
769          condensed : true,
770          footerShow : false,
771          loadMask : true,
772          rowSelection : true,
773          listeners : {
774           render : function (_self)
775            {
776                _this.option_grid = this;
777                
778                this.store.load({})
779            },
780           rowclick : function (_self, el, rowIndex, e)
781            {
782                //var di = this.colModel.getDataIndex(columnIndex);
783                
784                // check if the name is the result name from dataobject core_group_member
785                /*if (di != 'group_membership_user_id') {
786                    return;
787                }*/
788                
789                
790                
791                var rec = this.store.getAt(rowIndex);
792            
793                rec.set('group_membership_user_id', rec.data.group_membership_user_id * 1 == 0 ? -1 : 0);
794            
795                rec.commit();
796                
797                var membership_active_arr = [];
798                // loop throught the new list , rebuild the list of current options
799                
800                // record is the first parameter
801                
802                _this.option_grid.store.each(function(record){
803                    var gmuid = record.data.group_membership_user_id;
804                    var gid = record.data.id;
805                    if(gmuid * 1 != 0){
806                        membership_active_arr.push(gid);
807                    }
808                });
809                
810                var membership_active_list = "";
811                membership_active_list = membership_active_arr.join();
812                
813                _this.form.findField("membership_list").setValue(membership_active_list);
814            }
815          },
816          xns : Roo.bootstrap,
817          '|xns' : 'Roo.bootstrap',
818          store : {
819           xtype : 'Store',
820           remoteSort : true,
821           sortInfo : { direction : 'ASC', field: 'id' },
822           listeners : {
823            beforeload : function (_self, options)
824             { 
825                 options.params = options.params || {};
826                 
827                 options.params._with_membership_user = _this.data.id;
828             
829             }
830           },
831           xns : Roo.data,
832           '|xns' : 'Roo.data',
833           proxy : {
834            xtype : 'HttpProxy',
835            method : 'GET',
836            url : baseURL + '/Roo/core_group',
837            xns : Roo.data,
838            '|xns' : 'Roo.data'
839           },
840           reader : {
841            xtype : 'JsonReader',
842            id : 'id',
843            root : 'data',
844            xns : Roo.data,
845            '|xns' : 'Roo.data'
846           }
847          },
848          sm : {
849           xtype : 'RowSelectionModel',
850           singleSelect : true,
851           listeners : {
852            selectionchange : function (_self)
853             {
854                 /*_this.type_edit_btn.hide();
855                 
856                 if(this.getSelected()){
857                     _this.type_edit_btn.show();
858                 }*/
859                 
860                 _this.option_grid.store.load({});
861                 
862                 
863             }
864           },
865           xns : Roo.bootstrap.Table,
866           '|xns' : 'Roo.bootstrap.Table'
867          },
868          cm : [
869           {
870            xtype : 'ColumnModel',
871            align : 'center',
872            cursor : 'pointer',
873            dataIndex : 'group_membership_user_id',
874            header : _this._strings['4910043d0b2c8c864a0e8672716fee94'] /* Is a Member */,
875            renderer : function(v) {  
876            
877                var state = v > 0 ?  'check-' : '';
878                var cls = v > 0 ? 'text-primary' : '';
879                
880                return '<i class=\"far fa-'+ state + 'square-o ' + cls + '\" aria-hidden=\"true\"></i>';
881                     
882             },
883            sortable : false,
884            xs : 3,
885            xns : Roo.grid,
886            '|xns' : 'Roo.grid'
887           },
888           {
889            xtype : 'ColumnModel',
890            cursor : 'pointer',
891            dataIndex : 'name',
892            header : _this._strings['28974c2c793e780427dfb571b26443e6'] /* Group Name */,
893            sortable : true,
894            xs : 9,
895            xns : Roo.grid,
896            '|xns' : 'Roo.grid'
897           }
898          ]
899         }
900        }
901       ]
902      }
903     ]
904    }  );
905  }
906 });
907 Roo.apply(Pman.Dialog.BAdminStaff, Pman.Dialog.BAdminStaff.prototype);