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