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.dialog.setTitle("Add / Edit User");
221 _this.form.findField('role').setDisabled(false);
224 * Use for init -- Call from Pman.Login.js
226 if(typeof(_this.data.role) != 'undefined' && _this.data.role == 'Administrators') {
227 _this.dialog.setTitle("Create Adminstrator");
228 _this.form.findField('role').setDisabled(true);
231 _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
232 _this.form.findField('passwd2').show();
233 _this.passwordbox.collapse();
235 _this.qrCodeBox.collapse();
236 _this.qrCodeBox.el.hide();
237 _this.form.findField('_enable_oath_key').setValue(1);
238 _this.form.findField('_enable_oath_key').el.show();
240 _this.generate_qrcode_btn.el.hide();
241 _this.delete_qrcode_btn.el.hide();
242 _this.show_qrcode_btn.el.hide();
244 if(_this.data.id * 1 > 0) {
245 this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
253 if (action.type == 'load') {
255 _this.data = action.result.data;
257 _this.qrCodeBox.el.show();
258 _this.form.findField('_enable_oath_key').setValue(0);
259 _this.form.findField('_enable_oath_key').el.hide();
261 _this.generate_qrcode_btn.el.show();
262 _this.delete_qrcode_btn.el.hide();
263 _this.show_qrcode_btn.el.hide();
265 _this.qrCodeBox.collapse();
267 if(_this.data.length_oath_key * 1 > 0){
268 _this.delete_qrcode_btn.el.show();
269 _this.show_qrcode_btn.el.show();
270 _this.qrCodeBox.expand();
276 if (action.type == 'submit') { // only submitted here if we are
280 if (_this.callback) {
281 _this.callback.call(this, action.result.data);
288 render : function (_self)
295 '|xns' : 'Roo.bootstrap',
300 '|xns' : 'Roo.bootstrap',
306 '|xns' : 'Roo.bootstrap',
311 fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
314 placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
316 '|xns' : 'Roo.bootstrap'
325 '|xns' : 'Roo.bootstrap',
331 '|xns' : 'Roo.bootstrap',
335 fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
338 placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
340 '|xns' : 'Roo.bootstrap'
349 '|xns' : 'Roo.bootstrap',
355 '|xns' : 'Roo.bootstrap',
360 fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
363 placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
366 '|xns' : 'Roo.bootstrap'
375 '|xns' : 'Roo.bootstrap',
381 '|xns' : 'Roo.bootstrap',
385 fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
389 '|xns' : 'Roo.bootstrap'
398 '|xns' : 'Roo.bootstrap',
404 '|xns' : 'Roo.bootstrap',
408 boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
410 name : '_enable_oath_key',
412 render : function (_self)
414 this.el.setVisibilityMode(Roo.Element.DISPLAY);
420 '|xns' : 'Roo.bootstrap'
429 '|xns' : 'Roo.bootstrap',
435 '|xns' : 'Roo.bootstrap',
441 header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
444 render : function (_self)
446 _this.passwordbox = this;
450 '|xns' : 'Roo.bootstrap',
455 '|xns' : 'Roo.bootstrap',
461 '|xns' : 'Roo.bootstrap',
465 inputType : 'password',
468 '|xns' : 'Roo.bootstrap'
476 '|xns' : 'Roo.bootstrap',
480 html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
481 style : 'width:100%',
483 click : function (_self, e)
485 var pw = Math.random().toString(36).slice(-12);
486 _this.form.findField('passwd1').el.select('input',true).first().dom.type="input";
487 _this.form.findField('passwd1').setValue(pw);
488 _this.form.findField('passwd2').hide();
494 '|xns' : 'Roo.bootstrap'
502 inputType : 'password',
504 placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
506 '|xns' : 'Roo.bootstrap'
510 boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
511 name : 'secure_passwords',
513 '|xns' : 'Roo.bootstrap'
524 '|xns' : 'Roo.bootstrap',
530 '|xns' : 'Roo.bootstrap',
536 header : _this._strings['a60cdd3642fbe81545a3b93fe2b19dd6'] /* Two-Factor Authentication */,
539 render : function (_self)
541 _this.qrCodeBox = this;
543 this.el.setVisibilityMode(Roo.Element.DISPLAY);
549 '|xns' : 'Roo.bootstrap',
554 '|xns' : 'Roo.bootstrap',
560 '|xns' : 'Roo.bootstrap',
564 html : _this._strings['73b00356c62eb391f571b6468be7c372'] /* Generate QR Code */,
565 style : 'width:100%',
567 click : function (_self, e)
569 if(_this.data.id * 1 < 1){
570 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
575 url: baseURL + '/Roo/Core_person.php',
580 _generate_oath_key : 1
582 success : function(res) {
583 _this.delete_qrcode_btn.el.show();
584 _this.show_qrcode_btn.el.show();
586 Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
594 render : function (_self)
596 _this.generate_qrcode_btn = this;
598 this.el.setVisibilityMode(Roo.Element.DISPLAY);
604 '|xns' : 'Roo.bootstrap'
612 '|xns' : 'Roo.bootstrap',
616 html : _this._strings['1960f813085537c64f981132e34181ca'] /* Delete QR Code */,
617 style : 'width:100%',
619 click : function (_self, e)
621 if(_this.data.id * 1 < 1){
622 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
627 url: baseURL + '/Roo/Core_person.php',
634 success : function(res) {
635 _this.delete_qrcode_btn.el.hide();
636 _this.show_qrcode_btn.el.hide();
642 render : function (_self)
644 _this.delete_qrcode_btn = this;
646 this.el.setVisibilityMode(Roo.Element.DISPLAY);
652 '|xns' : 'Roo.bootstrap'
660 '|xns' : 'Roo.bootstrap',
664 html : _this._strings['a6b81fd617c4f1b94f83049793cac3cd'] /* Show QR Code */,
665 style : 'width:100%',
667 click : function (_self, e)
669 if(_this.data.id * 1 < 1){
670 Roo.bootstrap.MessageBox.alert('Error', 'Please save the user first');
674 Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
678 render : function (_self)
680 _this.show_qrcode_btn = this;
682 this.el.setVisibilityMode(Roo.Element.DISPLAY);
688 '|xns' : 'Roo.bootstrap'
702 inputType : 'hidden',
706 render : function (_self)
708 _this.userID = _self;
712 '|xns' : 'Roo.bootstrap'
716 inputType : 'hidden',
719 '|xns' : 'Roo.bootstrap'
733 title : _this._strings['566a352f95c879ff26e50bad767a28dc'] /* Group Membership */,
735 activate : function (_self)
737 if(_this.option_grid){
738 _this.option_grid.store.load({});
742 render : function (_self)
744 _this.option_panel = this;
749 xns : Roo.bootstrap.panel,
750 '|xns' : 'Roo.bootstrap.panel',
753 cellSelection : false,
760 render : function (_self)
762 _this.option_grid = this;
766 rowclick : function (_self, el, rowIndex, e)
768 //var di = this.colModel.getDataIndex(columnIndex);
770 // check if the name is the result name from dataobject core_group_member
771 /*if (di != 'group_membership_user_id') {
777 var rec = this.store.getAt(rowIndex);
779 rec.set('group_membership_user_id', rec.data.group_membership_user_id * 1 == 0 ? -1 : 0);
783 var membership_active_arr = [];
784 // loop throught the new list , rebuild the list of current options
786 // record is the first parameter
788 _this.option_grid.store.each(function(record){
789 var gmuid = record.data.group_membership_user_id;
790 var gid = record.data.id;
792 membership_active_arr.push(gid);
796 var membership_active_list = "";
797 membership_active_list = membership_active_arr.join();
799 _this.form.findField("membership_list").setValue(membership_active_list);
803 '|xns' : 'Roo.bootstrap',
807 sortInfo : { direction : 'ASC', field: 'id' },
809 beforeload : function (_self, options)
811 options.params = options.params || {};
813 options.params._with_membership_user = _this.data.id;
822 url : baseURL + '/Roo/core_group',
827 xtype : 'JsonReader',
835 xtype : 'RowSelectionModel',
838 selectionchange : function (_self)
840 /*_this.type_edit_btn.hide();
842 if(this.getSelected()){
843 _this.type_edit_btn.show();
846 _this.option_grid.store.load({});
851 xns : Roo.bootstrap.Table,
852 '|xns' : 'Roo.bootstrap.Table'
856 xtype : 'ColumnModel',
859 dataIndex : 'group_membership_user_id',
860 header : _this._strings['4910043d0b2c8c864a0e8672716fee94'] /* Is a Member */,
861 renderer : function(v) {
863 var state = v > 0 ? 'check-' : '';
864 var cls = v > 0 ? 'text-primary' : '';
866 return '<i class=\"far fa-'+ state + 'square-o ' + cls + '\" aria-hidden=\"true\"></i>';
875 xtype : 'ColumnModel',
878 header : _this._strings['28974c2c793e780427dfb571b26443e6'] /* Group Name */,
893 Roo.apply(Pman.Dialog.BAdminStaff, Pman.Dialog.BAdminStaff.prototype);