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                                     displayField : 'display_name',
192                                     editable : 'false',
193                                     emptyText : "Status",
194                                     fieldLabel : 'Status',
195                                     forceSelection : true,
196                                     hiddenName : 'select status',
197                                     listWidth : 400,
198                                     loadingText : "Searching...",
199                                     minChars : 2,
200                                     name : 'status_display_name',
201                                     pageSize : 20,
202                                     qtip : "Select status",
203                                     queryParam : 'query[etype]',
204                                     selectOnFocus : true,
205                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{display_name}</b> </div>',
206                                     triggerAction : 'all',
207                                     typeAhead : true,
208                                     valueField : 'id',
209                                     width : 300,
210                                     store : {
211                                         xtype: 'Store',
212                                         xns: Roo.data,
213                                         listeners : {
214                                             beforeload : function (_self, o){
215                                                 o.params = o.params || {};
216                                                 // set more here
217                                                 
218                                                 o.params['query[ticket_change]'] = _this.data.ids;
219                                             
220                                             }
221                                         },
222                                         remoteSort : true,
223                                         sortInfo : { direction : 'ASC', field: 'id' },
224                                         proxy : {
225                                             xtype: 'HttpProxy',
226                                             xns: Roo.data,
227                                             method : 'GET',
228                                             url : baseURL + '/Roo/core_enum.php'
229                                         },
230                                         reader : {
231                                             xtype: 'JsonReader',
232                                             xns: Roo.data,
233                                             id : 'id',
234                                             root : 'data',
235                                             totalProperty : 'total',
236                                             fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
237                                         }
238                                     }
239                                 },
240                                 {
241                                     xtype: 'ComboBox',
242                                     xns: Roo.form,
243                                     allowBlank : 'false',
244                                     editable : 'false',
245                                     emptyText : "Select Person",
246                                     forceSelection : true,
247                                     listWidth : 400,
248                                     loadingText : "Searching...",
249                                     minChars : 2,
250                                     pageSize : 20,
251                                     qtip : "Select Person",
252                                     selectOnFocus : true,
253                                     triggerAction : 'all',
254                                     typeAhead : true,
255                                     width : 300,
256                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
257                                     queryParam : 'query[name]',
258                                     fieldLabel : 'Developer',
259                                     valueField : 'id',
260                                     displayField : 'name',
261                                     hiddenName : 'developer_id',
262                                     name : 'developer_id_name',
263                                     store : {
264                                         xtype: 'Store',
265                                         xns: Roo.data,
266                                         listeners : {
267                                             beforeload : function (_self, o){
268                                                 o.params = o.params || {};
269                                                 // set more here
270                                                 o.params['query[project_id]'] = _this.project_id
271                                                 o.params['query[role]'] = 'DEVELOPER';
272                                             }
273                                         },
274                                         remoteSort : true,
275                                         sortInfo : { direction : 'ASC', field: 'id' },
276                                         proxy : {
277                                             xtype: 'HttpProxy',
278                                             xns: Roo.data,
279                                             method : 'GET',
280                                             url : baseURL + '/Roo/Person.php'
281                                         },
282                                         reader : {
283                                             xtype: 'JsonReader',
284                                             xns: Roo.data,
285                                             id : 'id',
286                                             root : 'data',
287                                             totalProperty : 'total',
288                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
289                                         }
290                                     }
291                                 },
292                                 {
293                                     xtype: 'Hidden',
294                                     xns: Roo.form,
295                                     name : 'id'
296                                 }
297                             ]
298                         }
299                     ]
300                 }
301             ],
302             center : {
303                 xtype: 'LayoutRegion',
304                 xns: Roo
305             },
306             buttons : [
307                 {
308                     xtype: 'Button',
309                     xns: Roo,
310                     listeners : {
311                         click : function (_self, e)
312                         {
313                             _this.dialog.hide();
314                         }
315                     },
316                     text : "Cancel"
317                 },
318                 {
319                     xtype: 'Button',
320                     xns: Roo,
321                     listeners : {
322                         click : function (_self, e)
323                         {
324                             // do some checks?
325                             var params = _this.form.getValues();
326                             params._bulk_update = _this.form.ids;
327                             Roo.log(params);
328                             return;
329                             Pman.Request({
330                                 url : baseURL + '/Roo/mtrack_ticket',
331                                 method : 'POST',
332                                 params : params,
333                                 success : function() {
334                                     _this.dialog.hide();
335                                 }
336                              });
337                              
338                              
339                             //_this.form.doAction("submit");
340                         
341                         }
342                     },
343                     text : "Update"
344                 }
345             ]
346         });
347     }
348 };