PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminGroups.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Dialog');
6
7 Pman.Dialog.BAdminGroups= function() {}
8 Roo.apply(Pman.Dialog.BAdminGroups.prototype, {
9
10  _strings : {
11   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
12   '106eefbc3cdf294434c52c2638ce28df' :"Add / Edit Group",
13   '49ee3087348e8d44e1feda1917443987' :"Name",
14   'c9cc8cce247e49bae79f15173ce97354' :"Save"
15  },
16  _named_strings : {
17   'display_name_placeholder' : '49ee3087348e8d44e1feda1917443987' /* Name */ 
18  },
19
20  dialog : false,
21  callback:  false,
22
23  show : function(data, cb)
24  {
25   if (!this.dialog) {
26    this.create();
27   }
28
29   this.callback = cb;
30   this.data = data;
31   this.dialog.show(this.data._el);
32   if (this.form) {
33    this.form.reset();
34    this.form.setValues(data);
35    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
36   }
37
38  },
39
40  create : function()
41  {
42   var _this = this;
43   this.dialog = Roo.factory({
44     xtype : 'Modal',
45     cls : 'enable-overflow padding-bottom-trim',
46     title : _this._strings['106eefbc3cdf294434c52c2638ce28df'] /* Add / Edit Group */,
47     xns : Roo.bootstrap,
48     '|xns' : 'Roo.bootstrap',
49     buttons : [
50      {
51       xtype : 'Button',
52       html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
53       listeners : {
54        click : function (_self, e)
55         {
56             _this.dialog.hide(); 
57         }
58       },
59       xns : Roo.bootstrap,
60       '|xns' : 'Roo.bootstrap'
61      },
62      {
63       xtype : 'Button',
64       html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
65       weight : 'primary',
66       listeners : {
67        click : function (_self, e)
68         {
69             if(!_this.form.isValid()){
70                 Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
71                 return;
72             }
73             
74             _this.form.doAction("submit");
75             
76             return;
77         }
78       },
79       xns : Roo.bootstrap,
80       '|xns' : 'Roo.bootstrap'
81      }
82     ],
83     items  : [
84      {
85       xtype : 'Form',
86       labelAlign : 'top',
87       url : baseURL + '/Roo/Core_group',
88       listeners : {
89        actioncomplete : function (_self, action)
90         {
91             if(action.type == 'setdata'){
92             _this.dialog.setTitle("Create Group");
93                if(_this.data.id * 1 > 0) {
94                     this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
95                     _this.dialog.setTitle("Edit Group");
96                 } 
97                 
98                 return;
99             }
100            
101             if (action.type == 'load') {
102                 _this.data = action.result.data;
103                 
104                 if(!_this.data.display_name.length){
105                     _this.form.findField('display_name').setValue(_this.data.name);
106                 }
107                 return;
108             }
109             
110             
111             if (action.type == 'submit') {
112             
113                 _this.dialog.hide();
114                
115                 if (_this.callback) {
116                     _this.callback.call(this, action.result.data);
117                 }
118                 
119                 return; 
120             }
121         },
122        actionfailed : function (_self, action)
123         {
124             Roo.log(action);
125             Roo.bootstrap.MessageBox.alert('Error', action.result.errorMsg);
126         },
127        render : function (_self)
128         {
129             _this.form = _self;
130         }
131       },
132       xns : Roo.bootstrap,
133       '|xns' : 'Roo.bootstrap',
134       items  : [
135        {
136         xtype : 'Input',
137         name : 'display_name',
138         placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
139         xns : Roo.bootstrap,
140         '|xns' : 'Roo.bootstrap'
141        },
142        {
143         xtype : 'Input',
144         inputType : 'hidden',
145         name : 'id',
146         xns : Roo.bootstrap,
147         '|xns' : 'Roo.bootstrap'
148        }
149       ]
150      }
151     ]
152    }  );
153  }
154 });
155 Roo.apply(Pman.Dialog.BAdminGroups, Pman.Dialog.BAdminGroups.prototype);