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: 'ComboBox',
83                                     xns: Roo.form,
84                                     allowBlank : 'false',
85                                     displayField : 'name',
86                                     editable : 'false',
87                                     emptyText : "Select Project",
88                                     fieldLabel : 'Project',
89                                     forceSelection : true,
90                                     hiddenName : 'project_id',
91                                     listWidth : 400,
92                                     loadingText : "Searching...",
93                                     minChars : 2,
94                                     name : 'project_id_name',
95                                     pageSize : 20,
96                                     qtip : "Select Projects",
97                                     queryParam : 'query[name]',
98                                     selectOnFocus : true,
99                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
100                                     triggerAction : 'all',
101                                     typeAhead : true,
102                                     valueField : 'id',
103                                     width : 300,
104                                     store : {
105                                         xtype: 'Store',
106                                         xns: Roo.data,
107                                         remoteSort : true,
108                                         sortInfo : { direction : 'ASC', field: 'id' },
109                                         listeners : {
110                                             beforeload : function (_self, o){
111                                                 o.params = o.params || {};
112                                                 // set more here
113                                             }
114                                         },
115                                         proxy : {
116                                             xtype: 'HttpProxy',
117                                             xns: Roo.data,
118                                             method : 'GET',
119                                             url : baseURL + '/Roo/Projects.php'
120                                         },
121                                         reader : {
122                                             xtype: 'JsonReader',
123                                             xns: Roo.data,
124                                             id : 'id',
125                                             root : 'data',
126                                             totalProperty : 'total',
127                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
128                                         }
129                                     }
130                                 },
131                                 {
132                                     xtype: 'TextField',
133                                     xns: Roo.form,
134                                     fieldLabel : 'Name',
135                                     name : 'name',
136                                     width : 200
137                                 },
138                                 {
139                                     xtype: 'TextArea',
140                                     xns: Roo.form,
141                                     fieldLabel : 'Description',
142                                     name : 'description',
143                                     width : 200,
144                                     height : 100
145                                 },
146                                 {
147                                     xtype: 'DateField',
148                                     xns: Roo.form,
149                                     fieldLabel : 'Startdate',
150                                     name : 'startdate',
151                                     width : 75
152                                 },
153                                 {
154                                     xtype: 'DateField',
155                                     xns: Roo.form,
156                                     fieldLabel : 'Duedate',
157                                     name : 'duedate',
158                                     width : 75
159                                 },
160                                 {
161                                     xtype: 'DateField',
162                                     xns: Roo.form,
163                                     fieldLabel : 'Completed',
164                                     name : 'completed',
165                                     width : 75
166                                 },
167                                 {
168                                     xtype: 'Hidden',
169                                     xns: Roo.form,
170                                     name : 'id'
171                                 }
172                             ]
173                         }
174                     ]
175                 }
176             ],
177             center : {
178                 xtype: 'LayoutRegion',
179                 xns: Roo
180             },
181             buttons : [
182                 {
183                     xtype: 'Button',
184                     xns: Roo,
185                     listeners : {
186                         click : function (_self, e)
187                         {
188                             _this.dialog.hide();
189                         }
190                     },
191                     text : "Cancel"
192                 },
193                 {
194                     xtype: 'Button',
195                     xns: Roo,
196                     listeners : {
197                         click : function (_self, e)
198                         {
199                             // do some checks?
200                              
201                             
202                             _this.dialog.el.mask("Saving");
203                             _this.form.doAction("submit");
204                         
205                         }
206                     },
207                     text : "Save"
208                 }
209             ]
210         });
211     }
212 };