Pman.Dialog.MTrackBulkChange.bjs
[Pman.MTrack] / Pman.Dialog.MTrackBulkChange.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.MTrackBulkChange = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             closable : false,
34             collapsible : false,
35             height : 300,
36             modal : true,
37             resizable : false,
38             title : "Bulk Update",
39             width : 500,
40             items : [
41                 {
42                     xtype: 'ContentPanel',
43                     xns: Roo,
44                     region : 'center',
45                     items : [
46                         {
47                             xtype: 'Form',
48                             xns: Roo.form,
49                             listeners : {
50                                 actioncomplete : function(_self,action)
51                                 {
52                                     if (action.type == 'setdata') {
53                                     
54                                         _this.form.setValues(_this.data);
55                                         
56                                        //_this.dialog.el.mask("Loading");
57                                        //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
58                                        return;
59                                     }
60                                     if (action.type == 'load') {
61                                         _this.dialog.el.unmask();
62                                         return;
63                                     }
64                                     if (action.type =='submit') {
65                                     
66                                         _this.dialog.el.unmask();
67                                         _this.dialog.hide();
68                                     
69                                          if (_this.callback) {
70                                             _this.callback.call(_this, _this.form.getValues());
71                                          }
72                                          _this.form.reset();
73                                          return;
74                                     }
75                                 },
76                                 rendered : function (form)
77                                 {
78                                     _this.form= form;
79                                 }
80                             },
81                             method : 'POST',
82                             style : 'margin:10px;',
83                             url : baseURL + '/Roo/mtrack_ticket.php',
84                             items : [
85                                 {
86                                     xtype: 'ComboBox',
87                                     xns: Roo.form,
88                                     allowBlank : 'false',
89                                     editable : 'false',
90                                     emptyText : "Select Projects",
91                                     forceSelection : true,
92                                     listWidth : 400,
93                                     loadingText : "Searching...",
94                                     minChars : 2,
95                                     pageSize : 20,
96                                     qtip : "Select Projects",
97                                     selectOnFocus : true,
98                                     triggerAction : 'all',
99                                     typeAhead : true,
100                                     width : 300,
101                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
102                                     queryParam : 'query[name]',
103                                     fieldLabel : 'Project',
104                                     valueField : 'id',
105                                     displayField : 'name',
106                                     hiddenName : 'project_id',
107                                     name : 'project_id_name',
108                                     store : {
109                                         xtype: 'Store',
110                                         xns: Roo.data,
111                                         listeners : {
112                                             beforeload : function (_self, o){
113                                                 o.params = o.params || {};
114                                                 // set more here
115                                             }
116                                         },
117                                         remoteSort : true,
118                                         sortInfo : { direction : 'ASC', field: 'name' },
119                                         proxy : {
120                                             xtype: 'HttpProxy',
121                                             xns: Roo.data,
122                                             method : 'GET',
123                                             url : baseURL + '/Roo/Projects.php'
124                                         },
125                                         reader : {
126                                             xtype: 'JsonReader',
127                                             xns: Roo.data,
128                                             id : 'id',
129                                             root : 'data',
130                                             totalProperty : 'total',
131                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
132                                         }
133                                     }
134                                 },
135                                 {
136                                     xtype: 'ComboBox',
137                                     xns: Roo.form,
138                                     allowBlank : 'false',
139                                     editable : 'false',
140                                     emptyText : "Select core_enum",
141                                     forceSelection : true,
142                                     listWidth : 400,
143                                     loadingText : "Searching...",
144                                     minChars : 2,
145                                     pageSize : 20,
146                                     qtip : "Select core_enum",
147                                     selectOnFocus : true,
148                                     triggerAction : 'all',
149                                     typeAhead : true,
150                                     width : 300,
151                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{etype}</b> </div>',
152                                     queryParam : 'query[etype]',
153                                     fieldLabel : 'Priority',
154                                     valueField : 'id',
155                                     displayField : 'etype',
156                                     hiddenName : 'priority_id',
157                                     name : 'priority_id_etype',
158                                     store : {
159                                         xtype: 'Store',
160                                         xns: Roo.data,
161                                         listeners : {
162                                             beforeload : function (_self, o){
163                                                 o.params = o.params || {};
164                                                 // set more here
165                                                 o.params.etype = 'priority';
166                                             }
167                                         },
168                                         remoteSort : true,
169                                         sortInfo : { direction : 'ASC', field: 'seqid' },
170                                         proxy : {
171                                             xtype: 'HttpProxy',
172                                             xns: Roo.data,
173                                             method : 'GET',
174                                             url : baseURL + '/Roo/core_enum.php'
175                                         },
176                                         reader : {
177                                             xtype: 'JsonReader',
178                                             xns: Roo.data,
179                                             id : 'id',
180                                             root : 'data',
181                                             totalProperty : 'total',
182                                             fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
183                                         }
184                                     }
185                                 },
186                                 {
187                                     xtype: 'ComboBox',
188                                     xns: Roo.form,
189                                     allowBlank : 'false',
190                                     displayField : 'display_name',
191                                     editable : 'false',
192                                     emptyText : "Status",
193                                     fieldLabel : 'Status',
194                                     forceSelection : true,
195                                     hiddenName : 'select status',
196                                     listWidth : 400,
197                                     loadingText : "Searching...",
198                                     minChars : 2,
199                                     name : 'status_display_name',
200                                     pageSize : 20,
201                                     qtip : "Select status",
202                                     queryParam : 'query[etype]',
203                                     selectOnFocus : true,
204                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{display_name}</b> </div>',
205                                     triggerAction : 'all',
206                                     typeAhead : true,
207                                     valueField : 'id',
208                                     width : 300,
209                                     store : {
210                                         xtype: 'Store',
211                                         xns: Roo.data,
212                                         listeners : {
213                                             beforeload : function (_self, o){
214                                                 o.params = o.params || {};
215                                                 // set more here
216                                                 
217                                                 o.params['query[ticket_change]'] = _this.ids;
218                                             
219                                             }
220                                         },
221                                         remoteSort : true,
222                                         sortInfo : { direction : 'ASC', field: 'id' },
223                                         proxy : {
224                                             xtype: 'HttpProxy',
225                                             xns: Roo.data,
226                                             method : 'GET',
227                                             url : baseURL + '/Roo/core_enum.php'
228                                         },
229                                         reader : {
230                                             xtype: 'JsonReader',
231                                             xns: Roo.data,
232                                             id : 'id',
233                                             root : 'data',
234                                             totalProperty : 'total',
235                                             fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
236                                         }
237                                     }
238                                 },
239                                 {
240                                     xtype: 'ComboBox',
241                                     xns: Roo.form,
242                                     allowBlank : 'false',
243                                     editable : 'false',
244                                     emptyText : "Select Person",
245                                     forceSelection : true,
246                                     listWidth : 400,
247                                     loadingText : "Searching...",
248                                     minChars : 2,
249                                     pageSize : 20,
250                                     qtip : "Select Person",
251                                     selectOnFocus : true,
252                                     triggerAction : 'all',
253                                     typeAhead : true,
254                                     width : 300,
255                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
256                                     queryParam : 'query[name]',
257                                     fieldLabel : 'Developer',
258                                     valueField : 'id',
259                                     displayField : 'name',
260                                     hiddenName : 'developer_id',
261                                     name : 'developer_id_name',
262                                     store : {
263                                         xtype: 'Store',
264                                         xns: Roo.data,
265                                         listeners : {
266                                             beforeload : function (_self, o){
267                                                 o.params = o.params || {};
268                                                 // set more here
269                                                 o.params['query[project_id]'] = _this.project_id
270                                                 o.params['query[role]'] = 'DEVELOPER';
271                                             }
272                                         },
273                                         remoteSort : true,
274                                         sortInfo : { direction : 'ASC', field: 'id' },
275                                         proxy : {
276                                             xtype: 'HttpProxy',
277                                             xns: Roo.data,
278                                             method : 'GET',
279                                             url : baseURL + '/Roo/Person.php'
280                                         },
281                                         reader : {
282                                             xtype: 'JsonReader',
283                                             xns: Roo.data,
284                                             id : 'id',
285                                             root : 'data',
286                                             totalProperty : 'total',
287                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
288                                         }
289                                     }
290                                 },
291                                 {
292                                     xtype: 'Hidden',
293                                     xns: Roo.form,
294                                     name : 'id'
295                                 }
296                             ]
297                         }
298                     ]
299                 }
300             ],
301             center : {
302                 xtype: 'LayoutRegion',
303                 xns: Roo
304             },
305             buttons : [
306                 {
307                     xtype: 'Button',
308                     xns: Roo,
309                     listeners : {
310                         click : function (_self, e)
311                         {
312                             _this.dialog.hide();
313                         }
314                     },
315                     text : "Cancel"
316                 },
317                 {
318                     xtype: 'Button',
319                     xns: Roo,
320                     listeners : {
321                         click : function (_self, e)
322                         {
323                             // do some checks?
324                             var params = _this.form.getValues();
325                             params._bulk_update = _this.form.ids;
326                             Roo.log(params);
327                             return;
328                             Pman.Request({
329                                 url : baseURL + '/Roo/mtrack_ticket',
330                                 method : 'POST',
331                                 params : params,
332                                 success : function() {
333                                     _this.dialog.hide();
334                                 }
335                              });
336                              
337                              
338                             //_this.form.doAction("submit");
339                         
340                         }
341                     },
342                     text : "Update"
343                 }
344             ]
345         });
346     }
347 };