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',
73 title : _this._strings['a0f852ef8bfccd86a0e7217d7959e3e8'] /* Add / Edit User */,
75 beforeshow : function (_self)
77 //_console.log(_this.detail_tab);
79 render : function (_self)
81 this.bodyEl.setHeight(600);
83 show : function (_self)
85 //_this.dialog.items[0].getRegion('center').showPanel(0);
87 //setting first adminstrator in open system
89 if(typeof(_this.data.role) != 'undefined' && _this.data.role == 'Administrators') {
91 Roo.select('.add-user-dialog .modal-title').first().dom.innerHTML = "Create Adminstrator";
93 _this.form.findField('role').inputEl().dom.disabled = true;
95 _this.layout.showPanel('DetailPanel');
99 '|xns' : 'Roo.bootstrap',
103 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
105 click : function (_self, e)
111 '|xns' : 'Roo.bootstrap'
115 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
118 click : function (_self, e)
120 if(!_this.form.isValid()){
121 //Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
125 var myID = _this.form.findField('id').getValue() * 1;
126 var myName = _this.form.findField('name').getValue();
128 if (_this.form.findField('company_id') && !_this.form.findField('company_id').getValue()) {
129 Roo.bootstrap.MessageBox.alert("Error", "Select a Company");
133 // validate password match (only needed if we are not using generated one..
134 if (_this.form.findField('passwd1')
135 && _this.form.findField('passwd1').getValue().length > 0
136 && _this.form.findField('passwd1').inputEl().dom.type == "password") {
138 var p1 = _this.form.findField('passwd1').getValue();
139 var p2 = _this.form.findField('passwd2').getValue();
142 if (Pman.Login.authUser.id < 0 && !p1.length) {
143 Roo.bootstrap.MessageBox.alert("Error", "You must create a password for the admin account");
148 if (p1.length || p2.length) {
150 Roo.bootstrap.MessageBox.alert("Error", "Passwords do not match");
158 // get the list of record with tick
160 _this.form.doAction("submit");
167 '|xns' : 'Roo.bootstrap'
174 render : function (_self)
176 _this.layout = _self;
179 xns : Roo.bootstrap.layout,
180 '|xns' : 'Roo.bootstrap.layout',
183 alwaysShowTabs : true,
185 xns : Roo.bootstrap.layout,
186 '|xns' : 'Roo.bootstrap.layout'
193 fitContainer : false,
197 title : _this._strings['3ec365dd533ddb7ef3d1c111186ce872'] /* Details */,
199 activate : function (_self)
201 /*var url = 'about:blank';
203 if(_this.data.id * 1 > 0){
204 url = baseURL + '/Coba/Report/ApplicationSummary/' + _this.data.id;
207 _this.app_summary_frame.el.dom.src = url;*/
210 render : function (_self)
212 _this.detail_tab = _self;
215 xns : Roo.bootstrap.panel,
216 '|xns' : 'Roo.bootstrap.panel',
222 '|xns' : 'Roo.bootstrap',
228 style : 'margin-top: 20px;',
229 url : baseURL + '/Roo/core_person',
231 actioncomplete : function (_self, action)
233 if(action.type == 'setdata'){
235 _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
236 _this.form.findField('passwd2').show();
237 _this.passwordbox.collapse();
239 _this.qrCodeBox.collapse();
240 _this.qrCodeBox.el.hide();
241 _this.form.findField('_enable_oath_key').setValue(1);
242 _this.form.findField('_enable_oath_key').el.show();
244 _this.generate_qrcode_btn.el.hide();
245 _this.delete_qrcode_btn.el.hide();
246 _this.show_qrcode_btn.el.hide();
248 if(_this.data.id * 1 > 0) {
249 this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
257 if (action.type == 'load') {
259 _this.data = action.result.data;
261 _this.qrCodeBox.el.show();
262 _this.form.findField('_enable_oath_key').setValue(0);
263 _this.form.findField('_enable_oath_key').el.hide();
265 _this.generate_qrcode_btn.el.show();
266 _this.delete_qrcode_btn.el.hide();
267 _this.show_qrcode_btn.el.hide();
269 _this.qrCodeBox.collapse();
271 if(_this.data.length_oath_key * 1 > 0){
272 _this.delete_qrcode_btn.el.show();
273 _this.show_qrcode_btn.el.show();
274 _this.qrCodeBox.expand();
280 if (action.type == 'submit') { // only submitted here if we are
284 if (_this.callback) {
285 _this.callback.call(this, action.result.data);
292 beforeaction : function (_self, action)
296 render : function (_self)
300 //_this.findField('group_membership').setValue
302 console.log(_this.form.data);
306 '|xns' : 'Roo.bootstrap',
310 fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
313 placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
315 '|xns' : 'Roo.bootstrap'
319 fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
322 placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
324 '|xns' : 'Roo.bootstrap'
329 fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
332 placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
335 '|xns' : 'Roo.bootstrap'
339 fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
343 '|xns' : 'Roo.bootstrap'
347 boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
349 name : '_enable_oath_key',
351 render : function (_self)
353 this.el.setVisibilityMode(Roo.Element.DISPLAY);
359 '|xns' : 'Roo.bootstrap'
365 header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
368 render : function (_self)
370 _this.passwordbox = this;
374 '|xns' : 'Roo.bootstrap',
379 '|xns' : 'Roo.bootstrap',
385 '|xns' : 'Roo.bootstrap',
389 inputType : 'password',
392 '|xns' : 'Roo.bootstrap'
400 '|xns' : 'Roo.bootstrap',
404 html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
405 style : 'width:100%',
407 click : function (_self, e)
409 var pw = Math.random().toString(36).slice(-12);
410 _this.form.findField('passwd1').el.select('input',true).first().dom.type="input";
411 _this.form.findField('passwd1').setValue(pw);
412 _this.form.findField('passwd2').hide();
418 '|xns' : 'Roo.bootstrap'
426 inputType : 'password',
428 placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
430 '|xns' : 'Roo.bootstrap'
434 boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
435 name : 'secure_passwords',
437 '|xns' : 'Roo.bootstrap'
445 header : _this._strings['a60cdd3642fbe81545a3b93fe2b19dd6'] /* Two-Factor Authentication */,
448 render : function (_self)
450 _this.qrCodeBox = this;
452 this.el.setVisibilityMode(Roo.Element.DISPLAY);
458 '|xns' : 'Roo.bootstrap',
463 '|xns' : 'Roo.bootstrap',
469 '|xns' : 'Roo.bootstrap',
473 html : _this._strings['73b00356c62eb391f571b6468be7c372'] /* Generate QR Code */,
474 style : 'width:100%',
476 click : function (_self, e)
478 if(_this.data.id * 1 < 1){
479 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
484 url: baseURL + '/Roo/Core_person.php',
489 _generate_oath_key : 1
491 success : function(res) {
492 _this.delete_qrcode_btn.el.show();
493 _this.show_qrcode_btn.el.show();
495 Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
503 render : function (_self)
505 _this.generate_qrcode_btn = this;
507 this.el.setVisibilityMode(Roo.Element.DISPLAY);
513 '|xns' : 'Roo.bootstrap'
521 '|xns' : 'Roo.bootstrap',
525 html : _this._strings['1960f813085537c64f981132e34181ca'] /* Delete QR Code */,
526 style : 'width:100%',
528 click : function (_self, e)
530 if(_this.data.id * 1 < 1){
531 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
536 url: baseURL + '/Roo/Core_person.php',
543 success : function(res) {
544 _this.delete_qrcode_btn.el.hide();
545 _this.show_qrcode_btn.el.hide();
551 render : function (_self)
553 _this.delete_qrcode_btn = this;
555 this.el.setVisibilityMode(Roo.Element.DISPLAY);
561 '|xns' : 'Roo.bootstrap'
569 '|xns' : 'Roo.bootstrap',
573 html : _this._strings['a6b81fd617c4f1b94f83049793cac3cd'] /* Show QR Code */,
574 style : 'width:100%',
576 click : function (_self, e)
578 if(_this.data.id * 1 < 1){
579 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
583 Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
587 render : function (_self)
589 _this.show_qrcode_btn = this;
591 this.el.setVisibilityMode(Roo.Element.DISPLAY);
597 '|xns' : 'Roo.bootstrap'
607 inputType : 'hidden',
611 render : function (_self)
613 _this.userID = _self;
617 '|xns' : 'Roo.bootstrap'
621 inputType : 'hidden',
624 '|xns' : 'Roo.bootstrap'
628 inputType : 'hidden',
630 name : 'membership_list',
632 '|xns' : 'Roo.bootstrap'
646 title : _this._strings['566a352f95c879ff26e50bad767a28dc'] /* Group Membership */,
648 activate : function (_self)
650 if(_this.option_grid){
651 _this.option_grid.store.load({});
655 render : function (_self)
657 _this.option_panel = this;
662 xns : Roo.bootstrap.panel,
663 '|xns' : 'Roo.bootstrap.panel',
666 cellSelection : false,
673 render : function (_self)
675 _this.option_grid = this;
679 rowclick : function (_self, el, rowIndex, e)
681 //var di = this.colModel.getDataIndex(columnIndex);
683 // check if the name is the result name from dataobject core_group_member
684 /*if (di != 'group_membership_user_id') {
690 var rec = this.store.getAt(rowIndex);
692 rec.set('group_membership_user_id', rec.data.group_membership_user_id * 1 == 0 ? -1 : 0);
696 var membership_active_arr = [];
697 // loop throught the new list , rebuild the list of current options
699 // record is the first parameter
701 _this.option_grid.store.each(function(record){
702 var gmuid = record.data.group_membership_user_id;
703 var gid = record.data.id;
705 membership_active_arr.push(gid);
709 var membership_active_list = "";
710 membership_active_list = membership_active_arr.join();
712 _this.form.findField("membership_list").setValue(membership_active_list);
716 '|xns' : 'Roo.bootstrap',
720 sortInfo : { direction : 'ASC', field: 'id' },
722 beforeload : function (_self, options)
724 options.params = options.params || {};
726 options.params._with_membership_user = _this.data.id;
728 /*if(typeof(_this.data.id) == 'undefined' || _this.data.id * 1 < 1){
733 options.params.is_active = 1;
734 options.params.dec_type = 'checklist';
736 options.params._ext_data_id = _this.data.id;
738 options.params._with_others = 1;
740 options.params._show_deleted = _this.documentStatusBtn.pressed ? 1 : 0;*/
749 url : baseURL + '/Roo/core_group',
754 xtype : 'JsonReader',
762 xtype : 'RowSelectionModel',
765 selectionchange : function (_self)
767 /*_this.type_edit_btn.hide();
769 if(this.getSelected()){
770 _this.type_edit_btn.show();
773 _this.option_grid.store.load({});
778 xns : Roo.bootstrap.Table,
779 '|xns' : 'Roo.bootstrap.Table'
783 xtype : 'ColumnModel',
785 dataIndex : 'group_membership_user_id',
786 header : _this._strings['4910043d0b2c8c864a0e8672716fee94'] /* Is a Member */,
787 renderer : function(v,x,r) {
789 var state = v != 0 ? '-check' : '';
791 return '<i class=\"far fa'+ state + '-square-o fa-2x\" aria-hidden=\"true\"></i>';
799 xtype : 'ColumnModel',
802 header : _this._strings['28974c2c793e780427dfb571b26443e6'] /* Group Name */,
817 Roo.apply(Pman.Dialog.BAdminStaff, Pman.Dialog.BAdminStaff.prototype);