Pman.Dialog.MTrackMilestone.js
[Pman.MTrack] / Pman.Dialog.MTrackMilestone.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.MTrackMilestone = {
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 : 390,
36             resizable : false,
37             title : "Edit / Create mtrack_milestone",
38             width : 400,
39             items : [
40                 {
41                     xtype: 'ContentPanel',
42                     xns: Roo,
43                     region : 'center',
44                     items : [
45                         {
46                             xtype: 'Form',
47                             xns: Roo.form,
48                             listeners : {
49                                 actioncomplete : function(_self,action)
50                                 {
51                                     if (action.type == 'setdata') {
52                                        //_this.dialog.el.mask("Loading");
53                                        //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
54                                        return;
55                                     }
56                                     if (action.type == 'load') {
57                                         _this.dialog.el.unmask();
58                                         return;
59                                     }
60                                     if (action.type =='submit') {
61                                     
62                                         _this.dialog.el.unmask();
63                                         _this.dialog.hide();
64                                     
65                                          if (_this.callback) {
66                                             _this.callback.call(_this, _this.form.getValues());
67                                          }
68                                          _this.form.reset();
69                                          return;
70                                     }
71                                 },
72                                 rendered : function (form)
73                                 {
74                                     _this.form= form;
75                                 }
76                             },
77                             method : 'POST',
78                             style : 'margin:10px;',
79                             url : baseURL + '/Roo/mtrack_milestone.php',
80                             items : [
81                                 {
82                                     xtype: 'TextField',
83                                     xns: Roo.form,
84                                     fieldLabel : 'Name',
85                                     name : 'name',
86                                     width : 200
87                                 },
88                                 {
89                                     xtype: 'TextArea',
90                                     xns: Roo.form,
91                                     fieldLabel : 'Description',
92                                     name : 'description',
93                                     width : 200,
94                                     height : 100
95                                 },
96                                 {
97                                     xtype: 'DateField',
98                                     xns: Roo.form,
99                                     fieldLabel : 'Startdate',
100                                     name : 'startdate',
101                                     width : 75
102                                 },
103                                 {
104                                     xtype: 'DateField',
105                                     xns: Roo.form,
106                                     fieldLabel : 'Duedate',
107                                     name : 'duedate',
108                                     width : 75
109                                 },
110                                 {
111                                     xtype: 'DateField',
112                                     xns: Roo.form,
113                                     fieldLabel : 'Completed',
114                                     name : 'completed',
115                                     width : 75
116                                 },
117                                 {
118                                     xtype: 'ComboBox',
119                                     xns: Roo.form,
120                                     allowBlank : 'false',
121                                     editable : 'false',
122                                     emptyText : "Select mtrack_change",
123                                     forceSelection : true,
124                                     listWidth : 400,
125                                     loadingText : "Searching...",
126                                     minChars : 2,
127                                     pageSize : 20,
128                                     qtip : "Select mtrack_change",
129                                     selectOnFocus : true,
130                                     triggerAction : 'all',
131                                     typeAhead : true,
132                                     width : 300,
133                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{ontable}</b> </div>',
134                                     queryParam : 'query[ontable]',
135                                     fieldLabel : 'Deleted',
136                                     valueField : 'id',
137                                     displayField : 'ontable',
138                                     hiddenName : 'deleted',
139                                     name : 'deleted_ontable',
140                                     store : {
141                                         xtype: 'Store',
142                                         xns: Roo.data,
143                                         remoteSort : true,
144                                         sortInfo : { direction : 'ASC', field: 'id' },
145                                         listeners : {
146                                             beforeload : function (_self, o){
147                                                 o.params = o.params || {};
148                                                 // set more here
149                                             }
150                                         },
151                                         proxy : {
152                                             xtype: 'HttpProxy',
153                                             xns: Roo.data,
154                                             method : 'GET',
155                                             url : baseURL + '/Roo/mtrack_change.php'
156                                         },
157                                         reader : {
158                                             xtype: 'JsonReader',
159                                             xns: Roo.data,
160                                             id : 'id',
161                                             root : 'data',
162                                             totalProperty : 'total',
163                                             fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}]
164                                         }
165                                     }
166                                 },
167                                 {
168                                     xtype: 'ComboBox',
169                                     xns: Roo.form,
170                                     allowBlank : 'false',
171                                     editable : 'false',
172                                     emptyText : "Select mtrack_change",
173                                     forceSelection : true,
174                                     listWidth : 400,
175                                     loadingText : "Searching...",
176                                     minChars : 2,
177                                     pageSize : 20,
178                                     qtip : "Select mtrack_change",
179                                     selectOnFocus : true,
180                                     triggerAction : 'all',
181                                     typeAhead : true,
182                                     width : 300,
183                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{ontable}</b> </div>',
184                                     queryParam : 'query[ontable]',
185                                     fieldLabel : 'Created',
186                                     valueField : 'id',
187                                     displayField : 'ontable',
188                                     hiddenName : 'created',
189                                     name : 'created_ontable',
190                                     store : {
191                                         xtype: 'Store',
192                                         xns: Roo.data,
193                                         remoteSort : true,
194                                         sortInfo : { direction : 'ASC', field: 'id' },
195                                         listeners : {
196                                             beforeload : function (_self, o){
197                                                 o.params = o.params || {};
198                                                 // set more here
199                                             }
200                                         },
201                                         proxy : {
202                                             xtype: 'HttpProxy',
203                                             xns: Roo.data,
204                                             method : 'GET',
205                                             url : baseURL + '/Roo/mtrack_change.php'
206                                         },
207                                         reader : {
208                                             xtype: 'JsonReader',
209                                             xns: Roo.data,
210                                             id : 'id',
211                                             root : 'data',
212                                             totalProperty : 'total',
213                                             fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}]
214                                         }
215                                     }
216                                 },
217                                 {
218                                     xtype: 'ComboBox',
219                                     xns: Roo.form,
220                                     allowBlank : 'false',
221                                     editable : 'false',
222                                     emptyText : "Select mtrack_change",
223                                     forceSelection : true,
224                                     listWidth : 400,
225                                     loadingText : "Searching...",
226                                     minChars : 2,
227                                     pageSize : 20,
228                                     qtip : "Select mtrack_change",
229                                     selectOnFocus : true,
230                                     triggerAction : 'all',
231                                     typeAhead : true,
232                                     width : 300,
233                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{ontable}</b> </div>',
234                                     queryParam : 'query[ontable]',
235                                     fieldLabel : 'Updated',
236                                     valueField : 'id',
237                                     displayField : 'ontable',
238                                     hiddenName : 'updated',
239                                     name : 'updated_ontable',
240                                     store : {
241                                         xtype: 'Store',
242                                         xns: Roo.data,
243                                         remoteSort : true,
244                                         sortInfo : { direction : 'ASC', field: 'id' },
245                                         listeners : {
246                                             beforeload : function (_self, o){
247                                                 o.params = o.params || {};
248                                                 // set more here
249                                             }
250                                         },
251                                         proxy : {
252                                             xtype: 'HttpProxy',
253                                             xns: Roo.data,
254                                             method : 'GET',
255                                             url : baseURL + '/Roo/mtrack_change.php'
256                                         },
257                                         reader : {
258                                             xtype: 'JsonReader',
259                                             xns: Roo.data,
260                                             id : 'id',
261                                             root : 'data',
262                                             totalProperty : 'total',
263                                             fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}]
264                                         }
265                                     }
266                                 },
267                                 {
268                                     xtype: 'TextField',
269                                     xns: Roo.form,
270                                     fieldLabel : 'Project',
271                                     name : 'project_id',
272                                     width : 75
273                                 },
274                                 {
275                                     xtype: 'Hidden',
276                                     xns: Roo.form,
277                                     name : 'id'
278                                 }
279                             ]
280                         }
281                     ]
282                 }
283             ],
284             center : {
285                 xtype: 'LayoutRegion',
286                 xns: Roo
287             },
288             buttons : [
289                 {
290                     xtype: 'Button',
291                     xns: Roo,
292                     listeners : {
293                         click : function (_self, e)
294                         {
295                             _this.dialog.hide();
296                         }
297                     },
298                     text : "Cancel"
299                 },
300                 {
301                     xtype: 'Button',
302                     xns: Roo,
303                     listeners : {
304                         click : function (_self, e)
305                         {
306                             // do some checks?
307                              
308                             
309                             _this.dialog.el.mask("Saving");
310                             _this.form.doAction("submit");
311                         
312                         }
313                     },
314                     text : "Save"
315                 }
316             ]
317         });
318     }
319 };