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.BAdminStaffGroups= function() {}
8 Roo.apply(Pman.Dialog.BAdminStaffGroups.prototype, {
11 '4910043d0b2c8c864a0e8672716fee94' :"Is a Member",
12 '566a352f95c879ff26e50bad767a28dc' :"Group Membership",
13 '6b79852e4370cae80ee551e0671616bb' :"Manage Users Group",
14 '28974c2c793e780427dfb571b26443e6' :"Group Name",
15 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
16 'c9cc8cce247e49bae79f15173ce97354' :"Save"
22 show : function(data, cb)
30 this.dialog.show.apply(this.dialog, Array.prototype.slice.call(arguments).slice(2));
33 this.form.setValues(data);
34 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
42 this.dialog = Roo.factory({
44 cls : 'add-user-dialog',
46 title : _this._strings['6b79852e4370cae80ee551e0671616bb'] /* Manage Users Group */,
48 render : function (_self)
52 show : function (_self)
54 this.setTitle("Manage Membership for " + _this.data.name);
58 '|xns' : 'Roo.bootstrap',
62 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
64 click : function (_self, e)
70 '|xns' : 'Roo.bootstrap'
74 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
77 click : function (_self, e)
79 if(!_this.form.isValid()){
80 //Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
84 var myID = _this.form.findField('id').getValue() * 1;
85 var myName = _this.form.findField('name').getValue();
87 if (_this.form.findField('company_id') && !_this.form.findField('company_id').getValue()) {
88 Roo.bootstrap.MessageBox.alert("Error", "Select a Company");
92 // validate password match (only needed if we are not using generated one..
93 if (_this.form.findField('passwd1')
94 && _this.form.findField('passwd1').getValue().length > 0
95 && _this.form.findField('passwd1').inputEl().dom.type == "password") {
97 var p1 = _this.form.findField('passwd1').getValue();
98 var p2 = _this.form.findField('passwd2').getValue();
101 if (Pman.Login.authUser.id < 0 && !p1.length) {
102 Roo.bootstrap.MessageBox.alert("Error", "You must create a password for the admin account");
107 if (p1.length || p2.length) {
109 Roo.bootstrap.MessageBox.alert("Error", "Passwords do not match");
117 // get the list of record with tick
119 _this.form.doAction("submit");
126 '|xns' : 'Roo.bootstrap'
133 render : function (_self)
135 _this.layout = _self;
138 xns : Roo.bootstrap.layout,
139 '|xns' : 'Roo.bootstrap.layout',
142 alwaysShowTabs : true,
144 xns : Roo.bootstrap.layout,
145 '|xns' : 'Roo.bootstrap.layout'
154 title : _this._strings['566a352f95c879ff26e50bad767a28dc'] /* Group Membership */,
156 activate : function (_self)
158 if(_this.option_grid){
159 _this.option_grid.store.load({});
163 render : function (_self)
165 _this.option_panel = this;
170 xns : Roo.bootstrap.panel,
171 '|xns' : 'Roo.bootstrap.panel',
174 cellSelection : true,
179 rowSelection : false,
181 cellclick : function (_self, el, rowIndex, columnIndex, e)
183 var di = _this.option_grid.colModel.getDataIndex(columnIndex);
186 if (di != 'is_in_group') {
190 var rec = _this.option_grid.store.getAt(rowIndex);
192 if(rec.data.name == 'Administrators' && _this.data.id == Pman.Login.authUser.id){
193 Roo.bootstrap.MessageBox.alert('Error', 'You can not remove yourself from Administrators group');
197 rec.set('is_in_group', rec.data.is_in_group * 1 == 1 ? 0 : 1);
201 render : function (_self)
203 _this.option_grid = this;
209 '|xns' : 'Roo.bootstrap',
213 sortInfo : { direction : 'ASC', field: 'id' },
215 beforeload : function (_self, options)
217 options.params = options.params || {};
219 if(_this.data.id * 1 < 1){
220 _this.option_grid.el.mask('Please save the member first');
224 options.params.limit = 200;
225 options.params._is_in_group = _this.data.id;
228 update : function (_self, record, operation)
230 if (operation != 'commit') {
235 user_ids : _this.data.id,
236 _action : (record.data.is_in_group * 1 == 0) ? 'sub' : 'add',
237 group_id : record.data.id
241 url : baseURL + '/Roo/Core_group',
244 success : function() {
245 //_this.option_grid.ds.load({});
255 url : baseURL + '/Roo/core_group',
260 xtype : 'JsonReader',
271 'name': 'display_name',
275 'name': 'is_in_group',
286 xtype : 'RowSelectionModel',
288 xns : Roo.bootstrap.Table,
289 '|xns' : 'Roo.bootstrap.Table'
293 xtype : 'ColumnModel',
296 dataIndex : 'is_in_group',
297 header : _this._strings['4910043d0b2c8c864a0e8672716fee94'] /* Is a Member */,
298 renderer : function(v) {
300 var state = v > 0 ? 'check-' : '';
301 var cls = v > 0 ? 'text-primary' : '';
303 return '<i class=\"far fa-'+ state + 'square-o ' + cls + '\" aria-hidden=\"true\"></i>';
312 xtype : 'ColumnModel',
314 dataIndex : 'display_name',
315 header : _this._strings['28974c2c793e780427dfb571b26443e6'] /* Group Name */,
316 renderer : function(v,x,r)
318 var vv = v.length ? v : r.data.name;
320 return String.format('{0}', vv);
336 Roo.apply(Pman.Dialog.BAdminStaffGroups, Pman.Dialog.BAdminStaffGroups.prototype);