Mercurial > lada > lada-client
comparison app/view/proben/Edit.js @ 71:db26aeebe521
Added new Form for editing proben. Use this form in the edit window.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Wed, 05 Jun 2013 16:20:54 +0200 |
parents | 73bc17de6ff2 |
children | 95b08b96f5c9 |
comparison
equal
deleted
inserted
replaced
70:1a943947a7d2 | 71:db26aeebe521 |
---|---|
10 autoShow: true, | 10 autoShow: true, |
11 autoScroll: true, | 11 autoScroll: true, |
12 modal: true, | 12 modal: true, |
13 | 13 |
14 requires: [ | 14 requires: [ |
15 'Lada.view.proben.EditForm', | |
15 'Lada.view.widgets.Uwb', | 16 'Lada.view.widgets.Uwb', |
16 'Lada.view.widgets.Datenbasis', | 17 'Lada.view.widgets.Datenbasis', |
17 'Lada.view.widgets.Probenart', | 18 'Lada.view.widgets.Probenart', |
18 'Lada.view.widgets.Betriebsart', | 19 'Lada.view.widgets.Betriebsart', |
19 'Lada.view.widgets.Testdatensatz', | 20 'Lada.view.widgets.Testdatensatz', |
20 'Lada.view.kommentare.List' | 21 'Lada.view.kommentare.List' |
21 ], | 22 ], |
22 | 23 |
23 initComponent: function() { | 24 initComponent: function() { |
24 this.items = [ | 25 // InitialConfig is the config object passed to the constructor on |
25 { | 26 // creation of this window. We need to pass it throuh to the form as |
26 //Define the form | 27 // we need the "modelId" param to load the correct item. |
27 xtype: 'form', | 28 var form = Ext.create('Lada.view.proben.EditForm', this.initialConfig); |
28 bodyPadding: '10 10', | 29 // Load kommentare |
29 border: 0, | 30 //var record = form.getRecord(); |
30 items: [ | 31 var kommentare = form.down('kommentarelist'); //form.down('kommentare'); |
31 // Probenangaben | 32 var kstore = kommentare.getStore(); |
32 { | 33 kstore.load({ |
33 xtype: 'fieldset', | 34 params: { |
34 title: 'Probenangaben', | 35 probe: this.initialConfig['modelId'] |
35 defaults: { | 36 //probe: record.data['probeId'] |
36 labelWidth: 150 | |
37 }, | |
38 items: [ | |
39 { | |
40 xtype: 'textfield', | |
41 name: 'mstId', | |
42 fieldLabel: 'Messstelle' | |
43 }, | |
44 { | |
45 xtype: 'textfield', | |
46 name: 'hauptprobenNr', | |
47 fieldLabel: 'Hauptprobennr.' | |
48 }, | |
49 { | |
50 xtype: 'textfield', | |
51 name: 'probeId', | |
52 fieldLabel: 'Probe-ID' | |
53 }, | |
54 { | |
55 xtype: 'fieldset', | |
56 title: 'Erweiterte Probenangaben', | |
57 collapsible: true, | |
58 collapsed: true, | |
59 items: [ | |
60 { | |
61 xtype: 'datenbasis', | |
62 id: 'datenbasis', | |
63 editable: false, | |
64 name: 'datenbasisId', | |
65 fieldLabel: 'Datenbasis' | |
66 }, | |
67 { | |
68 xtype: 'betriebsart', | |
69 name: 'baId', | |
70 fieldLabel: 'Betriebsart' | |
71 }, | |
72 { | |
73 xtype: 'testdatensatz', | |
74 name: 'test', | |
75 fieldLabel: 'Testdatensatz' | |
76 }, | |
77 { | |
78 xtype: 'probenart', | |
79 id: 'probenart', | |
80 editable: false, | |
81 name: 'probenartId', | |
82 fieldLabel: 'Probenart' | |
83 }, | |
84 { | |
85 xtype: 'textfield', | |
86 name: 'probenartId', | |
87 fieldLabel: 'Probennehmer' | |
88 }, | |
89 { | |
90 xtype: 'textfield', | |
91 name: 'x11', | |
92 fieldLabel: 'Datensatzerzeuger' | |
93 } | |
94 ] | |
95 } | |
96 ] | |
97 }, | |
98 // Medium | |
99 { | |
100 xtype: 'fieldset', | |
101 title: 'Medium', | |
102 defaults: { | |
103 labelWidth: 150 | |
104 }, | |
105 items: [ | |
106 { | |
107 xtype: 'uwb', | |
108 name: 'umwId', | |
109 fieldLabel: 'Umweltbereich' | |
110 }, | |
111 { | |
112 xtype: 'textfield', | |
113 name: 'media', | |
114 fieldLabel: 'Medienbezeichnung' | |
115 }, | |
116 { | |
117 xtype: 'textfield', | |
118 name: 'mediaDesk', | |
119 fieldLabel: 'Deskriptoren' | |
120 }, | |
121 { | |
122 xtype: 'fieldset', | |
123 title: 'Details Deskriptoren', | |
124 collapsible: true, | |
125 collapsed: true, | |
126 defaultType: 'textfield', | |
127 items: this.buildDescriptors() | |
128 } | |
129 ] | |
130 }, | |
131 // Zeit | |
132 { | |
133 xtype: 'fieldset', | |
134 title: 'Zeit', | |
135 defaultType: 'datefield', | |
136 defaults: { | |
137 labelWidth: 150 | |
138 }, | |
139 items: [ | |
140 { | |
141 fieldLabel: 'Probennahme Beginn', | |
142 name: 'probeentnahmeBeginn' | |
143 }, | |
144 { | |
145 fieldLabel: 'Probennahme Ende', | |
146 name: 'probeentnahmeEnde' | |
147 }, | |
148 { | |
149 fieldLabel: 'Sollzeit Von', | |
150 name: 'solldatumBeginn' | |
151 }, | |
152 { | |
153 fieldLabel: 'Sollzeit Bis', | |
154 name: 'solldatumEnde' | |
155 }, | |
156 { | |
157 fieldLabel: 'Ursprungszeit', | |
158 name: 'z5' | |
159 } | |
160 ] | |
161 }, | |
162 // Ortsangaben | |
163 { | |
164 xtype: 'fieldset', | |
165 title: 'Ortsangaben', | |
166 padding: '10 10', | |
167 items: [ | |
168 { | |
169 xtype: 'grid', | |
170 dockedItems: [ | |
171 { | |
172 xtype: 'toolbar', | |
173 dock: 'top', | |
174 items: [ | |
175 { | |
176 text: 'Hinzufügen', | |
177 icon: 'gfx/plus.gif' | |
178 }, | |
179 { | |
180 text: 'Löschen', | |
181 icon: 'gfx/minus.gif' | |
182 } | |
183 ] | |
184 } | |
185 ], | |
186 columns: [ | |
187 { | |
188 text: 'Typ' | |
189 }, | |
190 { | |
191 text: 'Staat' | |
192 }, | |
193 { | |
194 text: 'Gem-ID' | |
195 }, | |
196 { | |
197 text: 'Gemeindebezeichnung', | |
198 flex: 1 | |
199 }, | |
200 { | |
201 text: 'Messpunkt', | |
202 flex: 1 | |
203 } | |
204 ] | |
205 } | |
206 ] | |
207 }, | |
208 // Probenzusatzwerte | |
209 { | |
210 xtype: 'fieldset', | |
211 title: 'Probenzusatzwerte', | |
212 collapsible: true, | |
213 collapsed: true, | |
214 padding: '10 10', | |
215 items: [ | |
216 { | |
217 xtype: 'grid', | |
218 dockedItems: [ | |
219 { | |
220 xtype: 'toolbar', | |
221 dock: 'top', | |
222 items: [ | |
223 { | |
224 text: 'Hinzufügen', | |
225 icon: 'gfx/plus.gif' | |
226 }, | |
227 { | |
228 text: 'Löschen', | |
229 icon: 'gfx/minus.gif' | |
230 } | |
231 ] | |
232 } | |
233 ], | |
234 columns: [ | |
235 { | |
236 text: 'PZW-ID' | |
237 }, | |
238 { | |
239 text: 'PZW-Größe' | |
240 }, | |
241 { | |
242 text: '< NWG' | |
243 }, | |
244 { | |
245 text: '< PZW' | |
246 }, | |
247 { | |
248 text: 'rel. Unsich.[%]' | |
249 }, | |
250 { | |
251 text: 'Maßeinheit', | |
252 flex: 1 | |
253 } | |
254 ] | |
255 } | |
256 ] | |
257 }, | |
258 // Probenkommentar | |
259 { | |
260 xtype: 'fieldset', | |
261 title: 'Probenkommentare', | |
262 collapsible: true, | |
263 collapsed: true, | |
264 padding: '10 10', | |
265 items: [ | |
266 { | |
267 xtype: 'kommentarelist' | |
268 } | |
269 ] | |
270 }, | |
271 // Messungsangaben | |
272 { | |
273 xtype: 'fieldset', | |
274 title: 'Messungsangaben', | |
275 padding: '10 10', | |
276 items: [ | |
277 { | |
278 xtype: 'grid', | |
279 dockedItems: [ | |
280 { | |
281 xtype: 'toolbar', | |
282 dock: 'top', | |
283 items: [ | |
284 { | |
285 text: 'Hinzufügen', | |
286 icon: 'gfx/plus.gif' | |
287 }, | |
288 { | |
289 text: 'Löschen', | |
290 icon: 'gfx/minus.gif' | |
291 } | |
292 ] | |
293 } | |
294 ], | |
295 columns: [ | |
296 { | |
297 text: 'Mess.ID', | |
298 width: 50 | |
299 }, | |
300 { | |
301 text: 'NPR-Nr.', | |
302 width: 50 | |
303 }, | |
304 { | |
305 text: 'MMT', | |
306 width: 50 | |
307 }, | |
308 { | |
309 text: 'Messzeit' | |
310 }, | |
311 { | |
312 text: 'Status' | |
313 }, | |
314 { | |
315 text: 'OK-Flag' | |
316 }, | |
317 { | |
318 text: 'Anzahl Nuklide' | |
319 }, | |
320 { | |
321 text: 'Anzahl Kommentare', | |
322 flex: 1 | |
323 } | |
324 ] | |
325 } | |
326 ] | |
327 } | |
328 ] | |
329 } | 37 } |
330 ]; | 38 }); |
331 | 39 this.items = [form]; |
332 this.buttons = [ | 40 this.buttons = [ |
333 { | 41 { |
334 text: 'Speichern', | 42 text: 'Speichern', |
335 action: 'save' | 43 handler: form.commit, |
336 }, | 44 scope: form |
337 { | |
338 text: 'Verwerfen', | |
339 scope: this, | |
340 handler: this.close | |
341 } | 45 } |
342 ]; | 46 ]; |
343 this.callParent(arguments); | 47 this.callParent(); |
344 }, | |
345 buildDescriptors: function() { | |
346 var fields = new Array(); | |
347 for ($i=0; $i<12; $i++) { | |
348 fields[$i] = {fieldLabel: 'S'+$i, name: 's'+$i}; | |
349 } | |
350 return fields; | |
351 }, | |
352 listeners: { | |
353 afterrender: function() { | |
354 // FIXME: This does not work! I do not know how to set the correct | |
355 // value in the combobox based on the model value. | |
356 // Will iterate over defined comboboxes and set the value | |
357 var combos = ['probenart', 'datenbasis']; | |
358 for (var i = combos.length - 1; i >= 0; i--){ | |
359 console.log('Searching for ' + combos[i]); | |
360 var element = Ext.getCmp(combos[i]); | |
361 // Statically set to 2. Must be the value from the model. | |
362 element.setValue(2); | |
363 } | |
364 } | |
365 } | 48 } |
366 }); | 49 }); |
367 | 50 |