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 '28974c2c793e780427dfb571b26443e6' :"Group Name",
15 'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
16 'a0f852ef8bfccd86a0e7217d7959e3e8' :"Add / Edit User",
17 '3ec365dd533ddb7ef3d1c111186ce872' :"Details",
18 '0bfe42db3eb05bf39f03812166391939' :"Use Secure Passwords",
19 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
20 '6f958ddaf50fd5ade7858ef1d1a63e51' :"Type again to confirm",
21 '49ee3087348e8d44e1feda1917443987' :"Name",
22 'bbbabdbe1b262f75d99d62880b953be1' :"Role",
23 'c9cc8cce247e49bae79f15173ce97354' :"Save",
24 '828e70f83623b262e14187c039df99c0' :"Enable Two-Factor Authentication",
25 'acf45fd8829f809b29c601a3a193804f' :"Set / Change Password",
26 '01028205a11cf95a503c4c1d005989da' :"Generate One"
29 'email_placeholder' : 'ce8ae9da5b7cd6c3df2929543a9af92d' /* Email */ ,
30 'secure_passwords_boxLabel' : '0bfe42db3eb05bf39f03812166391939' /* Use Secure Passwords */ ,
31 'name_placeholder' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
32 'role_fieldLabel' : 'bbbabdbe1b262f75d99d62880b953be1' /* Role */ ,
33 'name_fieldLabel' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
34 'role_placeholder' : 'bbbabdbe1b262f75d99d62880b953be1' /* Role */ ,
35 'phone_fieldLabel' : 'bcc254b55c4a1babdf1dcb82c207506b' /* Phone */ ,
36 '_enable_oath_key_boxLabel' : '828e70f83623b262e14187c039df99c0' /* Enable Two-Factor Authentication */ ,
37 'email_fieldLabel' : 'ce8ae9da5b7cd6c3df2929543a9af92d' /* Email */ ,
38 'passwd2_placeholder' : '6f958ddaf50fd5ade7858ef1d1a63e51' /* Type again to confirm */
44 show : function(data, cb)
52 this.dialog.show(this.data._el);
55 this.form.setValues(data);
56 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
64 this.dialog = Roo.factory({
66 cls : 'add-user-dialog',
70 title : _this._strings['a0f852ef8bfccd86a0e7217d7959e3e8'] /* Add / Edit User */,
72 render : function (_self)
78 '|xns' : 'Roo.bootstrap',
82 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
84 click : function (_self, e)
90 '|xns' : 'Roo.bootstrap'
94 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
97 click : function (_self, e)
99 if(!_this.form.isValid()){
100 //Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
104 var myID = _this.form.findField('id').getValue() * 1;
105 var myName = _this.form.findField('name').getValue();
107 if (_this.form.findField('company_id') && !_this.form.findField('company_id').getValue()) {
108 Roo.bootstrap.MessageBox.alert("Error", "Select a Company");
112 // validate password match (only needed if we are not using generated one..
113 if (_this.form.findField('passwd1')
114 && _this.form.findField('passwd1').getValue().length > 0
115 && _this.form.findField('passwd1').inputEl().dom.type == "password") {
117 var p1 = _this.form.findField('passwd1').getValue();
118 var p2 = _this.form.findField('passwd2').getValue();
121 if (Pman.Login.authUser.id < 0 && !p1.length) {
122 Roo.bootstrap.MessageBox.alert("Error", "You must create a password for the admin account");
127 if (p1.length || p2.length) {
129 Roo.bootstrap.MessageBox.alert("Error", "Passwords do not match");
137 // get the list of record with tick
139 _this.form.doAction("submit");
146 '|xns' : 'Roo.bootstrap'
153 render : function (_self)
155 _this.layout = _self;
158 xns : Roo.bootstrap.layout,
159 '|xns' : 'Roo.bootstrap.layout',
162 alwaysShowTabs : true,
164 xns : Roo.bootstrap.layout,
165 '|xns' : 'Roo.bootstrap.layout'
176 title : _this._strings['3ec365dd533ddb7ef3d1c111186ce872'] /* Details */,
178 activate : function (_self)
180 /*var url = 'about:blank';
182 if(_this.data.id * 1 > 0){
183 url = baseURL + '/Coba/Report/ApplicationSummary/' + _this.data.id;
186 _this.app_summary_frame.el.dom.src = url;*/
188 render : function (_self)
190 _this.detail_tab = _self;
193 xns : Roo.bootstrap.panel,
194 '|xns' : 'Roo.bootstrap.panel',
200 '|xns' : 'Roo.bootstrap',
206 style : 'margin-top: 20px;',
207 url : baseURL + '/Roo/core_person',
209 actioncomplete : function (_self, action)
211 if(action.type == 'setdata'){
213 _this.layout.showPanel('DetailPanel');
215 _this.dialog.setTitle("Add / Edit User");
216 _this.form.findField('role').setDisabled(false);
219 * Use for init -- Call from Pman.Login.js
222 typeof(_this.data.role) != 'undefined' &&
223 _this.data.role == 'Administrators'
225 _this.dialog.setTitle("Create Adminstrator");
226 _this.form.findField('role').setDisabled(true);
229 _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
230 _this.form.findField('passwd2').show();
231 _this.passwordbox.collapse();
233 _this.form.findField('secure_passwords').setValue(1);
235 if(_this.data.id * 1 > 0) {
236 this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
241 _this.dialog.resize();
246 if (action.type == 'load') {
248 _this.data = action.result.data;
250 _this.form.findField('_enable_oath_key').setChecked(false,false);
252 if(_this.data.length_oath_key.length > 0) {
253 _this.form.findField('_enable_oath_key').setChecked(true,false);
259 if (action.type == 'submit') { // only submitted here if we are
263 if (_this.callback) {
264 _this.callback.call(this, action.result.data);
270 render : function (_self)
276 '|xns' : 'Roo.bootstrap',
281 '|xns' : 'Roo.bootstrap',
287 '|xns' : 'Roo.bootstrap',
292 fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
295 placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
297 '|xns' : 'Roo.bootstrap'
306 '|xns' : 'Roo.bootstrap',
312 '|xns' : 'Roo.bootstrap',
316 fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
319 placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
321 '|xns' : 'Roo.bootstrap'
330 '|xns' : 'Roo.bootstrap',
336 '|xns' : 'Roo.bootstrap',
341 fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
344 placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
347 '|xns' : 'Roo.bootstrap'
356 '|xns' : 'Roo.bootstrap',
362 '|xns' : 'Roo.bootstrap',
366 fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
370 '|xns' : 'Roo.bootstrap'
379 '|xns' : 'Roo.bootstrap',
385 '|xns' : 'Roo.bootstrap',
389 boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
390 name : '_enable_oath_key',
392 check : function (_self, checked)
396 this.setBoxLabel('Untick to disable Two Factor authentication');
401 this.setBoxLabel('Enable Two Factor Authentication');
403 click : function (_self, e)
409 Pman.Dialog.BAdminStaffTwoFactorQRCode.show(
413 function(){_this.dialog.hide({})}
420 url : baseURL + '/Roo/Core_person',
425 success : function(res)
429 Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');
432 Roo.log('invalid usage');
436 failure : function(res)
438 Roo.bootstrap.MessageBox.alert('Error', res);
444 '|xns' : 'Roo.bootstrap'
453 '|xns' : 'Roo.bootstrap',
459 '|xns' : 'Roo.bootstrap',
465 header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
468 render : function (_self)
470 _this.passwordbox = this;
474 '|xns' : 'Roo.bootstrap',
479 '|xns' : 'Roo.bootstrap',
485 '|xns' : 'Roo.bootstrap',
489 inputType : 'password',
492 '|xns' : 'Roo.bootstrap'
500 '|xns' : 'Roo.bootstrap',
504 html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
505 style : 'width:100%',
507 click : function (_self, e)
509 var pw = Math.random().toString(36).replace('0.', '');
510 _this.form.findField('passwd1').el.select('input',true).first().dom.type="input";
511 _this.form.findField('passwd1').setValue(pw);
512 _this.form.findField('passwd2').hide();
516 '|xns' : 'Roo.bootstrap'
524 inputType : 'password',
526 placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
528 '|xns' : 'Roo.bootstrap'
532 boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
533 name : 'secure_passwords',
535 '|xns' : 'Roo.bootstrap'
545 inputType : 'hidden',
549 render : function (_self)
551 _this.userID = _self;
555 '|xns' : 'Roo.bootstrap'
559 inputType : 'hidden',
562 '|xns' : 'Roo.bootstrap'
576 title : _this._strings['566a352f95c879ff26e50bad767a28dc'] /* Group Membership */,
578 activate : function (_self)
580 if(_this.option_grid){
581 _this.option_grid.store.load({});
585 render : function (_self)
587 _this.option_panel = this;
592 xns : Roo.bootstrap.panel,
593 '|xns' : 'Roo.bootstrap.panel',
596 cellSelection : true,
601 rowSelection : false,
603 cellclick : function (_self, el, rowIndex, columnIndex, e)
605 var di = _this.option_grid.colModel.getDataIndex(columnIndex);
608 if (di != 'is_in_group') {
612 var rec = _this.option_grid.store.getAt(rowIndex);
614 if(rec.data.name == 'Administrators' && _this.data.id == Pman.Login.authUser.id){
615 Roo.bootstrap.MessageBox.alert('Error', 'You can not remove yourself from Administrators group');
619 rec.set('is_in_group', rec.data.is_in_group * 1 == 1 ? 0 : 1);
623 render : function (_self)
625 _this.option_grid = this;
631 '|xns' : 'Roo.bootstrap',
635 sortInfo : { direction : 'ASC', field: 'id' },
637 beforeload : function (_self, options)
639 options.params = options.params || {};
641 if(_this.data.id * 1 < 1){
642 _this.option_grid.el.mask('Please save the member first');
647 options.params._is_in_group = _this.data.id;
650 update : function (_self, record, operation)
652 if (operation != 'commit') {
657 user_ids : _this.data.id,
658 _action : (record.data.is_in_group * 1 == 0) ? 'sub' : 'add',
659 group_id : record.data.id
663 url : baseURL + '/Roo/Core_group',
666 success : function() {
667 //_this.option_grid.ds.load({});
677 url : baseURL + '/Roo/core_group',
682 xtype : 'JsonReader',
693 'name': 'display_name',
697 'name': 'is_in_group',
708 xtype : 'RowSelectionModel',
710 xns : Roo.bootstrap.Table,
711 '|xns' : 'Roo.bootstrap.Table'
715 xtype : 'ColumnModel',
718 dataIndex : 'is_in_group',
719 header : _this._strings['4910043d0b2c8c864a0e8672716fee94'] /* Is a Member */,
720 renderer : function(v) {
722 var state = v > 0 ? 'check-' : '';
723 var cls = v > 0 ? 'text-primary' : '';
725 return '<i class=\"far fa-'+ state + 'square-o ' + cls + '\" aria-hidden=\"true\"></i>';
734 xtype : 'ColumnModel',
736 dataIndex : 'display_name',
737 header : _this._strings['28974c2c793e780427dfb571b26443e6'] /* Group Name */,
738 renderer : function(v,x,r)
740 var vv = v.length ? v : r.data.name;
742 return String.format('{0}', vv);
758 Roo.apply(Pman.Dialog.BAdminStaff, Pman.Dialog.BAdminStaff.prototype);