Mercurial > lada > lada-client
changeset 1339:1a2cd9bef6d7
messprogramm zuordnung now functional
author | Maximilian Krambach <mkrambach@intevation.de> |
---|---|
date | Fri, 03 Feb 2017 19:37:28 +0100 |
parents | d2f06ce4d43a |
children | 15e4a3e42ad7 |
files | app.js app/controller/form/Ortserstellung.js app/controller/form/Ortszuordnung.js app/model/Ort.js app/model/OrtszuordnungMp.js app/store/OrtszuordnungMp.js app/view/form/Ortserstellung.js app/view/form/Ortszuordnung.js app/view/grid/Ortszuordnung.js app/view/widget/OrtszuordnungTyp.js app/view/window/Messprogramm.js app/view/window/Ortszuordnung.js |
diffstat | 12 files changed, 66 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/app.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app.js Fri Feb 03 19:37:28 2017 +0100 @@ -38,6 +38,7 @@ 'Ext.layout.container.Column', 'Lada.store.Deskriptoren', 'Lada.store.Ortszuordnung', + 'Lada.store.OrtszuordnungMp', 'Lada.store.Messungen', 'Lada.store.Zusatzwerte', 'Lada.store.Status',
--- a/app/controller/form/Ortserstellung.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app/controller/form/Ortserstellung.js Fri Feb 03 19:37:28 2017 +0100 @@ -41,10 +41,9 @@ }); }, - save: function() { - var this_panel = this.up('panel'); - var me = this; - var form = this_panel.getForm(); + save: function(button) { + var me = button.up('panel'); + var form = me.getForm(); var record = form.getRecord(); var data = form.getFieldValues(true); for (var key in data) { @@ -55,17 +54,18 @@ record.save({ success: function(newrecord, response) { form.loadRecord(newrecord); - this_panel.down('verwaltungseinheit').store.load( + me.down('verwaltungseinheit').store.load( { id:newrecord.get('gemId') }); - this_panel.down('staat').store.load( + me.down('staat').store.load( { id : newrecord.get('staat') }); - me.setDisabled(true); - me.hide(); - var ozw = this_panel.up().parentWindow; + button.setDisabled(true); + me.down('button[action=revert]').setDisabled(true); + button.hide(); + var ozw = me.up().parentWindow; var json = Ext.decode(response.response.responseText); if (json) { - this_panel.clearMessages(); - this_panel.setMessages(json.errors, json.warnings); + me.clearMessages(); + me.setMessages(json.errors, json.warnings); } ozw.ortstore.load({ callback: function(records, operation, success) { @@ -120,8 +120,8 @@ }, discard: function(button) { - this.up('panel').getForm().reset(); - this.up('toolbar').down('button [action=save]').setDisabled(true); + button.up('panel').reset(); + button.up('panel').down('button [action=save]').setDisabled(true); }, /**
--- a/app/controller/form/Ortszuordnung.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app/controller/form/Ortszuordnung.js Fri Feb 03 19:37:28 2017 +0100 @@ -51,16 +51,8 @@ var data = formPanel.getForm().getFieldValues(false); var i18n = Lada.getApplication().bundle; var recordData = formPanel.getForm().getRecord().data; - if (recordData['probeId'] !== undefined) { - // TODO: as model.ort.ortId and model.ortszuordnung.ortId coexist, - // but mean different things, data.ortId is an array here, of - // which we need the first entry - recordData.ortId = data.ortId[0]; - recordData.ortszuordnungTyp = data.ortszuordnungTyp; - } else { //messprogramm - recordData.ortsTyp = data.ortsTyp; - recordData.ort = data.ort; - } + recordData.ortId = data.ortId[0]; + recordData.ortszuordnungTyp = data.ortszuordnungTyp; recordData.ortszusatztext = data.ortszusatztext; if (!data.letzteAenderung) { recordData.letzteAenderung = new Date();
--- a/app/model/Ort.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app/model/Ort.js Fri Feb 03 19:37:28 2017 +0100 @@ -109,7 +109,7 @@ type: 'date', convert: function(v) { if (!v) { - return v; + return null; } return new Date(v); }
--- a/app/model/OrtszuordnungMp.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app/model/OrtszuordnungMp.js Fri Feb 03 19:37:28 2017 +0100 @@ -15,18 +15,15 @@ fields: [{ name: 'id' }, { - name: 'owner', - type: 'boolean' - }, { name: 'readonly', type: 'boolean', persist: false }, { - name: 'ort' + name: 'ortId' }, { name: 'messprogrammId' }, { - name: 'ortsTyp' + name: 'ortszuordnungTyp' }, { name: 'ortszusatztext' }, {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/OrtszuordnungMp.js Fri Feb 03 19:37:28 2017 +0100 @@ -0,0 +1,16 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/** + * Store for Ortszuordnungen for Messprogramme + */ +Ext.define('Lada.store.OrtszuordnungMp', { + extend: 'Ext.data.Store', + model: 'Lada.model.OrtszuordnungMp' +}); +
--- a/app/view/form/Ortserstellung.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app/view/form/Ortserstellung.js Fri Feb 03 19:37:28 2017 +0100 @@ -54,12 +54,7 @@ labelWidth: 125, fieldLabel: i18n.getMsg('staat'), name: 'staatId', - forceSelection: true, - listeners: { - change: { - fn: function() { me.checkCommitEnabled() } - } - } + forceSelection: true }, { xtype: 'verwaltungseinheit', labelWidth: 125,
--- a/app/view/form/Ortszuordnung.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app/view/form/Ortszuordnung.js Fri Feb 03 19:37:28 2017 +0100 @@ -38,13 +38,6 @@ initComponent: function() { var i18n = Lada.getApplication().bundle; var me = this; - if (this.type == 'probe') { - this.ortIdName = 'ortId'; - this.typName = 'ortszuordnungTyp'; - } else if (this.type == 'mpr') { - this.ortIdName = 'ort'; - this.typName = 'ortsTyp'; - } this.items = [{ xtype: 'fieldset', title: i18n.getMsg('ortszuordnung.form.fset.title'), @@ -104,7 +97,7 @@ labelWidth: 125, allowBlank: false, editable: true, - name: this.typName, + name: 'ortszuordnungTyp', disableKeyFilter: true, fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp'), }, { @@ -115,7 +108,7 @@ regex: /^[0-9]{1,45}$/, submitValue: true, hidden: true, - name: this.ortIdName, + name: 'ortId', listeners: { change: me.changed } @@ -216,7 +209,7 @@ setReadOnly: function(value) { this.down('tfield[name=ortszusatztext]').setReadOnly(value); - var fieldId = 'textfield[name=' + this.typName +']'; + var fieldId = 'textfield[name=ortszuordnungTyp]'; this.down(fieldId).setReadOnly(value); },
--- a/app/view/grid/Ortszuordnung.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app/view/grid/Ortszuordnung.js Fri Feb 03 19:37:28 2017 +0100 @@ -168,29 +168,35 @@ }, initData: function() { + var modelname; if (this.isMessprogramm) { - //TODO + this.store = Ext.create('Lada.store.OrtszuordnungMp'); + this.store.load({ + params: { + messprogrammId: this.recordId + }}); + modelname = 'Lada.model.Messprogramm'; } else { + modelname = 'Lada.model.Probe'; this.store = Ext.create('Lada.store.Ortszuordnung'); this.store.load({ params: { probeId: this.recordId + }}); + } + Ext.ClassManager.get(modelname).load(this.recordId, { + failure: function(record, action) { + // TODO + }, + success: function(record, response) { + var json = Ext.decode(response.response.responseText); + if (json) { + this.warnings = json.warnings; + this.errors = json.errors; } - }); - Ext.ClassManager.get('Lada.model.Probe').load(this.recordId, { - failure: function(record, action) { - // TODO - }, - success: function(record, response) { - var json = Ext.decode(response.response.responseText); - if (json) { - this.warnings = json.warnings; - this.errors = json.errors; - } - }, - scope: this - }); - } + }, + scope: this + }); }, setReadOnly: function(b) {
--- a/app/view/widget/OrtszuordnungTyp.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app/view/widget/OrtszuordnungTyp.js Fri Feb 03 19:37:28 2017 +0100 @@ -23,6 +23,7 @@ triggerAction: 'all', typeAhead: false, minChars: 0, + allowBlank: this.allowBlank, initComponent: function() { var i18n = Lada.getApplication().bundle;
--- a/app/view/window/Messprogramm.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app/view/window/Messprogramm.js Fri Feb 03 19:37:28 2017 +0100 @@ -101,7 +101,8 @@ margin: 5, items: [{ xtype: 'ortszuordnunggrid', - recordId: me.record ? me.record.get('id') : null + recordId: me.record ? me.record.get('id') : null, + isMessprogramm: true }] }, { //Messmethoden
--- a/app/view/window/Ortszuordnung.js Fri Feb 03 18:01:25 2017 +0100 +++ b/app/view/window/Ortszuordnung.js Fri Feb 03 19:37:28 2017 +0100 @@ -130,7 +130,8 @@ hidden: true, height: 240, items: [{ - xtype: 'ortstammdatengrid' + xtype: 'ortstammdatengrid', + isMessprogramm: this.messprogramm? true: false }], dockedItems: [{ xtype: 'toolbar',