comparison app/view/form/Messprogramm.js @ 1067:3da8e8b973ad

Use the laborMstId to generate probe objects.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 14 Mar 2016 10:16:22 +0100
parents a1d72228af00
children 096d552508cd
comparison
equal deleted inserted replaced
1066:d198946e5540 1067:3da8e8b973ad
84 type: 'vbox', 84 type: 'vbox',
85 align: 'stretch' 85 align: 'stretch'
86 }, 86 },
87 margin: '0, 10, 0, 0', 87 margin: '0, 10, 0, 0',
88 items: [{ 88 items: [{
89 xtype: 'messstellelabor',
90 name: 'mstlabor',
91 fieldLabel: 'Messstelle/Labor',
92 margin: '0, 5, 5, 5',
93 width: '35%',
94 labelWidth: 95,
95 allowBlank: false,
96 editable: true,
97 listeners: {
98 select: {
99 fn: function(combo, newValue) {
100 var mst = newValue[0].get('messStelle');
101 var labor = newValue[0].get('laborMst');
102 combo.up('fieldset').down('messstelle[name=mstId]').setValue(mst);
103 combo.up('fieldset').down('messstelle[name=laborMstId]').setValue(labor);
104 }
105 }
106 }
107 }, {
89 xtype: 'messstelle', 108 xtype: 'messstelle',
90 name: 'mstId', 109 name: 'mstId',
91 fieldLabel: i18n.getMsg('mstId'), 110 fieldLabel: 'Messstelle/Labor',
92 labelWidth: 135, 111 margin: '0, 5, 5, 5',
112 width: '35%',
113 labelWidth: 95,
93 allowBlank: false, 114 allowBlank: false,
94 editable: true 115 editable: true,
116 hidden: true
117 }, {
118 xtype: 'messstelle',
119 name: 'laborMstId',
120 fieldLabel: 'Messstelle/Labor',
121 margin: '0, 5, 5, 5',
122 width: '35%',
123 labelWidth: 95,
124 allowBlank: false,
125 editable: true,
126 hidden: true
95 }, { 127 }, {
96 xtype: 'tfield', 128 xtype: 'tfield',
97 name: 'name', 129 name: 'name',
98 fieldLabel: i18n.getMsg('name'), 130 fieldLabel: i18n.getMsg('name'),
99 labelWidth: 135, 131 labelWidth: 135,
399 //Set IntervallOffset 431 //Set IntervallOffset
400 i.setMinValue(0); 432 i.setMinValue(0);
401 i.setMaxValue(max-1); 433 i.setMaxValue(max-1);
402 }, 434 },
403 435
404 setRecord: function(record) { 436 setRecord: function(messRecord) {
405 this.clearMessages(); 437 this.clearMessages();
406 438
407 this.getForm().loadRecord(record); 439 this.getForm().loadRecord(messRecord);
408 //Set the intervall numberfields and the slider. 440 //Set the intervall numberfields and the slider.
409 this.down('probenintervallslider').setValue([ 441 this.down('probenintervallslider').setValue([
410 record.get('teilintervallVon'), 442 messRecord.get('teilintervallVon'),
411 record.get('teilintervallBis') 443 messRecord.get('teilintervallBis')
412 ]); 444 ]);
413 445
414 //TODO Set Sliders MinMaxValue 446 //TODO Set Sliders MinMaxValue
415 this.populateIntervall(record); 447 this.populateIntervall(messRecord);
416 448
417 this.down('probenintervallslider').on( 449 this.down('probenintervallslider').on(
418 'change', 450 'change',
419 Lada.app.getController('Lada.controller.form.Messprogramm') 451 Lada.app.getController('Lada.controller.form.Messprogramm')
420 .synchronizeFields 452 .synchronizeFields
421 ); 453 );
454 var mstStore = Ext.data.StoreManager.get('messstellen');
455 if (!messRecord.get('owner')) {
456 var mstId = mstStore.getById(messRecord.get('mstId'));
457 var laborMstId = mstStore.getById(messRecord.get('laborMstId'));
458 if (laborMstId) {
459 laborMstId = laborMstId.get('messStelle');
460 }
461 else {
462 laborMstId = '';
463 }
464 var id = this.down('messstellelabor').store.count() + 1;
465 var newStore = Ext.create('Ext.data.Store', {
466 model: 'Lada.model.MessstelleLabor',
467 data: [{
468 id: id,
469 laborMst: messRecord.get('laborMstId'),
470 messStelle: messRecord.get('mstId'),
471 displayCombi: mstId.get('messStelle') +
472 '/' + laborMstId
473 }]
474 });
475 this.down('messstellelabor').down('combobox').store = newStore;
476 this.down('messstellelabor').setValue(id);
477 }
478 else {
479 var mstLaborStore = Ext.data.StoreManager.get('messstellelabor');
480 var items = mstLaborStore.queryBy(function(record) {
481 if (record.get('messStelle') === messRecord.get('mstId') &&
482 record.get('laborMst') === messRecord.get('laborMstId')) {
483 return true;
484 }
485 });
486 this.down('messstellelabor').setValue(items.getAt(0));
487 }
422 }, 488 },
423 489
424 setMediaDesk: function(record) { 490 setMediaDesk: function(record) {
425 var media = record.get('mediaDesk').split(' '); 491 var media = record.get('mediaDesk').split(' ');
426 this.setMediaSN(0, media); 492 this.setMediaSN(0, media);

http://lada.wald.intevation.org