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 }});
243 _this.dialog.resize();
248 if (action.type == 'load') {
250 _this.data = action.result.data;
254 _this.form.findField('_enable_oath_key').setChecked(false,false);
256 if(_this.data.length_oath_key != '0') {
257 _this.form.findField('_enable_oath_key').setChecked(true,false);
263 if (action.type == 'submit') { // only submitted here if we are
267 if (_this.callback) {
268 _this.callback.call(this, action.result.data);
274 render : function (_self)
280 '|xns' : 'Roo.bootstrap',
285 '|xns' : 'Roo.bootstrap',
291 '|xns' : 'Roo.bootstrap',
296 fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
299 placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
301 '|xns' : 'Roo.bootstrap'
310 '|xns' : 'Roo.bootstrap',
316 '|xns' : 'Roo.bootstrap',
320 fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
323 placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
325 '|xns' : 'Roo.bootstrap'
334 '|xns' : 'Roo.bootstrap',
340 '|xns' : 'Roo.bootstrap',
345 fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
348 placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
351 '|xns' : 'Roo.bootstrap'
360 '|xns' : 'Roo.bootstrap',
366 '|xns' : 'Roo.bootstrap',
370 fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
374 '|xns' : 'Roo.bootstrap'
383 '|xns' : 'Roo.bootstrap',
389 '|xns' : 'Roo.bootstrap',
393 boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
394 name : '_enable_oath_key',
396 check : function (_self, checked)
400 this.setBoxLabel('Untick to disable Two Factor authentication');
405 this.setBoxLabel('Enable Two Factor Authentication');
407 click : function (_self, e)
409 if(!Pman.Login.authUser) {
410 Roo.bootstrap.MessageBox.alert('Error', 'Please login again');
418 Pman.Dialog.BAdminStaffTwoFactorQRCode.show(
422 _this.dialog.hide({});
426 _this.form.findField('_enable_oath_key').setChecked(false,false);
434 url : baseURL + '/Roo/Core_person',
440 success : function(res)
444 Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');
447 Roo.log('invalid usage');
451 failure : function(res)
453 Roo.bootstrap.MessageBox.alert('Error', res);
459 '|xns' : 'Roo.bootstrap'
468 '|xns' : 'Roo.bootstrap',
474 '|xns' : 'Roo.bootstrap',
480 header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
483 render : function (_self)
485 _this.passwordbox = this;
489 '|xns' : 'Roo.bootstrap',
494 '|xns' : 'Roo.bootstrap',
500 '|xns' : 'Roo.bootstrap',
504 inputType : 'password',
507 '|xns' : 'Roo.bootstrap'
515 '|xns' : 'Roo.bootstrap',
519 html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
520 style : 'width:100%',
522 click : function (_self, e)
524 var pw = Math.random().toString(36).replace('0.', '');
525 _this.form.findField('passwd1').el.select('input',true).first().dom.type="input";
526 _this.form.findField('passwd1').setValue(pw);
527 _this.form.findField('passwd2').hide();
531 '|xns' : 'Roo.bootstrap'
539 inputType : 'password',
541 placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
543 '|xns' : 'Roo.bootstrap'
547 boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
548 name : 'secure_passwords',
550 '|xns' : 'Roo.bootstrap'
560 inputType : 'hidden',
564 render : function (_self)
566 _this.userID = _self;
570 '|xns' : 'Roo.bootstrap'
574 inputType : 'hidden',
577 '|xns' : 'Roo.bootstrap'
591 title : _this._strings['566a352f95c879ff26e50bad767a28dc'] /* Group Membership */,
593 activate : function (_self)
595 if(_this.option_grid){
596 _this.option_grid.store.load({});
600 render : function (_self)
602 _this.option_panel = this;
607 xns : Roo.bootstrap.panel,
608 '|xns' : 'Roo.bootstrap.panel',
611 cellSelection : true,
616 rowSelection : false,
618 cellclick : function (_self, el, rowIndex, columnIndex, e)
620 var di = _this.option_grid.colModel.getDataIndex(columnIndex);
623 if (di != 'is_in_group') {
627 var rec = _this.option_grid.store.getAt(rowIndex);
629 if(rec.data.name == 'Administrators' && _this.data.id == Pman.Login.authUser.id){
630 Roo.bootstrap.MessageBox.alert('Error', 'You can not remove yourself from Administrators group');
634 rec.set('is_in_group', rec.data.is_in_group * 1 == 1 ? 0 : 1);
638 render : function (_self)
640 _this.option_grid = this;
646 '|xns' : 'Roo.bootstrap',
650 sortInfo : { direction : 'ASC', field: 'id' },
652 beforeload : function (_self, options)
654 options.params = options.params || {};
656 if(_this.data.id * 1 < 1){
657 _this.option_grid.el.mask('Please save the member first');
662 options.params._is_in_group = _this.data.id;
665 update : function (_self, record, operation)
667 if (operation != 'commit') {
672 user_ids : _this.data.id,
673 _action : (record.data.is_in_group * 1 == 0) ? 'sub' : 'add',
674 group_id : record.data.id
678 url : baseURL + '/Roo/Core_group',
681 success : function() {
682 //_this.option_grid.ds.load({});
692 url : baseURL + '/Roo/core_group',
697 xtype : 'JsonReader',
708 'name': 'display_name',
712 'name': 'is_in_group',
723 xtype : 'RowSelectionModel',
725 xns : Roo.bootstrap.Table,
726 '|xns' : 'Roo.bootstrap.Table'
730 xtype : 'ColumnModel',
733 dataIndex : 'is_in_group',
734 header : _this._strings['4910043d0b2c8c864a0e8672716fee94'] /* Is a Member */,
735 renderer : function(v) {
737 var state = v > 0 ? 'check-' : '';
738 var cls = v > 0 ? 'text-primary' : '';
740 return '<i class=\"far fa-'+ state + 'square-o ' + cls + '\" aria-hidden=\"true\"></i>';
749 xtype : 'ColumnModel',
751 dataIndex : 'display_name',
752 header : _this._strings['28974c2c793e780427dfb571b26443e6'] /* Group Name */,
753 renderer : function(v,x,r)
755 var vv = v.length ? v : r.data.name;
757 return String.format('{0}', vv);
773 Roo.apply(Pman.Dialog.BAdminStaff, Pman.Dialog.BAdminStaff.prototype);