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)
78 show : function (_self)
84 '|xns' : 'Roo.bootstrap',
88 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
90 click : function (_self, e)
96 '|xns' : 'Roo.bootstrap'
100 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
103 click : function (_self, e)
105 if(!_this.form.isValid()){
106 //Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
110 var myID = _this.form.findField('id').getValue() * 1;
111 var myName = _this.form.findField('name').getValue();
113 if (_this.form.findField('company_id') && !_this.form.findField('company_id').getValue()) {
114 Roo.bootstrap.MessageBox.alert("Error", "Select a Company");
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") {
123 var p1 = _this.form.findField('passwd1').getValue();
124 var p2 = _this.form.findField('passwd2').getValue();
127 if (Pman.Login.authUser.id < 0 && !p1.length) {
128 Roo.bootstrap.MessageBox.alert("Error", "You must create a password for the admin account");
133 if (p1.length || p2.length) {
135 Roo.bootstrap.MessageBox.alert("Error", "Passwords do not match");
143 // get the list of record with tick
145 _this.form.doAction("submit");
152 '|xns' : 'Roo.bootstrap'
159 render : function (_self)
161 _this.layout = _self;
164 xns : Roo.bootstrap.layout,
165 '|xns' : 'Roo.bootstrap.layout',
168 alwaysShowTabs : true,
170 xns : Roo.bootstrap.layout,
171 '|xns' : 'Roo.bootstrap.layout'
182 title : _this._strings['3ec365dd533ddb7ef3d1c111186ce872'] /* Details */,
184 activate : function (_self)
186 /*var url = 'about:blank';
188 if(_this.data.id * 1 > 0){
189 url = baseURL + '/Coba/Report/ApplicationSummary/' + _this.data.id;
192 _this.app_summary_frame.el.dom.src = url;*/
195 render : function (_self)
197 _this.detail_tab = _self;
200 xns : Roo.bootstrap.panel,
201 '|xns' : 'Roo.bootstrap.panel',
207 '|xns' : 'Roo.bootstrap',
213 style : 'margin-top: 20px;',
214 url : baseURL + '/Roo/core_person',
216 actioncomplete : function (_self, action)
218 if(action.type == 'setdata'){
220 _this.layout.showPanel('DetailPanel');
222 _this.dialog.setTitle("Add / Edit User");
223 _this.form.findField('role').setDisabled(false);
226 * Use for init -- Call from Pman.Login.js
228 if(typeof(_this.data.role) != 'undefined' && _this.data.role == 'Administrators') {
229 _this.dialog.setTitle("Create Adminstrator");
230 _this.form.findField('role').setDisabled(true);
233 _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
234 _this.form.findField('passwd2').show();
235 _this.passwordbox.collapse();
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();
242 _this.generate_qrcode_btn.el.hide();
243 _this.delete_qrcode_btn.el.hide();
244 _this.show_qrcode_btn.el.hide();
246 if(_this.data.id * 1 > 0) {
247 this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
255 if (action.type == 'load') {
257 _this.data = action.result.data;
259 _this.qrCodeBox.el.show();
260 _this.form.findField('_enable_oath_key').setValue(0);
261 _this.form.findField('_enable_oath_key').el.hide();
263 _this.generate_qrcode_btn.el.show();
264 _this.delete_qrcode_btn.el.hide();
265 _this.show_qrcode_btn.el.hide();
267 _this.qrCodeBox.collapse();
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();
278 if (action.type == 'submit') { // only submitted here if we are
282 if (_this.callback) {
283 _this.callback.call(this, action.result.data);
290 render : function (_self)
297 '|xns' : 'Roo.bootstrap',
302 '|xns' : 'Roo.bootstrap',
308 '|xns' : 'Roo.bootstrap',
313 fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
316 placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
318 '|xns' : 'Roo.bootstrap'
327 '|xns' : 'Roo.bootstrap',
333 '|xns' : 'Roo.bootstrap',
337 fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
340 placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
342 '|xns' : 'Roo.bootstrap'
351 '|xns' : 'Roo.bootstrap',
357 '|xns' : 'Roo.bootstrap',
362 fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
365 placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
368 '|xns' : 'Roo.bootstrap'
377 '|xns' : 'Roo.bootstrap',
383 '|xns' : 'Roo.bootstrap',
387 fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
391 '|xns' : 'Roo.bootstrap'
400 '|xns' : 'Roo.bootstrap',
406 '|xns' : 'Roo.bootstrap',
410 boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
412 name : '_enable_oath_key',
414 render : function (_self)
416 this.el.setVisibilityMode(Roo.Element.DISPLAY);
422 '|xns' : 'Roo.bootstrap'
431 '|xns' : 'Roo.bootstrap',
437 '|xns' : 'Roo.bootstrap',
443 header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
446 render : function (_self)
448 _this.passwordbox = this;
452 '|xns' : 'Roo.bootstrap',
457 '|xns' : 'Roo.bootstrap',
463 '|xns' : 'Roo.bootstrap',
467 inputType : 'password',
470 '|xns' : 'Roo.bootstrap'
478 '|xns' : 'Roo.bootstrap',
482 html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
483 style : 'width:100%',
485 click : function (_self, e)
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();
496 '|xns' : 'Roo.bootstrap'
504 inputType : 'password',
506 placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
508 '|xns' : 'Roo.bootstrap'
512 boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
513 name : 'secure_passwords',
515 '|xns' : 'Roo.bootstrap'
526 '|xns' : 'Roo.bootstrap',
532 '|xns' : 'Roo.bootstrap',
538 header : _this._strings['a60cdd3642fbe81545a3b93fe2b19dd6'] /* Two-Factor Authentication */,
541 render : function (_self)
543 _this.qrCodeBox = this;
545 this.el.setVisibilityMode(Roo.Element.DISPLAY);
551 '|xns' : 'Roo.bootstrap',
556 '|xns' : 'Roo.bootstrap',
562 '|xns' : 'Roo.bootstrap',
566 html : _this._strings['73b00356c62eb391f571b6468be7c372'] /* Generate QR Code */,
567 style : 'width:100%',
569 click : function (_self, e)
571 if(_this.data.id * 1 < 1){
572 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
577 url: baseURL + '/Roo/Core_person.php',
582 _generate_oath_key : 1
584 success : function(res) {
585 _this.delete_qrcode_btn.el.show();
586 _this.show_qrcode_btn.el.show();
588 Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
596 render : function (_self)
598 _this.generate_qrcode_btn = this;
600 this.el.setVisibilityMode(Roo.Element.DISPLAY);
606 '|xns' : 'Roo.bootstrap'
614 '|xns' : 'Roo.bootstrap',
618 html : _this._strings['1960f813085537c64f981132e34181ca'] /* Delete QR Code */,
619 style : 'width:100%',
621 click : function (_self, e)
623 if(_this.data.id * 1 < 1){
624 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
629 url: baseURL + '/Roo/Core_person.php',
636 success : function(res) {
637 _this.delete_qrcode_btn.el.hide();
638 _this.show_qrcode_btn.el.hide();
644 render : function (_self)
646 _this.delete_qrcode_btn = this;
648 this.el.setVisibilityMode(Roo.Element.DISPLAY);
654 '|xns' : 'Roo.bootstrap'
662 '|xns' : 'Roo.bootstrap',
666 html : _this._strings['a6b81fd617c4f1b94f83049793cac3cd'] /* Show QR Code */,
667 style : 'width:100%',
669 click : function (_self, e)
671 if(_this.data.id * 1 < 1){
672 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
676 Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
680 render : function (_self)
682 _this.show_qrcode_btn = this;
684 this.el.setVisibilityMode(Roo.Element.DISPLAY);
690 '|xns' : 'Roo.bootstrap'
704 inputType : 'hidden',
708 render : function (_self)
710 _this.userID = _self;
714 '|xns' : 'Roo.bootstrap'
718 inputType : 'hidden',
721 '|xns' : 'Roo.bootstrap'
735 title : _this._strings['566a352f95c879ff26e50bad767a28dc'] /* Group Membership */,
737 activate : function (_self)
739 if(_this.option_grid){
740 _this.option_grid.store.load({});
744 render : function (_self)
746 _this.option_panel = this;
751 xns : Roo.bootstrap.panel,
752 '|xns' : 'Roo.bootstrap.panel',
755 cellSelection : true,
762 cellclick : function (_self, el, rowIndex, columnIndex, e)
764 var di = _this.option_grid.colModel.getDataIndex(columnIndex);
766 if (di != 'is_in_group') {
770 var rec = _this.option_grid.store.getAt(rowIndex);
772 rec.set('is_in_group', rec.data.is_in_group ? 0 : 1);
776 render : function (_self)
778 _this.option_grid = this;
784 '|xns' : 'Roo.bootstrap',
788 sortInfo : { direction : 'ASC', field: 'id' },
790 beforeload : function (_self, options)
792 options.params = options.params || {};
794 if(_this.data.id * 1 < 1){
795 _this.option_grid.el.mask('Please save the member first');
800 options.params._is_in_group = _this.data.id;
803 update : function (_self, record, operation)
805 if (operation != 'commit') {
810 user_ids : _this.data.id,
811 _action : (record.data.is_in_group * 1 == 0) ? 'sub' : 'add',
812 group_id : record.data.id
816 url : baseURL + '/Roo/Core_group',
819 success : function() {
820 _this.option_grid.ds.load({});
830 url : baseURL + '/Roo/core_group',
835 xtype : 'JsonReader',
846 'name': 'display_name',
850 'name': 'is_in_group',
861 xtype : 'RowSelectionModel',
863 xns : Roo.bootstrap.Table,
864 '|xns' : 'Roo.bootstrap.Table'
868 xtype : 'ColumnModel',
871 dataIndex : 'is_in_group',
872 header : _this._strings['4910043d0b2c8c864a0e8672716fee94'] /* Is a Member */,
873 renderer : function(v) {
875 var state = v > 0 ? 'check-' : '';
876 var cls = v > 0 ? 'text-primary' : '';
878 return '<i class=\"far fa-'+ state + 'square-o ' + cls + '\" aria-hidden=\"true\"></i>';
887 xtype : 'ColumnModel',
889 dataIndex : 'display_name',
890 header : _this._strings['28974c2c793e780427dfb571b26443e6'] /* Group Name */,
891 renderer : function(v,x,r)
893 var vv = v.length ? v : r.data.name;
895 return String.format('{0}', vv);
911 Roo.apply(Pman.Dialog.BAdminStaff, Pman.Dialog.BAdminStaff.prototype);