Mercurial > lada > lada-client
comparison app/view/form/Probe.js @ 548:d47ee7439f44
Added new js files.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 06 Mar 2015 12:43:52 +0100 |
parents | |
children | 7f8e64c5bd2e |
comparison
equal
deleted
inserted
replaced
547:f172b35a3b92 | 548:d47ee7439f44 |
---|---|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 | |
9 /* | |
10 * Formular to edit a Probe | |
11 */ | |
12 Ext.define('Lada.view.form.Probe', { | |
13 extend: 'Ext.form.Panel', | |
14 alias: 'widget.probeform', | |
15 requires: [ | |
16 'Lada.view.widget.Datenbasis', | |
17 'Lada.view.widget.Netzbetreiber', | |
18 'Lada.view.widget.Betriebsart', | |
19 'Lada.view.widget.Testdatensatz', | |
20 'Lada.view.widget.Probenart', | |
21 'Lada.view.widget.Umwelt', | |
22 'Lada.view.widget.base.TextField', | |
23 'Lada.view.widget.base.Datetime', | |
24 'Lada.view.widget.base.FieldSet', | |
25 'Lada.model.Probe' | |
26 ], | |
27 | |
28 model: 'Lada.model.Probe', | |
29 minWidth: 650, | |
30 margin: 5, | |
31 border: 0, | |
32 | |
33 recordId: null, | |
34 | |
35 trackResetOnLoad: true, | |
36 | |
37 initComponent: function() { | |
38 var me = this; | |
39 this.items = [{ | |
40 xtype: 'fieldset', | |
41 title: 'Allgemein', | |
42 items: [{ | |
43 border: 0, | |
44 margin: '0, 0, 10, 0', | |
45 dockedItems: [{ | |
46 xtype: 'toolbar', | |
47 dock: 'bottom', | |
48 border: '0, 1, 1, 1', | |
49 style: { | |
50 borderBottom: '1px solid #b5b8c8 !important', | |
51 borderLeft: '1px solid #b5b8c8 !important', | |
52 borderRight: '1px solid #b5b8c8 !important' | |
53 }, | |
54 items: ['->', { | |
55 text: 'Speichern', | |
56 qtip: 'Daten speichern', | |
57 icon: 'resources/img/dialog-ok-apply.png', | |
58 action: 'save', | |
59 disabled: true | |
60 }, { | |
61 text: 'Verwerfen', | |
62 qtip: 'Ă„nderungen verwerfen', | |
63 icon: 'resources/img/dialog-cancel.png', | |
64 action: 'discard', | |
65 disabled: true | |
66 }] | |
67 }], | |
68 items: [{ | |
69 layout: 'hbox', | |
70 border: 0, | |
71 items: [{ | |
72 border: 0, | |
73 width: '50%', | |
74 minWidth: 290, | |
75 layout: { | |
76 type: 'vbox', | |
77 align: 'stretch' | |
78 }, | |
79 margin: '0, 10, 0, 0', | |
80 items: [{ | |
81 xtype: 'messtelle', | |
82 name: 'mstId', | |
83 fieldLabel: 'Messstelle', | |
84 labelWidth: 135, | |
85 allowBlank: false | |
86 }, { | |
87 xtype: 'tfield', | |
88 name: 'hauptprobenNr', | |
89 maxLength: 20, | |
90 fieldLabel: 'Hauptprobennr.', | |
91 labelWidth: 135 | |
92 }] | |
93 }, { | |
94 border: 0, | |
95 width: '50%', | |
96 minWidth: 300, | |
97 items: [{ | |
98 xtype: 'fset', | |
99 title: 'Erweiterte Angaben', | |
100 collapsible: true, | |
101 collapsed: true, | |
102 items: [{ | |
103 xtype: 'datenbasis', | |
104 editable: false, | |
105 name: 'datenbasisId', | |
106 fieldLabel: 'Datenbasis', | |
107 labelWidth: 100, | |
108 listeners: { | |
109 dirtychange: { | |
110 fn: this.updateOnChange, | |
111 scope: me | |
112 } | |
113 } | |
114 }, { | |
115 xtype: 'betriebsart', | |
116 name: 'baId', | |
117 fieldLabel: 'Betriebsart', | |
118 labelWidth: 100, | |
119 listeners: { | |
120 dirtychange: { | |
121 fn: this.updateOnChange, | |
122 scope: me | |
123 } | |
124 } | |
125 }, { | |
126 xtype: 'testdatensatz', | |
127 name: 'test', | |
128 fieldLabel: 'Testdatensatz', | |
129 labelWidth: 100, | |
130 allowBlank: false, | |
131 listeners: { | |
132 dirtychange: { | |
133 fn: this.updateOnChange, | |
134 scope: me | |
135 } | |
136 } | |
137 }, { | |
138 xtype: 'probenart', | |
139 editable: false, | |
140 name: 'probenartId', | |
141 fieldLabel: 'Probenart', | |
142 labelWidth: 100, | |
143 allowBlank: false, | |
144 listeners: { | |
145 dirtychange: { | |
146 fn: this.updateOnChange, | |
147 scope: me | |
148 } | |
149 } | |
150 }, { | |
151 xtype: 'numberfield', | |
152 allowDecimals: false, | |
153 name: 'probeNehmerId', | |
154 fieldLabel: 'Probennehmer', | |
155 labelWidth: 100, | |
156 listeners: { | |
157 dirtychange: { | |
158 fn: this.updateOnChange, | |
159 scope: me | |
160 } | |
161 } | |
162 }, { | |
163 xtype: 'netzbetreiber', | |
164 name: 'netzbetreiberId', | |
165 editable: false, | |
166 fieldLabel: 'Netzbetreiber', | |
167 labelWidth: 100, | |
168 allowBlank: false, | |
169 listeners: { | |
170 dirtychange: { | |
171 fn: this.updateOnChange, | |
172 scope: me | |
173 } | |
174 } | |
175 }, { | |
176 xtype: 'tfield', | |
177 name: 'x11', | |
178 fieldLabel: 'Datensatzerzeuger', | |
179 labelWidth: 100, | |
180 listeners: { | |
181 dirtychange: { | |
182 fn: this.updateOnChange, | |
183 scope: me | |
184 } | |
185 } | |
186 }] | |
187 }] | |
188 }] | |
189 }, { | |
190 // Medium | |
191 xtype: 'fieldset', | |
192 title: 'Medium', | |
193 items: [{ | |
194 border: 0, | |
195 layout: { | |
196 type: 'vbox', | |
197 align: 'stretch' | |
198 }, | |
199 width: '100%', | |
200 items: [{ | |
201 xtype: 'textfield', | |
202 name: 'media', | |
203 labelWidth: 125, | |
204 fieldLabel: 'Medienbezeichnung', | |
205 listeners: { | |
206 dirtychange: { | |
207 fn: this.updateOnChange, | |
208 scope: me | |
209 } | |
210 } | |
211 }, { | |
212 xtype: 'textfield', | |
213 maxLength: 100, | |
214 name: 'mediaDesk', | |
215 labelWidth: 125, | |
216 fieldLabel: 'Deskriptoren', | |
217 listeners: { | |
218 dirtychange: { | |
219 fn: this.updateOnChange, | |
220 scope: me | |
221 } | |
222 } | |
223 }, { | |
224 xtype: 'umwelt', | |
225 name: 'umwId', | |
226 fieldLabel: 'Umweltbereich', | |
227 labelWidth: 125, | |
228 allowBlank: false, | |
229 listeners: { | |
230 dirtychange: { | |
231 fn: this.updateOnChange, | |
232 scope: me | |
233 } | |
234 } | |
235 }, { | |
236 xtype: 'fieldset', | |
237 title: 'Details Deskriptoren', | |
238 collapsible: true, | |
239 collapsed: true, | |
240 defaultType: 'textfield', | |
241 layout: { | |
242 type: 'table', | |
243 columns: 3 | |
244 }, | |
245 items: this.buildDescriptors(), | |
246 listeners: { | |
247 dirtychange: { | |
248 fn: this.updateOnChange, | |
249 scope: me | |
250 } | |
251 } | |
252 }] | |
253 }] | |
254 }, { | |
255 // Zeit | |
256 xtype: 'fieldset', | |
257 title: 'Zeit', | |
258 layout: { | |
259 type: 'hbox' | |
260 }, | |
261 items: [{ | |
262 layout: { | |
263 type: 'vbox', | |
264 align: 'stretch' | |
265 }, | |
266 border: 0, | |
267 items: [{ | |
268 xtype: 'datetime', | |
269 fieldLabel: 'Probennahme Beginn', | |
270 fieldMargin: '0, 10, 5, 0', | |
271 labelWidth: 125, | |
272 name: 'probeentnahmeBeginn', | |
273 listeners: { | |
274 dirtychange: { | |
275 fn: this.updateOnChange, | |
276 scope: me | |
277 } | |
278 } | |
279 }, { | |
280 xtype: 'datetime', | |
281 fieldLabel: 'Probennahme Ende', | |
282 fieldMargin: '0, 10, 5, 0', | |
283 labelWidth: 125, | |
284 name: 'probeentnahmeEnde', | |
285 listeners: { | |
286 dirtychange: { | |
287 fn: this.updateOnChange, | |
288 scope: me | |
289 } | |
290 } | |
291 }] | |
292 }, { | |
293 layout: 'vbox', | |
294 border: 0, | |
295 items: [{ | |
296 xtype: 'datetime', | |
297 fieldLabel: 'Sollzeit Von', | |
298 fieldMargin: '0, 10, 5, 0', | |
299 labelWidth: 90, | |
300 name: 'solldatumBeginn', | |
301 listeners: { | |
302 dirtychange: { | |
303 fn: this.updateOnChange, | |
304 scope: me | |
305 } | |
306 } | |
307 }, { | |
308 xtype: 'datetime', | |
309 fieldLabel: 'Sollzeit Bis', | |
310 fieldMargin: '0, 10, 5, 0', | |
311 labelWidth: 90, | |
312 name: 'solldatumEnde', | |
313 listeners: { | |
314 dirtychange: { | |
315 fn: this.updateOnChange, | |
316 scope: me | |
317 } | |
318 } | |
319 }] | |
320 }] | |
321 }] | |
322 }] | |
323 }]; | |
324 this.callParent(arguments); | |
325 }, | |
326 | |
327 setRecord: function(record) { | |
328 this.getForm().loadRecord(record); | |
329 }, | |
330 | |
331 setMessages: function(errors, warnings) { | |
332 var key; | |
333 var element; | |
334 var content; | |
335 var i18n = Lada.getApplication().bundle; | |
336 if (warnings) { | |
337 for (key in warnings) { | |
338 element = this.down('component[name=' + key + ']'); | |
339 if (!element) { | |
340 continue; | |
341 } | |
342 content = warnings[key]; | |
343 var warnText = ''; | |
344 for (var i = 0; i < content.length; i++) { | |
345 warnText += i18n.getMsg(content[i].toString()) + '\n'; | |
346 } | |
347 element.showWarnings(warnText); | |
348 } | |
349 } | |
350 if (errors) { | |
351 for (key in errors) { | |
352 element = this.down('component[name=' + key + ']'); | |
353 if (!element) { | |
354 continue; | |
355 } | |
356 content = errors[key]; | |
357 var errorText = ''; | |
358 for (var i = 0; i < content.length; i++) { | |
359 errorText += i18n.getMsg(content[i].toString()) + '\n'; | |
360 } | |
361 element.showErrors(errorText); | |
362 } | |
363 } | |
364 }, | |
365 | |
366 clearMessages: function() { | |
367 this.down('cbox[name=mstId]').clearWarningOrError(); | |
368 this.down('tfield[name=hauptprobenNr]').clearWarningOrError(); | |
369 this.down('cbox[name=datenbasisId]').clearWarningOrError(); | |
370 this.down('cbox[name=baId]').clearWarningOrError(); | |
371 this.down('cbox[name=test]').clearWarningOrError(); | |
372 this.down('cbox[name=probenartId]').clearWarningOrError(); | |
373 this.down('cbox[name=netzbetreiberId]').clearWarningOrError(); | |
374 this.down('tfield[name=x11]').clearWarningOrError(); | |
375 this.down('cbox[name=umwId]').clearWarningOrError(); | |
376 this.down('datetime[name=probeentnahmeBeginn]').clearWarningOrError(); | |
377 this.down('datetime[name=probeentnahmeEnde]').clearWarningOrError(); | |
378 this.down('datetime[name=solldatumBeginn]').clearWarningOrError(); | |
379 this.down('datetime[name=solldatumEnde]').clearWarningOrError(); | |
380 //this.down('cbox[name=probeNehmerId]').setReadOnly(value); | |
381 }, | |
382 | |
383 setReadOnly: function(value) { | |
384 this.down('cbox[name=mstId]').setReadOnly(value); | |
385 this.down('tfield[name=hauptprobenNr]').setReadOnly(value); | |
386 this.down('cbox[name=datenbasisId]').setReadOnly(value); | |
387 this.down('cbox[name=baId]').setReadOnly(value); | |
388 this.down('cbox[name=test]').setReadOnly(value); | |
389 this.down('cbox[name=probenartId]').setReadOnly(value); | |
390 this.down('cbox[name=netzbetreiberId]').setReadOnly(value); | |
391 this.down('tfield[name=x11]').setReadOnly(value); | |
392 this.down('textfield[name=media]').setReadOnly(value); | |
393 this.down('textfield[name=mediaDesk]').setReadOnly(value); | |
394 this.down('cbox[name=umwId]').setReadOnly(value); | |
395 this.down('datetime[name=probeentnahmeBeginn]').setReadOnly(value); | |
396 this.down('datetime[name=probeentnahmeEnde]').setReadOnly(value); | |
397 this.down('datetime[name=solldatumBeginn]').setReadOnly(value); | |
398 this.down('datetime[name=solldatumEnde]').setReadOnly(value); | |
399 //this.down('cbox[name=probeNehmerId]').setReadOnly(value); | |
400 }, | |
401 | |
402 buildDescriptors: function() { | |
403 var fields = []; | |
404 for (var i = 0; i < 12; i++) { | |
405 fields[i] = { | |
406 fieldLabel: 'S' + i, | |
407 name: 's' + i, | |
408 labelWidth: 25, | |
409 margin: '0, 10, 5, 0' | |
410 }; | |
411 } | |
412 return fields; | |
413 } | |
414 }); |