Mercurial > lada > lada-client
diff app/controller/form/Messprogramm.js @ 1210:a24de34d6423
Align subintervall with validity for yearly samples.
Subintervall is redundant to validity for yearly samples.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 11 Oct 2016 14:34:12 +0200 |
parents | 3b6f40541ac6 |
children | 4270da0f7d3b |
line wrap: on
line diff
--- a/app/controller/form/Messprogramm.js Mon Oct 10 16:42:30 2016 +0200 +++ b/app/controller/form/Messprogramm.js Tue Oct 11 14:34:12 2016 +0200 @@ -51,6 +51,9 @@ 'messprogrammform probenintervall combobox': { select: this.updateIntervalls }, + 'messprogrammform dayofyear [hidden]': { + change: this.alignSubIntervall + }, 'messprogrammform panel[xtype="deskriptor] combobox': { select: this.deskriptorSelect } @@ -90,15 +93,34 @@ /** * When the Probenintervall was changed, update the Sliders - * and the the numberfield. + * and the numberfield. */ - updateIntervalls: function(field, records) { + updateIntervalls: function(field) { var form = field.up('messprogrammform'); var record = form.getRecord(); form.populateIntervall(record, field.getValue()); }, /** + * When the validity period was changed, align the subintervall + * in case of yearly intervall. + */ + alignSubIntervall: function(field) { + var form = field.up('messprogrammform'); + var intervall = form.down('probenintervall').down('combobox') + .getValue(); + if (intervall == 'J') { + if (field.getName() == 'gueltigVon') { + form.down('[name=teilintervallVon]') + .setValue(field.getValue()); + } else { + form.down('[name=teilintervallBis]') + .setValue(field.getValue()); + } + } + }, + + /** * The function will open a new Window to edit the Ort of a Messprogramm */ editOrtWindow: function(button) { @@ -239,7 +261,7 @@ }, /** - * The discard function resets the Location form + * The discard function resets the form * to its original state. */ discard: function(button) {