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                                  
62                                         return;
63                                     }
64                                     if (action.type =='submit') {
65                                         return;
66                                         // not used here..
67                                  
68                                         _this.dialog.hide();
69                                     
70                                          if (_this.callback) {
71                                             _this.callback.call(_this, _this.form.getValues());
72                                          }
73                                          _this.form.reset();
74                                          return;
75                                     }
76                                 },
77                                 rendered : function (form)
78                                 {
79                                     _this.form= form;
80                                 }
81                             },
82                             method : 'POST',
83                             style : 'margin:10px;',
84                             url : baseURL + '/Roo/mtrack_ticket.php',
85                             items : [
86                                 {
87                                     xtype: 'ComboBox',
88                                     xns: Roo.form,
89                                     allowBlank : 'false',
90                                     editable : 'false',
91                                     emptyText : "Select Projects",
92                                     forceSelection : true,
93                                     listWidth : 400,
94                                     loadingText : "Searching...",
95                                     minChars : 2,
96                                     pageSize : 20,
97                                     qtip : "Select Projects",
98                                     selectOnFocus : true,
99                                     triggerAction : 'all',
100                                     typeAhead : true,
101                                     width : 300,
102                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
103                                     queryParam : 'query[name]',
104                                     fieldLabel : 'Project',
105                                     valueField : 'id',
106                                     displayField : 'name',
107                                     hiddenName : 'project_id',
108                                     name : 'project_id_name',
109                                     store : {
110                                         xtype: 'Store',
111                                         xns: Roo.data,
112                                         listeners : {
113                                             beforeload : function (_self, o){
114                                                 o.params = o.params || {};
115                                                 // set more here
116                                             }
117                                         },
118                                         remoteSort : true,
119                                         sortInfo : { direction : 'ASC', field: 'name' },
120                                         proxy : {
121                                             xtype: 'HttpProxy',
122                                             xns: Roo.data,
123                                             method : 'GET',
124                                             url : baseURL + '/Roo/Projects.php'
125                                         },
126                                         reader : {
127                                             xtype: 'JsonReader',
128                                             xns: Roo.data,
129                                             id : 'id',
130                                             root : 'data',
131                                             totalProperty : 'total',
132                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
133                                         }
134                                     }
135                                 },
136                                 {
137                                     xtype: 'ComboBox',
138                                     xns: Roo.form,
139                                     allowBlank : 'false',
140                                     displayField : 'display_name',
141                                     editable : 'false',
142                                     emptyText : "Select prioirty",
143                                     fieldLabel : 'Priority',
144                                     forceSelection : true,
145                                     hiddenName : 'priority_id',
146                                     listWidth : 400,
147                                     loadingText : "Searching...",
148                                     minChars : 2,
149                                     name : 'priority_id_display_name',
150                                     pageSize : 20,
151                                     qtip : "Select core_enum",
152                                     queryParam : 'query[etype]',
153                                     selectOnFocus : true,
154                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{display_name}</b> </div>',
155                                     triggerAction : 'all',
156                                     typeAhead : true,
157                                     valueField : 'id',
158                                     width : 300,
159                                     store : {
160                                         xtype: 'Store',
161                                         xns: Roo.data,
162                                         listeners : {
163                                             beforeload : function (_self, o){
164                                                 o.params = o.params || {};
165                                                 // set more here
166                                                 o.params.etype = 'priority';
167                                             }
168                                         },
169                                         remoteSort : true,
170                                         sortInfo : { direction : 'ASC', field: 'seqid' },
171                                         proxy : {
172                                             xtype: 'HttpProxy',
173                                             xns: Roo.data,
174                                             method : 'GET',
175                                             url : baseURL + '/Roo/core_enum.php'
176                                         },
177                                         reader : {
178                                             xtype: 'JsonReader',
179                                             xns: Roo.data,
180                                             id : 'id',
181                                             root : 'data',
182                                             totalProperty : 'total',
183                                             fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
184                                         }
185                                     }
186                                 },
187                                 {
188                                     xtype: 'ComboBox',
189                                     xns: Roo.form,
190                                     allowBlank : 'false',
191                                     alwaysQuery : true,
192                                     displayField : 'display_name',
193                                     editable : 'false',
194                                     emptyText : "Status",
195                                     fieldLabel : 'Status',
196                                     forceSelection : true,
197                                     hiddenName : 'select status',
198                                     listWidth : 400,
199                                     loadingText : "Searching...",
200                                     minChars : 2,
201                                     name : 'status_display_name',
202                                     pageSize : 20,
203                                     qtip : "Select status",
204                                     queryParam : 'query[etype]',
205                                     selectOnFocus : true,
206                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{display_name}</b> </div>',
207                                     triggerAction : 'all',
208                                     typeAhead : true,
209                                     valueField : 'id',
210                                     width : 300,
211                                     store : {
212                                         xtype: 'Store',
213                                         xns: Roo.data,
214                                         listeners : {
215                                             beforeload : function (_self, o){
216                                                 o.params = o.params || {};
217                                                 // set more here
218                                                 
219                                                 o.params['query[ticket_change]'] = _this.data.ids;
220                                             
221                                             }
222                                         },
223                                         remoteSort : true,
224                                         sortInfo : { direction : 'ASC', field: 'id' },
225                                         proxy : {
226                                             xtype: 'HttpProxy',
227                                             xns: Roo.data,
228                                             method : 'GET',
229                                             url : baseURL + '/Roo/core_enum.php'
230                                         },
231                                         reader : {
232                                             xtype: 'JsonReader',
233                                             xns: Roo.data,
234                                             id : 'id',
235                                             root : 'data',
236                                             totalProperty : 'total',
237                                             fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
238                                         }
239                                     }
240                                 },
241                                 {
242                                     xtype: 'ComboBox',
243                                     xns: Roo.form,
244                                     allowBlank : 'false',
245                                     displayField : 'name',
246                                     editable : 'false',
247                                     emptyText : "Select Person",
248                                     fieldLabel : 'Developer',
249                                     forceSelection : true,
250                                     hiddenName : 'developer_id',
251                                     listWidth : 400,
252                                     loadingText : "Searching...",
253                                     minChars : 2,
254                                     name : 'developer_id_name',
255                                     pageSize : 20,
256                                     qtip : "Select Person",
257                                     queryParam : 'query[name]',
258                                     selectOnFocus : true,
259                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> {email} </div>',
260                                     triggerAction : 'all',
261                                     typeAhead : true,
262                                     valueField : 'id',
263                                     width : 300,
264                                     store : {
265                                         xtype: 'Store',
266                                         xns: Roo.data,
267                                         listeners : {
268                                             beforeload : function (_self, o){
269                                                 o.params = o.params || {};
270                                                 // set more here
271                                                 o.params['query[project_id]'] = _this.data.project_id
272                                                 o.params['query[role]'] = 'DEVELOPER';
273                                             }
274                                         },
275                                         remoteSort : true,
276                                         sortInfo : { direction : 'ASC', field: 'name' },
277                                         proxy : {
278                                             xtype: 'HttpProxy',
279                                             xns: Roo.data,
280                                             method : 'GET',
281                                             url : baseURL + '/Roo/Person.php'
282                                         },
283                                         reader : {
284                                             xtype: 'JsonReader',
285                                             xns: Roo.data,
286                                             id : 'id',
287                                             root : 'data',
288                                             totalProperty : 'total',
289                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
290                                         }
291                                     }
292                                 }
293                             ]
294                         }
295                     ]
296                 }
297             ],
298             center : {
299                 xtype: 'LayoutRegion',
300                 xns: Roo
301             },
302             buttons : [
303                 {
304                     xtype: 'Button',
305                     xns: Roo,
306                     listeners : {
307                         click : function (_self, e)
308                         {
309                             _this.dialog.hide();
310                         }
311                     },
312                     text : "Cancel"
313                 },
314                 {
315                     xtype: 'Button',
316                     xns: Roo,
317                     listeners : {
318                         click : function (_self, e)
319                         {
320                             // do some checks?
321                             var params = _this.form.getValues();
322                             params._bulk_update = _this.data.ids;
323                           
324                             Pman.Request({
325                                 url : baseURL + '/Roo/mtrack_ticket',
326                                 method : 'POST',
327                                 params : params,
328                                 mask: 'updating',
329                                 success : function() {
330                                     _this.dialog.hide();
331                                 }
332                              });
333                         
334                              
335                             //_this.form.doAction("submit");
336                         
337                         }
338                     },
339                     text : "Update"
340                 }
341             ]
342         });
343     }
344 };