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.layout.showPanel('DetailPanel');
221                       
222                       _this.dialog.setTitle("Add / Edit User");
223                       _this.form.findField('role').setDisabled(false);
224                           
225                       /*
226                       * Use for init -- Call from Pman.Login.js
227                       */
228                       if(typeof(_this.data.role) != 'undefined' && _this.data.role == 'Administrators') {
229                           _this.dialog.setTitle("Create Adminstrator");
230                           _this.form.findField('role').setDisabled(true);
231                       }
232                       
233                       _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
234                       _this.form.findField('passwd2').show();
235                       _this.passwordbox.collapse();
236                       
237                       _this.qrCodeBox.collapse();
238                       _this.qrCodeBox.el.hide();
239                       _this.form.findField('_enable_oath_key').setValue(1);
240                       _this.form.findField('_enable_oath_key').el.show();
241                       
242                       _this.generate_qrcode_btn.el.hide();
243                       _this.delete_qrcode_btn.el.hide();
244                       _this.show_qrcode_btn.el.hide();
245                       
246                       if(_this.data.id * 1 > 0) {
247                           this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
248                       }
249                       
250                       this.clearInvalid();
251                       
252                       return;
253                   }
254                  
255                   if (action.type == 'load') {
256                   
257                       _this.data = action.result.data;
258                       
259                       _this.qrCodeBox.el.show();
260                       _this.form.findField('_enable_oath_key').setValue(0);
261                       _this.form.findField('_enable_oath_key').el.hide();
262                       
263                       _this.generate_qrcode_btn.el.show();
264                       _this.delete_qrcode_btn.el.hide();
265                       _this.show_qrcode_btn.el.hide();
266                           
267                       _this.qrCodeBox.collapse();
268                       
269                       if(_this.data.length_oath_key * 1 > 0){
270                           _this.delete_qrcode_btn.el.show();
271                           _this.show_qrcode_btn.el.show();
272                           _this.qrCodeBox.expand();
273                       }
274                       
275                       return;
276                   }
277                   
278                   if (action.type == 'submit') { // only submitted here if we are 
279                   
280                       _this.dialog.hide();
281                      
282                       if (_this.callback) {
283                           _this.callback.call(this, action.result.data);
284                       }
285                       
286                       return;
287                       
288                   }
289               },
290              render : function (_self)
291               {
292                   _this.form = _self;
293                   
294               }
295             },
296             xns : Roo.bootstrap,
297             '|xns' : 'Roo.bootstrap',
298             items  : [
299              {
300               xtype : 'Row',
301               xns : Roo.bootstrap,
302               '|xns' : 'Roo.bootstrap',
303               items  : [
304                {
305                 xtype : 'Column',
306                 md : 12,
307                 xns : Roo.bootstrap,
308                 '|xns' : 'Roo.bootstrap',
309                 items  : [
310                  {
311                   xtype : 'Input',
312                   allowBlank : false,
313                   fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
314                   labelAlign : 'left',
315                   name : 'name',
316                   placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
317                   xns : Roo.bootstrap,
318                   '|xns' : 'Roo.bootstrap'
319                  }
320                 ]
321                }
322               ]
323              },
324              {
325               xtype : 'Row',
326               xns : Roo.bootstrap,
327               '|xns' : 'Roo.bootstrap',
328               items  : [
329                {
330                 xtype : 'Column',
331                 md : 12,
332                 xns : Roo.bootstrap,
333                 '|xns' : 'Roo.bootstrap',
334                 items  : [
335                  {
336                   xtype : 'Input',
337                   fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
338                   labelAlign : 'left',
339                   name : 'role',
340                   placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
341                   xns : Roo.bootstrap,
342                   '|xns' : 'Roo.bootstrap'
343                  }
344                 ]
345                }
346               ]
347              },
348              {
349               xtype : 'Row',
350               xns : Roo.bootstrap,
351               '|xns' : 'Roo.bootstrap',
352               items  : [
353                {
354                 xtype : 'Column',
355                 md : 12,
356                 xns : Roo.bootstrap,
357                 '|xns' : 'Roo.bootstrap',
358                 items  : [
359                  {
360                   xtype : 'Input',
361                   allowBlank : false,
362                   fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
363                   labelAlign : 'left',
364                   name : 'email',
365                   placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
366                   vtype : 'email',
367                   xns : Roo.bootstrap,
368                   '|xns' : 'Roo.bootstrap'
369                  }
370                 ]
371                }
372               ]
373              },
374              {
375               xtype : 'Row',
376               xns : Roo.bootstrap,
377               '|xns' : 'Roo.bootstrap',
378               items  : [
379                {
380                 xtype : 'Column',
381                 md : 12,
382                 xns : Roo.bootstrap,
383                 '|xns' : 'Roo.bootstrap',
384                 items  : [
385                  {
386                   xtype : 'Input',
387                   fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
388                   labelAlign : 'left',
389                   name : 'phone',
390                   xns : Roo.bootstrap,
391                   '|xns' : 'Roo.bootstrap'
392                  }
393                 ]
394                }
395               ]
396              },
397              {
398               xtype : 'Row',
399               xns : Roo.bootstrap,
400               '|xns' : 'Roo.bootstrap',
401               items  : [
402                {
403                 xtype : 'Column',
404                 md : 12,
405                 xns : Roo.bootstrap,
406                 '|xns' : 'Roo.bootstrap',
407                 items  : [
408                  {
409                   xtype : 'CheckBox',
410                   boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
411                   checked : true,
412                   name : '_enable_oath_key',
413                   listeners : {
414                    render : function (_self)
415                     {
416                         this.el.setVisibilityMode(Roo.Element.DISPLAY);
417                         
418                         this.el.hide();
419                     }
420                   },
421                   xns : Roo.bootstrap,
422                   '|xns' : 'Roo.bootstrap'
423                  }
424                 ]
425                }
426               ]
427              },
428              {
429               xtype : 'Row',
430               xns : Roo.bootstrap,
431               '|xns' : 'Roo.bootstrap',
432               items  : [
433                {
434                 xtype : 'Column',
435                 md : 12,
436                 xns : Roo.bootstrap,
437                 '|xns' : 'Roo.bootstrap',
438                 items  : [
439                  {
440                   xtype : 'Container',
441                   expandable : true,
442                   expanded : false,
443                   header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
444                   panel : 'primary',
445                   listeners : {
446                    render : function (_self)
447                     {
448                         _this.passwordbox = this;
449                     }
450                   },
451                   xns : Roo.bootstrap,
452                   '|xns' : 'Roo.bootstrap',
453                   items  : [
454                    {
455                     xtype : 'Row',
456                     xns : Roo.bootstrap,
457                     '|xns' : 'Roo.bootstrap',
458                     items  : [
459                      {
460                       xtype : 'Column',
461                       xs : 8,
462                       xns : Roo.bootstrap,
463                       '|xns' : 'Roo.bootstrap',
464                       items  : [
465                        {
466                         xtype : 'Input',
467                         inputType : 'password',
468                         name : 'passwd1',
469                         xns : Roo.bootstrap,
470                         '|xns' : 'Roo.bootstrap'
471                        }
472                       ]
473                      },
474                      {
475                       xtype : 'Column',
476                       xs : 4,
477                       xns : Roo.bootstrap,
478                       '|xns' : 'Roo.bootstrap',
479                       items  : [
480                        {
481                         xtype : 'Button',
482                         html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
483                         style : 'width:100%',
484                         listeners : {
485                          click : function (_self, e)
486                           {
487                               var pw = Math.random().toString(36).slice(-12);
488                               _this.form.findField('passwd1').el.select('input',true).first().dom.type="input";
489                               _this.form.findField('passwd1').setValue(pw);
490                               _this.form.findField('passwd2').hide();
491                               
492                               
493                           }
494                         },
495                         xns : Roo.bootstrap,
496                         '|xns' : 'Roo.bootstrap'
497                        }
498                       ]
499                      }
500                     ]
501                    },
502                    {
503                     xtype : 'Input',
504                     inputType : 'password',
505                     name : 'passwd2',
506                     placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
507                     xns : Roo.bootstrap,
508                     '|xns' : 'Roo.bootstrap'
509                    },
510                    {
511                     xtype : 'CheckBox',
512                     boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
513                     name : 'secure_passwords',
514                     xns : Roo.bootstrap,
515                     '|xns' : 'Roo.bootstrap'
516                    }
517                   ]
518                  }
519                 ]
520                }
521               ]
522              },
523              {
524               xtype : 'Row',
525               xns : Roo.bootstrap,
526               '|xns' : 'Roo.bootstrap',
527               items  : [
528                {
529                 xtype : 'Column',
530                 md : 12,
531                 xns : Roo.bootstrap,
532                 '|xns' : 'Roo.bootstrap',
533                 items  : [
534                  {
535                   xtype : 'Container',
536                   expandable : true,
537                   expanded : false,
538                   header : _this._strings['a60cdd3642fbe81545a3b93fe2b19dd6'] /* Two-Factor Authentication */,
539                   panel : 'primary',
540                   listeners : {
541                    render : function (_self)
542                     {
543                         _this.qrCodeBox = this;
544                         
545                         this.el.setVisibilityMode(Roo.Element.DISPLAY);
546                         
547                         this.el.hide();
548                     }
549                   },
550                   xns : Roo.bootstrap,
551                   '|xns' : 'Roo.bootstrap',
552                   items  : [
553                    {
554                     xtype : 'Row',
555                     xns : Roo.bootstrap,
556                     '|xns' : 'Roo.bootstrap',
557                     items  : [
558                      {
559                       xtype : 'Column',
560                       xs : 4,
561                       xns : Roo.bootstrap,
562                       '|xns' : 'Roo.bootstrap',
563                       items  : [
564                        {
565                         xtype : 'Button',
566                         html : _this._strings['73b00356c62eb391f571b6468be7c372'] /* Generate QR Code */,
567                         style : 'width:100%',
568                         listeners : {
569                          click : function (_self, e)
570                           {
571                               if(_this.data.id * 1 < 1){
572                                   Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
573                                   return;
574                               }
575                               
576                               new Pman.Request({
577                                   url: baseURL + '/Roo/Core_person.php',
578                                   method : 'POST',
579                                   mask : 'Loading...',
580                                   params : {
581                                       id : _this.data.id,
582                                       _generate_oath_key : 1
583                                   }, 
584                                   success : function(res) {
585                                       _this.delete_qrcode_btn.el.show();
586                                       _this.show_qrcode_btn.el.show();
587                                       
588                                       Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
589                                           id : _this.data.id
590                                       });
591                                       
592                                       return;
593                                   }
594                               });
595                           },
596                          render : function (_self)
597                           {
598                               _this.generate_qrcode_btn = this;
599                           
600                               this.el.setVisibilityMode(Roo.Element.DISPLAY);
601                               
602                               this.el.hide();
603                           }
604                         },
605                         xns : Roo.bootstrap,
606                         '|xns' : 'Roo.bootstrap'
607                        }
608                       ]
609                      },
610                      {
611                       xtype : 'Column',
612                       xs : 4,
613                       xns : Roo.bootstrap,
614                       '|xns' : 'Roo.bootstrap',
615                       items  : [
616                        {
617                         xtype : 'Button',
618                         html : _this._strings['1960f813085537c64f981132e34181ca'] /* Delete QR Code */,
619                         style : 'width:100%',
620                         listeners : {
621                          click : function (_self, e)
622                           {
623                               if(_this.data.id * 1 < 1){
624                                   Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
625                                   return;
626                               }
627                               
628                               new Pman.Request({
629                                   url: baseURL + '/Roo/Core_person.php',
630                                   method : 'POST',
631                                   mask : 'Loading...',
632                                   params : {
633                                       id : _this.data.id,
634                                       oath_key : ''
635                                   }, 
636                                   success : function(res) {
637                                       _this.delete_qrcode_btn.el.hide();
638                                       _this.show_qrcode_btn.el.hide();
639                                       
640                                       return;
641                                   }
642                               });
643                           },
644                          render : function (_self)
645                           {
646                               _this.delete_qrcode_btn = this;
647                           
648                               this.el.setVisibilityMode(Roo.Element.DISPLAY);
649                               
650                               this.el.hide();
651                           }
652                         },
653                         xns : Roo.bootstrap,
654                         '|xns' : 'Roo.bootstrap'
655                        }
656                       ]
657                      },
658                      {
659                       xtype : 'Column',
660                       xs : 4,
661                       xns : Roo.bootstrap,
662                       '|xns' : 'Roo.bootstrap',
663                       items  : [
664                        {
665                         xtype : 'Button',
666                         html : _this._strings['a6b81fd617c4f1b94f83049793cac3cd'] /* Show QR Code */,
667                         style : 'width:100%',
668                         listeners : {
669                          click : function (_self, e)
670                           {
671                               if(_this.data.id * 1 < 1){
672                                   Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
673                                   return;
674                               }
675                               
676                               Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
677                                   id : _this.data.id
678                               });
679                           },
680                          render : function (_self)
681                           {
682                               _this.show_qrcode_btn = this;
683                           
684                               this.el.setVisibilityMode(Roo.Element.DISPLAY);
685                               
686                               this.el.hide();
687                           }
688                         },
689                         xns : Roo.bootstrap,
690                         '|xns' : 'Roo.bootstrap'
691                        }
692                       ]
693                      }
694                     ]
695                    }
696                   ]
697                  }
698                 ]
699                }
700               ]
701              },
702              {
703               xtype : 'Input',
704               inputType : 'hidden',
705               labelAlign : 'left',
706               name : 'id',
707               listeners : {
708                render : function (_self)
709                 {
710                     _this.userID = _self;
711                 }
712               },
713               xns : Roo.bootstrap,
714               '|xns' : 'Roo.bootstrap'
715              },
716              {
717               xtype : 'Input',
718               inputType : 'hidden',
719               name : 'company_id',
720               xns : Roo.bootstrap,
721               '|xns' : 'Roo.bootstrap'
722              }
723             ]
724            }
725           ]
726          }
727         ]
728        },
729        {
730         xtype : 'Grid',
731         background : true,
732         fitContainer : true,
733         fitToFrame : true,
734         region : 'center',
735         title : _this._strings['566a352f95c879ff26e50bad767a28dc'] /* Group Membership */,
736         listeners : {
737          activate : function (_self)
738           {
739               if(_this.option_grid){
740                   _this.option_grid.store.load({});
741               }
742               
743           },
744          render : function (_self)
745           {
746               _this.option_panel = this;
747               
748               
749           }
750         },
751         xns : Roo.bootstrap.panel,
752         '|xns' : 'Roo.bootstrap.panel',
753         grid : {
754          xtype : 'Table',
755          cellSelection : true,
756          cls : 'table-fixed',
757          condensed : true,
758          footerShow : false,
759          loadMask : true,
760          rowSelection : true,
761          listeners : {
762           cellclick : function (_self, el, rowIndex, columnIndex, e)
763            {
764                var di = _this.option_grid.colModel.getDataIndex(columnIndex);
765                
766                if (di != 'is_in_group') {
767                    return;
768                }
769                 
770                var rec = _this.option_grid.store.getAt(rowIndex);
771                
772                rec.set('is_in_group', rec.data.is_in_group ? 0 : 1);
773                rec.commit();
774            
775            },
776           render : function (_self)
777            {
778                _this.option_grid = this;
779                
780                this.store.load({})
781            }
782          },
783          xns : Roo.bootstrap,
784          '|xns' : 'Roo.bootstrap',
785          store : {
786           xtype : 'Store',
787           remoteSort : true,
788           sortInfo : { direction : 'ASC', field: 'id' },
789           listeners : {
790            beforeload : function (_self, options)
791             { 
792                 options.params = options.params || {};
793                 
794                 if(_this.data.id * 1 < 1){
795                     _this.option_grid.el.mask('Please save the member first');
796                     this.removeAll();
797                     return false;
798                 }
799                 
800                 options.params._is_in_group = _this.data.id;
801             
802             },
803            update : function (_self, record, operation)
804             {
805                 if (operation != 'commit') {
806                     return;
807                 }
808                 
809                 var params = {
810                     user_ids : _this.data.id,
811                     _action : (record.data.is_in_group * 1 == 0) ? 'sub' : 'add',
812                     group_id : record.data.id
813                 };
814                 
815                 new Pman.Request({
816                     url : baseURL + '/Roo/Core_group',
817                     method : 'POST',
818                     params : params,
819                     success : function() { 
820                         _this.option_grid.ds.load({});
821                     }
822               });
823             }
824           },
825           xns : Roo.data,
826           '|xns' : 'Roo.data',
827           proxy : {
828            xtype : 'HttpProxy',
829            method : 'GET',
830            url : baseURL + '/Roo/core_group',
831            xns : Roo.data,
832            '|xns' : 'Roo.data'
833           },
834           reader : {
835            xtype : 'JsonReader',
836            fields : [
837                {
838                    'name': 'id',
839                    'type': 'int'
840                },
841                {
842                    'name': 'name',
843                    'type': 'string'
844                },
845                {
846                    'name': 'display_name',
847                    'type': 'string'
848                },
849                {
850                    'name': 'is_in_group',
851                    'type': 'int'
852                }
853            ],
854            id : 'id',
855            root : 'data',
856            xns : Roo.data,
857            '|xns' : 'Roo.data'
858           }
859          },
860          sm : {
861           xtype : 'RowSelectionModel',
862           singleSelect : true,
863           xns : Roo.bootstrap.Table,
864           '|xns' : 'Roo.bootstrap.Table'
865          },
866          cm : [
867           {
868            xtype : 'ColumnModel',
869            align : 'center',
870            cursor : 'pointer',
871            dataIndex : 'is_in_group',
872            header : _this._strings['4910043d0b2c8c864a0e8672716fee94'] /* Is a Member */,
873            renderer : function(v) {  
874            
875                var state = v > 0 ?  'check-' : '';
876                var cls = v > 0 ? 'text-primary' : '';
877                
878                return '<i class=\"far fa-'+ state + 'square-o ' + cls + '\" aria-hidden=\"true\"></i>';
879                     
880             },
881            sortable : false,
882            xs : 3,
883            xns : Roo.grid,
884            '|xns' : 'Roo.grid'
885           },
886           {
887            xtype : 'ColumnModel',
888            cursor : 'pointer',
889            dataIndex : 'display_name',
890            header : _this._strings['28974c2c793e780427dfb571b26443e6'] /* Group Name */,
891            renderer : function(v,x,r) 
892            {
893                var vv = v.length ? v : r.data.name;
894                
895                return String.format('{0}', vv);
896            },
897            sortable : true,
898            xs : 9,
899            xns : Roo.grid,
900            '|xns' : 'Roo.grid'
901           }
902          ]
903         }
904        }
905       ]
906      }
907     ]
908    }  );
909  }
910 });
911 Roo.apply(Pman.Dialog.BAdminStaff, Pman.Dialog.BAdminStaff.prototype);