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 'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
13 'a0f852ef8bfccd86a0e7217d7959e3e8' :"Add / Edit User",
14 '0bfe42db3eb05bf39f03812166391939' :"Use Secure Passwords",
15 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
16 '6f958ddaf50fd5ade7858ef1d1a63e51' :"Type again to confirm",
17 'bbbabdbe1b262f75d99d62880b953be1' :"Role",
18 '49ee3087348e8d44e1feda1917443987' :"Name",
19 'c9cc8cce247e49bae79f15173ce97354' :"Save",
20 '828e70f83623b262e14187c039df99c0' :"Enable Two-Factor Authentication",
21 'acf45fd8829f809b29c601a3a193804f' :"Set / Change Password",
22 '01028205a11cf95a503c4c1d005989da' :"Generate One"
25 'email_placeholder' : 'ce8ae9da5b7cd6c3df2929543a9af92d' /* Email */ ,
26 'secure_passwords_boxLabel' : '0bfe42db3eb05bf39f03812166391939' /* Use Secure Passwords */ ,
27 'name_placeholder' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
28 'role_fieldLabel' : 'bbbabdbe1b262f75d99d62880b953be1' /* Role */ ,
29 'name_fieldLabel' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
30 'role_placeholder' : 'bbbabdbe1b262f75d99d62880b953be1' /* Role */ ,
31 'phone_fieldLabel' : 'bcc254b55c4a1babdf1dcb82c207506b' /* Phone */ ,
32 '_enable_oath_key_boxLabel' : '828e70f83623b262e14187c039df99c0' /* Enable Two-Factor Authentication */ ,
33 'email_fieldLabel' : 'ce8ae9da5b7cd6c3df2929543a9af92d' /* Email */ ,
34 'passwd2_placeholder' : '6f958ddaf50fd5ade7858ef1d1a63e51' /* Type again to confirm */
40 show : function(data, cb)
48 this.dialog.show.apply(this.dialog, Array.prototype.slice.call(arguments).slice(2));
51 this.form.setValues(data);
52 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
60 this.dialog = Roo.factory({
62 cls : 'add-user-dialog',
64 title : _this._strings['a0f852ef8bfccd86a0e7217d7959e3e8'] /* Add / Edit User */,
66 render : function (_self)
72 '|xns' : 'Roo.bootstrap',
76 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
78 click : function (_self, e)
84 '|xns' : 'Roo.bootstrap'
88 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
91 click : function (_self, e)
93 if(!_this.form.isValid()){
94 //Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
98 var myID = _this.form.findField('id').getValue() * 1;
99 var myName = _this.form.findField('name').getValue();
101 if (_this.form.findField('company_id') && !_this.form.findField('company_id').getValue()) {
102 Roo.bootstrap.MessageBox.alert("Error", "Select a Company");
106 // validate password match (only needed if we are not using generated one..
107 if (_this.form.findField('passwd1')
108 && _this.form.findField('passwd1').getValue().length > 0
109 && _this.form.findField('passwd1').inputEl().dom.type == "password") {
111 var p1 = _this.form.findField('passwd1').getValue();
112 var p2 = _this.form.findField('passwd2').getValue();
115 if (Pman.Login.authUser.id < 0 && !p1.length) {
116 Roo.bootstrap.MessageBox.alert("Error", "You must create a password for the admin account");
121 if (p1.length || p2.length) {
123 Roo.bootstrap.MessageBox.alert("Error", "Passwords do not match");
131 // get the list of record with tick
133 _this.form.doAction("submit");
140 '|xns' : 'Roo.bootstrap'
148 style : 'margin-top: 20px;',
149 url : baseURL + '/Roo/core_person',
151 actioncomplete : function (_self, action)
153 if(action.type == 'setdata'){
155 // _this.layout.showPanel('DetailPanel');
157 _this.dialog.setTitle(_this.data.id *1 > 0 ? "Edit User: " + _this.data.name : 'Add User');
158 _this.form.findField('role').setDisabled(false);
161 * Use for init -- Call from Pman.Login.js
164 typeof(_this.data.role) != 'undefined' &&
165 _this.data.role == 'Administrators'
167 _this.dialog.setTitle("Create Adminstrator");
168 _this.form.findField('role').setDisabled(true);
171 _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
172 _this.form.findField('passwd2').show();
173 _this.passwordbox.collapse();
175 _this.form.findField('secure_passwords').setValue(1);
177 if(_this.data.id * 1 > 0) {
178 this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
185 _this.dialog.resize();
190 if (action.type == 'load') {
192 _this.data = action.result.data;
196 _this.form.findField('_enable_oath_key').setChecked(false,false);
198 if(_this.data.length_oath_key != '0') {
199 _this.form.findField('_enable_oath_key').setChecked(true,false);
205 if (action.type == 'submit') { // only submitted here if we are
209 if (_this.callback) {
210 _this.callback.call(this, action.result.data);
216 render : function (_self)
222 '|xns' : 'Roo.bootstrap',
227 '|xns' : 'Roo.bootstrap',
233 '|xns' : 'Roo.bootstrap',
238 fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
241 placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
243 '|xns' : 'Roo.bootstrap'
252 '|xns' : 'Roo.bootstrap',
258 '|xns' : 'Roo.bootstrap',
262 fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
265 placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
267 '|xns' : 'Roo.bootstrap'
276 '|xns' : 'Roo.bootstrap',
282 '|xns' : 'Roo.bootstrap',
287 fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
290 placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
293 '|xns' : 'Roo.bootstrap'
302 '|xns' : 'Roo.bootstrap',
308 '|xns' : 'Roo.bootstrap',
312 fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
316 '|xns' : 'Roo.bootstrap'
325 '|xns' : 'Roo.bootstrap',
331 '|xns' : 'Roo.bootstrap',
335 boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
336 name : '_enable_oath_key',
338 check : function (_self, checked)
342 this.setBoxLabel('Untick to disable Two Factor authentication');
347 this.setBoxLabel('Enable Two Factor Authentication');
349 click : function (_self, e)
351 if(!Pman.Login.authUser) {
352 Roo.bootstrap.MessageBox.alert('Error', 'Please login again');
360 Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
366 _this.dialog.hide({});
370 _this.form.findField('_enable_oath_key').setChecked(false,false);
378 url : baseURL + '/Roo/Core_person',
384 success : function(res)
388 Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');
391 Roo.log('invalid usage');
395 failure : function(res)
397 Roo.bootstrap.MessageBox.alert('Error', res);
403 '|xns' : 'Roo.bootstrap'
412 '|xns' : 'Roo.bootstrap',
418 '|xns' : 'Roo.bootstrap',
424 header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
427 render : function (_self)
429 _this.passwordbox = this;
433 '|xns' : 'Roo.bootstrap',
438 '|xns' : 'Roo.bootstrap',
444 '|xns' : 'Roo.bootstrap',
448 inputType : 'password',
451 '|xns' : 'Roo.bootstrap'
459 '|xns' : 'Roo.bootstrap',
463 html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
464 style : 'width:100%',
466 click : function (_self, e)
468 var pw = Math.random().toString(36).replace('0.', '');
469 _this.form.findField('passwd1').el.select('input',true).first().dom.type="input";
470 _this.form.findField('passwd1').setValue(pw);
471 _this.form.findField('passwd2').hide();
475 '|xns' : 'Roo.bootstrap'
483 inputType : 'password',
485 placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
487 '|xns' : 'Roo.bootstrap'
491 boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
492 name : 'secure_passwords',
494 '|xns' : 'Roo.bootstrap'
504 inputType : 'hidden',
508 render : function (_self)
510 _this.userID = _self;
514 '|xns' : 'Roo.bootstrap'
518 inputType : 'hidden',
521 '|xns' : 'Roo.bootstrap'
529 Roo.apply(Pman.Dialog.BAdminStaff, Pman.Dialog.BAdminStaff.prototype);