1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Dialog');
7 Pman.Dialog.BAdminStaff= function() {}
8 Roo.apply(Pman.Dialog.BAdminStaff.prototype, {
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"
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 */
48 show : function(data, cb)
56 this.dialog.show(this.data._el);
59 this.form.setValues(data);
60 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
68 this.dialog = Roo.factory({
70 cls : 'add-user-dialog',
72 title : _this._strings['a0f852ef8bfccd86a0e7217d7959e3e8'] /* Add / Edit User */,
74 render : function (_self)
76 this.bodyEl.setHeight(600);
78 show : function (_self)
80 //_this.dialog.items[0].getRegion('center').showPanel(0);
82 //setting first adminstrator in open system
84 if(typeof(_this.data.role) != 'undefined' && _this.data.role == 'Administrators') {
86 Roo.select('.add-user-dialog .modal-title').first().dom.innerHTML = "Create Adminstrator";
88 _this.form.findField('role').inputEl().dom.disabled = true;
90 _this.layout.showPanel('DetailPanel');
94 '|xns' : 'Roo.bootstrap',
98 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
100 click : function (_self, e)
106 '|xns' : 'Roo.bootstrap'
110 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
113 click : function (_self, e)
115 if(!_this.form.isValid()){
116 //Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
120 var myID = _this.form.findField('id').getValue() * 1;
121 var myName = _this.form.findField('name').getValue();
123 if (_this.form.findField('company_id') && !_this.form.findField('company_id').getValue()) {
124 Roo.bootstrap.MessageBox.alert("Error", "Select a Company");
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") {
133 var p1 = _this.form.findField('passwd1').getValue();
134 var p2 = _this.form.findField('passwd2').getValue();
137 if (Pman.Login.authUser.id < 0 && !p1.length) {
138 Roo.bootstrap.MessageBox.alert("Error", "You must create a password for the admin account");
143 if (p1.length || p2.length) {
145 Roo.bootstrap.MessageBox.alert("Error", "Passwords do not match");
153 // get the list of record with tick
155 _this.form.doAction("submit");
162 '|xns' : 'Roo.bootstrap'
169 render : function (_self)
171 _this.layout = _self;
174 xns : Roo.bootstrap.layout,
175 '|xns' : 'Roo.bootstrap.layout',
178 alwaysShowTabs : true,
180 xns : Roo.bootstrap.layout,
181 '|xns' : 'Roo.bootstrap.layout'
192 title : _this._strings['3ec365dd533ddb7ef3d1c111186ce872'] /* Details */,
194 activate : function (_self)
196 /*var url = 'about:blank';
198 if(_this.data.id * 1 > 0){
199 url = baseURL + '/Coba/Report/ApplicationSummary/' + _this.data.id;
202 _this.app_summary_frame.el.dom.src = url;*/
205 render : function (_self)
207 _this.detail_tab = _self;
210 xns : Roo.bootstrap.panel,
211 '|xns' : 'Roo.bootstrap.panel',
217 '|xns' : 'Roo.bootstrap',
223 style : 'margin-top: 20px;',
224 url : baseURL + '/Roo/core_person',
226 actioncomplete : function (_self, action)
228 if(action.type == 'setdata'){
230 _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
231 _this.form.findField('passwd2').show();
232 _this.passwordbox.collapse();
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();
239 _this.generate_qrcode_btn.el.hide();
240 _this.delete_qrcode_btn.el.hide();
241 _this.show_qrcode_btn.el.hide();
243 if(_this.data.id * 1 > 0) {
244 this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
252 if (action.type == 'load') {
254 _this.data = action.result.data;
256 _this.qrCodeBox.el.show();
257 _this.form.findField('_enable_oath_key').setValue(0);
258 _this.form.findField('_enable_oath_key').el.hide();
260 _this.generate_qrcode_btn.el.show();
261 _this.delete_qrcode_btn.el.hide();
262 _this.show_qrcode_btn.el.hide();
264 _this.qrCodeBox.collapse();
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();
275 if (action.type == 'submit') { // only submitted here if we are
279 if (_this.callback) {
280 _this.callback.call(this, action.result.data);
287 beforeaction : function (_self, action)
291 render : function (_self)
295 //_this.findField('group_membership').setValue
297 console.log(_this.form.data);
301 '|xns' : 'Roo.bootstrap',
306 '|xns' : 'Roo.bootstrap',
312 '|xns' : 'Roo.bootstrap',
317 fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
320 placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
322 '|xns' : 'Roo.bootstrap'
331 '|xns' : 'Roo.bootstrap',
337 '|xns' : 'Roo.bootstrap',
341 fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
344 placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
346 '|xns' : 'Roo.bootstrap'
355 '|xns' : 'Roo.bootstrap',
361 '|xns' : 'Roo.bootstrap',
366 fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
369 placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
372 '|xns' : 'Roo.bootstrap'
381 '|xns' : 'Roo.bootstrap',
387 '|xns' : 'Roo.bootstrap',
391 fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
395 '|xns' : 'Roo.bootstrap'
404 '|xns' : 'Roo.bootstrap',
410 '|xns' : 'Roo.bootstrap',
414 boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
416 name : '_enable_oath_key',
418 render : function (_self)
420 this.el.setVisibilityMode(Roo.Element.DISPLAY);
426 '|xns' : 'Roo.bootstrap'
435 '|xns' : 'Roo.bootstrap',
441 '|xns' : 'Roo.bootstrap',
447 header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
450 render : function (_self)
452 _this.passwordbox = this;
456 '|xns' : 'Roo.bootstrap',
461 '|xns' : 'Roo.bootstrap',
467 '|xns' : 'Roo.bootstrap',
471 inputType : 'password',
474 '|xns' : 'Roo.bootstrap'
482 '|xns' : 'Roo.bootstrap',
486 html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
487 style : 'width:100%',
489 click : function (_self, e)
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();
500 '|xns' : 'Roo.bootstrap'
508 inputType : 'password',
510 placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
512 '|xns' : 'Roo.bootstrap'
516 boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
517 name : 'secure_passwords',
519 '|xns' : 'Roo.bootstrap'
530 '|xns' : 'Roo.bootstrap',
536 '|xns' : 'Roo.bootstrap',
542 header : _this._strings['a60cdd3642fbe81545a3b93fe2b19dd6'] /* Two-Factor Authentication */,
545 render : function (_self)
547 _this.qrCodeBox = this;
549 this.el.setVisibilityMode(Roo.Element.DISPLAY);
555 '|xns' : 'Roo.bootstrap',
560 '|xns' : 'Roo.bootstrap',
566 '|xns' : 'Roo.bootstrap',
570 html : _this._strings['73b00356c62eb391f571b6468be7c372'] /* Generate QR Code */,
571 style : 'width:100%',
573 click : function (_self, e)
575 if(_this.data.id * 1 < 1){
576 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
581 url: baseURL + '/Roo/Core_person.php',
586 _generate_oath_key : 1
588 success : function(res) {
589 _this.delete_qrcode_btn.el.show();
590 _this.show_qrcode_btn.el.show();
592 Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
600 render : function (_self)
602 _this.generate_qrcode_btn = this;
604 this.el.setVisibilityMode(Roo.Element.DISPLAY);
610 '|xns' : 'Roo.bootstrap'
618 '|xns' : 'Roo.bootstrap',
622 html : _this._strings['1960f813085537c64f981132e34181ca'] /* Delete QR Code */,
623 style : 'width:100%',
625 click : function (_self, e)
627 if(_this.data.id * 1 < 1){
628 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
633 url: baseURL + '/Roo/Core_person.php',
640 success : function(res) {
641 _this.delete_qrcode_btn.el.hide();
642 _this.show_qrcode_btn.el.hide();
648 render : function (_self)
650 _this.delete_qrcode_btn = this;
652 this.el.setVisibilityMode(Roo.Element.DISPLAY);
658 '|xns' : 'Roo.bootstrap'
666 '|xns' : 'Roo.bootstrap',
670 html : _this._strings['a6b81fd617c4f1b94f83049793cac3cd'] /* Show QR Code */,
671 style : 'width:100%',
673 click : function (_self, e)
675 if(_this.data.id * 1 < 1){
676 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
680 Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
684 render : function (_self)
686 _this.show_qrcode_btn = this;
688 this.el.setVisibilityMode(Roo.Element.DISPLAY);
694 '|xns' : 'Roo.bootstrap'
708 inputType : 'hidden',
712 render : function (_self)
714 _this.userID = _self;
718 '|xns' : 'Roo.bootstrap'
722 inputType : 'hidden',
725 '|xns' : 'Roo.bootstrap'
729 inputType : 'hidden',
731 name : 'membership_list',
733 '|xns' : 'Roo.bootstrap'
747 title : _this._strings['566a352f95c879ff26e50bad767a28dc'] /* Group Membership */,
749 activate : function (_self)
751 if(_this.option_grid){
752 _this.option_grid.store.load({});
756 render : function (_self)
758 _this.option_panel = this;
763 xns : Roo.bootstrap.panel,
764 '|xns' : 'Roo.bootstrap.panel',
767 cellSelection : false,
774 render : function (_self)
776 _this.option_grid = this;
780 rowclick : function (_self, el, rowIndex, e)
782 //var di = this.colModel.getDataIndex(columnIndex);
784 // check if the name is the result name from dataobject core_group_member
785 /*if (di != 'group_membership_user_id') {
791 var rec = this.store.getAt(rowIndex);
793 rec.set('group_membership_user_id', rec.data.group_membership_user_id * 1 == 0 ? -1 : 0);
797 var membership_active_arr = [];
798 // loop throught the new list , rebuild the list of current options
800 // record is the first parameter
802 _this.option_grid.store.each(function(record){
803 var gmuid = record.data.group_membership_user_id;
804 var gid = record.data.id;
806 membership_active_arr.push(gid);
810 var membership_active_list = "";
811 membership_active_list = membership_active_arr.join();
813 _this.form.findField("membership_list").setValue(membership_active_list);
817 '|xns' : 'Roo.bootstrap',
821 sortInfo : { direction : 'ASC', field: 'id' },
823 beforeload : function (_self, options)
825 options.params = options.params || {};
827 options.params._with_membership_user = _this.data.id;
836 url : baseURL + '/Roo/core_group',
841 xtype : 'JsonReader',
849 xtype : 'RowSelectionModel',
852 selectionchange : function (_self)
854 /*_this.type_edit_btn.hide();
856 if(this.getSelected()){
857 _this.type_edit_btn.show();
860 _this.option_grid.store.load({});
865 xns : Roo.bootstrap.Table,
866 '|xns' : 'Roo.bootstrap.Table'
870 xtype : 'ColumnModel',
873 dataIndex : 'group_membership_user_id',
874 header : _this._strings['4910043d0b2c8c864a0e8672716fee94'] /* Is a Member */,
875 renderer : function(v) {
877 var state = v > 0 ? 'check-' : '';
878 var cls = v > 0 ? 'text-primary' : '';
880 return '<i class=\"far fa-'+ state + 'square-o ' + cls + '\" aria-hidden=\"true\"></i>';
889 xtype : 'ColumnModel',
892 header : _this._strings['28974c2c793e780427dfb571b26443e6'] /* Group Name */,
907 Roo.apply(Pman.Dialog.BAdminStaff, Pman.Dialog.BAdminStaff.prototype);