Mercurial > lada > lada-client
comparison app/view/form/Probe.js @ 1066:d198946e5540
Introduced laborMstId as new probe field.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 11 Mar 2016 13:58:04 +0100 |
parents | 746b429917a8 |
children | 096d552508cd |
comparison
equal
deleted
inserted
replaced
1065:7fa853864d9b | 1066:d198946e5540 |
---|---|
13 extend: 'Ext.form.Panel', | 13 extend: 'Ext.form.Panel', |
14 alias: 'widget.probeform', | 14 alias: 'widget.probeform', |
15 requires: [ | 15 requires: [ |
16 'Lada.view.widget.Datenbasis', | 16 'Lada.view.widget.Datenbasis', |
17 'Lada.view.widget.base.CheckBox', | 17 'Lada.view.widget.base.CheckBox', |
18 'Lada.view.widget.Messstelle', | 18 'Lada.view.widget.MessstelleLabor', |
19 'Lada.view.widget.Netzbetreiber', | 19 'Lada.view.widget.Netzbetreiber', |
20 'Lada.view.widget.Betriebsart', | 20 'Lada.view.widget.Betriebsart', |
21 'Lada.view.widget.Probenart', | 21 'Lada.view.widget.Probenart', |
22 'Lada.view.widget.Umwelt', | 22 'Lada.view.widget.Umwelt', |
23 'Lada.view.widget.Deskriptor', | 23 'Lada.view.widget.Deskriptor', |
77 align: 'stretch' | 77 align: 'stretch' |
78 }, | 78 }, |
79 border: 0, | 79 border: 0, |
80 width: '100%', | 80 width: '100%', |
81 items: [{ | 81 items: [{ |
82 xtype: 'messstellelabor', | |
83 name: 'mstlabor', | |
84 fieldLabel: 'Messstelle/Labor', | |
85 margin: '0, 5, 5, 5', | |
86 width: '35%', | |
87 labelWidth: 95, | |
88 allowBlank: false, | |
89 editable: true, | |
90 listeners: { | |
91 select: { | |
92 fn: function(combo, newValue) { | |
93 var mst = newValue[0].get('messStelle'); | |
94 var labor = newValue[0].get('laborMst'); | |
95 combo.up('fieldset').down('messstelle[name=mstId]').setValue(mst); | |
96 combo.up('fieldset').down('messstelle[name=laborMstId]').setValue(labor); | |
97 } | |
98 } | |
99 } | |
100 }, { | |
82 xtype: 'messstelle', | 101 xtype: 'messstelle', |
83 name: 'mstId', | 102 name: 'mstId', |
84 fieldLabel: 'Messstelle', | 103 fieldLabel: 'Messstelle/Labor', |
85 margin: '0, 5, 5, 5', | 104 margin: '0, 5, 5, 5', |
86 width: '35%', | 105 width: '35%', |
87 labelWidth: 90, | 106 labelWidth: 95, |
88 allowBlank: false, | 107 allowBlank: false, |
89 editable: true | 108 editable: true, |
109 hidden: true | |
110 }, { | |
111 xtype: 'messstelle', | |
112 name: 'laborMstId', | |
113 fieldLabel: 'Messstelle/Labor', | |
114 margin: '0, 5, 5, 5', | |
115 width: '35%', | |
116 labelWidth: 95, | |
117 allowBlank: false, | |
118 editable: true, | |
119 hidden: true | |
90 }, { | 120 }, { |
91 xtype: 'netzbetreiber', | 121 xtype: 'netzbetreiber', |
92 name: 'netzbetreiberId', | 122 name: 'netzbetreiberId', |
93 editable: false, | 123 editable: false, |
94 readOnly: true, | 124 readOnly: true, |
125 xtype: 'tfield', | 155 xtype: 'tfield', |
126 name: 'hauptprobenNr', | 156 name: 'hauptprobenNr', |
127 fieldLabel: 'Hauptprobennr.', | 157 fieldLabel: 'Hauptprobennr.', |
128 margin: '0, 5, 5, 5', | 158 margin: '0, 5, 5, 5', |
129 width: '35%', | 159 width: '35%', |
130 labelWidth: 90, | 160 labelWidth: 95, |
131 maxLength: 20, | 161 maxLength: 20, |
132 allowBlank: true | 162 allowBlank: true |
133 }, { | 163 }, { |
134 xtype: 'betriebsart', | 164 xtype: 'betriebsart', |
135 name: 'baId', | 165 name: 'baId', |
161 fieldLabel: 'Probennehmer', | 191 fieldLabel: 'Probennehmer', |
162 margin: '0, 5, 5, 5', | 192 margin: '0, 5, 5, 5', |
163 width: '50%', | 193 width: '50%', |
164 minValue: 0, | 194 minValue: 0, |
165 anchor: '100%', | 195 anchor: '100%', |
166 labelWidth: 90 | 196 labelWidth: 95 |
167 }, { | 197 }, { |
168 xtype: 'tfield', | 198 xtype: 'tfield', |
169 name: 'x11', | 199 name: 'x11', |
170 fieldLabel: 'Datensatzerzeuger', | 200 fieldLabel: 'Datensatzerzeuger', |
171 margin: '0, 5, 5, 5', | 201 margin: '0, 5, 5, 5', |
314 }]; | 344 }]; |
315 this.callParent(arguments); | 345 this.callParent(arguments); |
316 this.clearMessages(); | 346 this.clearMessages(); |
317 }, | 347 }, |
318 | 348 |
319 setRecord: function(record) { | 349 setRecord: function(probeRecord) { |
320 this.clearMessages(); | 350 this.clearMessages(); |
321 this.getForm().loadRecord(record); | 351 this.getForm().loadRecord(probeRecord); |
352 if (!probeRecord.raw) { | |
353 return; | |
354 } | |
355 var mstStore = Ext.data.StoreManager.get('messstellen'); | |
356 if (!probeRecord.get('owner')) { | |
357 var mstId = mstStore.getById(probeRecord.get('mstId')); | |
358 var laborMstId = mstStore.getById(probeRecord.get('laborMstId')); | |
359 if (laborMstId) { | |
360 laborMstId = laborMstId.get('messStelle'); | |
361 } | |
362 else { | |
363 laborMstId = ''; | |
364 } | |
365 var id = this.down('messstellelabor').store.count() + 1; | |
366 var newStore = Ext.create('Ext.data.Store', { | |
367 model: 'Lada.model.MessstelleLabor', | |
368 data: [{ | |
369 id: id, | |
370 laborMst: probeRecord.get('laborMstId'), | |
371 messStelle: probeRecord.get('mstId'), | |
372 displayCombi: mstId.get('messStelle') + | |
373 '/' + laborMstId | |
374 }] | |
375 }); | |
376 this.down('messstellelabor').down('combobox').store = newStore; | |
377 this.down('messstellelabor').setValue(id); | |
378 } | |
379 else { | |
380 var mstLaborStore = Ext.data.StoreManager.get('messstellelabor'); | |
381 var items = mstLaborStore.queryBy(function(record) { | |
382 if (record.get('messStelle') === probeRecord.get('mstId') && | |
383 record.get('laborMst') === probeRecord.get('laborMstId')) { | |
384 return true; | |
385 } | |
386 }); | |
387 this.down('messstellelabor').setValue(items.getAt(0)); | |
388 } | |
322 }, | 389 }, |
323 | 390 |
324 setMediaDesk: function(record) { | 391 setMediaDesk: function(record) { |
325 var media = record.get('mediaDesk').split(' '); | 392 var media = record.get('mediaDesk').split(' '); |
326 this.setMediaSN(0, media); | 393 this.setMediaSN(0, media); |