Mercurial > lada > lada-client
changeset 1217:4270da0f7d3b
Merged branch schema-update into default.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 14 Oct 2016 18:34:19 +0200 |
parents | 75e5caebd392 |
children | 746915a63a11 |
files | app.js app/controller/form/Messprogramm.js app/controller/grid/Status.js app/model/MKommentar.js app/model/Messprogramm.js app/model/MessprogrammKategorie.js app/model/Messung.js app/model/PKommentar.js app/model/Probe.js app/model/Probenzusatz.js app/model/Status.js app/model/StatusKombi.js app/model/Zusatzwert.js app/store/StatusKombi.js app/view/form/Messung.js app/view/form/Probe.js app/view/grid/MKommentar.js app/view/grid/MessprogrammKategorie.js app/view/grid/Messung.js app/view/grid/PKommentar.js app/view/grid/Probenzusatzwert.js app/view/grid/Status.js app/view/widget/DynamicGrid.js app/view/widget/Netzbetreiber.js |
diffstat | 24 files changed, 181 insertions(+), 81 deletions(-) [+] |
line wrap: on
line diff
--- a/app.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app.js Fri Oct 14 18:34:19 2016 +0200 @@ -55,6 +55,7 @@ 'Lada.store.Verwaltungseinheiten', 'Lada.store.StatusWerte', 'Lada.store.StatusStufe', + 'Lada.store.StatusKombi', 'Lada.store.Probenehmer', 'Lada.store.DatensatzErzeuger', 'Lada.store.MessprogrammKategorie', @@ -228,6 +229,10 @@ storeId: 'statusstufe', autoLoad: 'true' }); + Ext.create('Lada.store.StatusKombi', { + storeId: 'statuskombi', + autoLoad: 'true' + }); Ext.create('Lada.store.ProbeQueries', { storeId: 'probequeries', autoLoad: 'true'
--- a/app/controller/form/Messprogramm.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/controller/form/Messprogramm.js Fri Oct 14 18:34:19 2016 +0200 @@ -201,9 +201,12 @@ save: function(button) { var formPanel = button.up('form'); var data = formPanel.getForm().getFieldValues(true); + var orte = Ext.data.StoreManager.get('orte'); + var gemId = orte.getById(data['ortId']).get('gemId'); for (var key in data) { formPanel.getForm().getRecord().set(key, data[key]); } + formPanel.getForm().getRecord().set('gemId', gemId); if (!formPanel.getForm().getRecord().get('letzteAenderung')) { formPanel.getForm().getRecord().data.letzteAenderung = new Date(); }
--- a/app/controller/grid/Status.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/controller/grid/Status.js Fri Oct 14 18:34:19 2016 +0200 @@ -39,7 +39,18 @@ * On failure it displays a message */ gridSave: function(editor, context) { - context.record.set('sdatum', new Date()); + context.record.set('datum', new Date()); + var wert = editor.getEditor().down('combobox[displayField=wert]').value; + var stufe = editor.getEditor().down('combobox[displayField=stufe]').value; + var kombis = Ext.data.StoreManager.get('statuskombi'); + var kombiNdx = kombis.findBy(function(record, id) { + if (record.raw.statusStufe.id === stufe && + record.raw.statusWert.id === wert + ) { + return true; + } + }); + context.record.set('statusKombi', kombis.getAt(kombiNdx).get('id')); context.record.save({ success: function(response) { var i18n = Lada.getApplication().bundle; @@ -172,18 +183,27 @@ var resetStatusValue = 8; - var s = button.up('window').down('messungform').getRecord().get('status'); + var s = button.up('window').down('messungform').getCurrentStatus(); var messId = button.up('window').down('messungform').getRecord().get('id'); - var recentStatus = button.up('statusgrid').store.getById(s); + if(!s) { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.generic.body')); + return; + } //Set Status to 'Resetted' (8) - if (recentStatus) { - var record = recentStatus.copy(); - record.set('datum', new Date()); - record.set('statusWert', resetStatusValue); - record.set('id', null); - record.set('text', i18n.getMsg('statusgrid.resetText')); - } + var kombis = Ext.data.StoreManager.get('statuskombi'); + var stufe = kombis.getById(s.get('statusKombi')).raw.statusStufe.id; + var kombiNdx = kombis.findBy(function(record, id) { + if(record.raw.statusStufe.id === stufe && record.raw.statusWert.id === 8) { + return true; + } + }); + var record = s.copy(); + record.set('datum', new Date()); + record.set('statusKombi', kombis.getAt(kombiNdx).get('id')); + record.set('id', null); + record.set('text', i18n.getMsg('statusgrid.resetText')); Ext.Ajax.request({ url: 'lada-server/rest/status',
--- a/app/model/MKommentar.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/model/MKommentar.js Fri Oct 14 18:34:19 2016 +0200 @@ -24,7 +24,7 @@ }, { name: 'messungsId' }, { - name: 'erzeuger' + name: 'mstId' }, { name: 'datum', type: 'date',
--- a/app/model/Messprogramm.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/model/Messprogramm.js Fri Oct 14 18:34:19 2016 +0200 @@ -25,14 +25,13 @@ return null; } return value; - } + }, + persist: false }, { name: 'mstId' }, { name: 'laborMstId' }, { - name: 'name' - }, { name: 'datenbasisId' }, { name: 'baId'
--- a/app/model/MessprogrammKategorie.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/model/MessprogrammKategorie.js Fri Oct 14 18:34:19 2016 +0200 @@ -17,7 +17,7 @@ }, { name: 'netzbetreiberId' }, { - name: 'mplId' + name: 'code' }, { name: 'bezeichnung' }, {
--- a/app/model/Messung.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/model/Messung.js Fri Oct 14 18:34:19 2016 +0200 @@ -59,7 +59,7 @@ name: 'geplant', type: 'boolean' }, { - name: 'messungsIdAlt' + name: 'idAlt' }, { name: 'treeModified', serialize: function(value) {
--- a/app/model/PKommentar.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/model/PKommentar.js Fri Oct 14 18:34:19 2016 +0200 @@ -24,7 +24,7 @@ }, { name: 'probeId' }, { - name: 'erzeuger' + name: 'mstId' }, { name: 'datum', type: 'date',
--- a/app/model/Probe.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/model/Probe.js Fri Oct 14 18:34:19 2016 +0200 @@ -20,28 +20,21 @@ type: 'boolean', persist: false }, { - name: 'probeIdAlt' + name: 'idAlt' }, { name: 'hauptprobenNr' }, { name: 'test', type: 'boolean' }, { - name: 'netzbetreiberId', - serialize: function(value) { - if (value === '') { - return null; - } - return value; - } - }, { name: 'mstId' }, { name: 'laborMstId' }, { name: 'datenbasisId' }, { - name: 'baId' + name: 'baId', + type: 'number' }, { name: 'probenartId' }, { @@ -90,8 +83,6 @@ }, { name: 'probeNehmerId' }, { - name: 'mpKat' - }, { name: 'mplId' }, { name: 'mprId'
--- a/app/model/Probenzusatz.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/model/Probenzusatz.js Fri Oct 14 18:34:19 2016 +0200 @@ -32,8 +32,7 @@ }, { name: 'beschreibung' }, { - name: 'mehId', - type: 'int' + name: 'messEinheitId', }, { name: 'zusatzwert' }, {
--- a/app/model/Status.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/model/Status.js Fri Oct 14 18:34:19 2016 +0200 @@ -24,12 +24,16 @@ }, { name: 'messungsId' }, { - name: 'erzeuger' + name: 'mstId' + }, { + name: 'statusKombi', + type: 'int' + }, { + name: 'statusWert', + persist: false }, { name: 'statusStufe', - type: 'int' - }, { - name: 'statusWert' + persist: false }, { name: 'treeModified', serialize: function(value) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/StatusKombi.js Fri Oct 14 18:34:19 2016 +0200 @@ -0,0 +1,36 @@ +/* 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. + */ + +/** + * Model class for StatusKombi + */ +Ext.define('Lada.model.StatusKombi', { + extend: 'Ext.data.Model', + + fields: [{ + name: 'id' + }, { + name: 'stufeId', + type: 'int' + }, { + name: 'stufeId', + type: 'int' + }], + + idProperty: 'id', + + proxy: { + type: 'rest', + url: 'lada-server/rest/statuskombi', + reader: { + type: 'json', + root: 'data' + } + } +}); +
--- a/app/model/Zusatzwert.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/model/Zusatzwert.js Fri Oct 14 18:34:19 2016 +0200 @@ -16,7 +16,8 @@ name: 'id' }, { name: 'owner', - type: 'boolean' + type: 'boolean', + persist: false }, { name: 'readonly', type: 'boolean',
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/StatusKombi.js Fri Oct 14 18:34:19 2016 +0200 @@ -0,0 +1,17 @@ +/* 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 Status-Kombi + */ +Ext.define('Lada.store.StatusKombi', { + extend: 'Ext.data.Store', + model: 'Lada.model.StatusKombi', + autoLoad: false +}); +
--- a/app/view/form/Messung.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/view/form/Messung.js Fri Oct 14 18:34:19 2016 +0200 @@ -30,6 +30,8 @@ trackResetOnLoad: true, + currentStatus: null, + initComponent: function() { var me = this; var i18n = Lada.getApplication().bundle; @@ -79,6 +81,7 @@ name: 'mmtId', margin: '0, 10, 5, 0', fieldLabel: 'Messmethode', + allowBlank: false, width: 300, labelWidth: 100 }, { @@ -126,7 +129,6 @@ width: 300, labelWidth: 100, submitValue: false, - isFormField: false, preventMark: true, //Do not display error msg. validateValue: function() { return true; //this field is always valid @@ -168,6 +170,10 @@ } }, + getCurrentStatus: function() { + return this.currentStatus; + }, + retrieveStatus: function(messungsId, statusId) { var i18n = Lada.getApplication().bundle; var msg = i18n.getMsg('load.statuswert'); @@ -178,6 +184,7 @@ textfield.setRawValue(msg); } + var me = this; var sStore = Ext.create('Lada.store.Status'); sStore.load({ params: { @@ -190,9 +197,13 @@ sw = 0; } else { - sw = sStore.getById(statusId).get('statusWert'); - ss = sStore.getById(statusId).get('statusStufe'); - se = sStore.getById(statusId).get('erzeuger'); + me.currentStatus = sStore.getById(statusId); + sk = sStore.getById(statusId).get('statusKombi'); + se = sStore.getById(statusId).get('mstId'); + var kombis = Ext.data.StoreManager.get('statuskombi'); + var rec = kombis.getById(sk); + sw = rec.raw.statusWert.id; + ss = rec.raw.statusStufe.id; } this.setStatusWert(sw); this.setStatusStufe(ss); @@ -226,7 +237,6 @@ if (!swStore) { //Set the textfield asynchronously swStore = Ext.create('Lada.store.StatusWerte'); - console.log('loading sw store messungform'); swStore.load({ scope: this, callback: function(records, operation, success) {
--- a/app/view/form/Probe.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/view/form/Probe.js Fri Oct 14 18:34:19 2016 +0200 @@ -131,9 +131,10 @@ hidden: true }, { xtype: 'netzbetreiber', - name: 'netzbetreiberId', editable: false, readOnly: true, + isFormField: false, + submitValue: false, fieldLabel: 'Netzbetreiber', margin: '0, 5, 5, 5', width: '35%', @@ -372,8 +373,8 @@ return; } var mstStore = Ext.data.StoreManager.get('messstellen'); + var mstId = mstStore.getById(probeRecord.get('mstId')); if (!probeRecord.get('owner')) { - var mstId = mstStore.getById(probeRecord.get('mstId')); var laborMstId = mstStore.getById(probeRecord.get('laborMstId')); if (laborMstId) { laborMstId = laborMstId.get('messStelle'); @@ -405,6 +406,7 @@ }); this.down('messstellelabor').setValue(items.getAt(0)); } + this.down('netzbetreiber').setValue(mstId.get('netzbetreiberId')); }, setMediaDesk: function(record) { @@ -485,7 +487,7 @@ this.down('cbox[name=baId]').clearWarningOrError(); this.down('chkbox[name=test]').clearWarningOrError(); this.down('cbox[name=probenartId]').clearWarningOrError(); - this.down('cbox[name=netzbetreiberId]').clearWarningOrError(); + this.down('netzbetreiber').clearWarningOrError(); this.down('cbox[name=erzeugerId]').clearWarningOrError(); this.down('cbox[name=umwId]').clearWarningOrError(); this.down('datetime[name=probeentnahmeBeginn]').clearWarningOrError();
--- a/app/view/grid/MKommentar.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/view/grid/MKommentar.js Fri Oct 14 18:34:19 2016 +0200 @@ -66,7 +66,7 @@ width: 110 }, { header: 'Erzeuger', - dataIndex: 'erzeuger', + dataIndex: 'mstId', renderer: function(value) { var r = ''; if (!value || value === '') {
--- a/app/view/grid/MessprogrammKategorie.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/view/grid/MessprogrammKategorie.js Fri Oct 14 18:34:19 2016 +0200 @@ -103,7 +103,7 @@ } }, { header: i18n.getMsg('mplId'), - dataIndex: 'mplId', + dataIndex: 'code', editor: { xtype: 'textfield', maxLength: 3,
--- a/app/view/grid/Messung.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/view/grid/Messung.js Fri Oct 14 18:34:19 2016 +0200 @@ -75,36 +75,40 @@ }, { header: 'Status', flex: 1, - dataIndex: 'statusWert', + dataIndex: 'statusKombi', renderer: function(value, meta, record, rNdx, cNdx) { var statusId = record.get('status'); var mId = record.get('id'); //also fwd the record to the asynchronous loading of statuswerte // in order to add the statuswert to the record, // after the grid was rendered... - if (value === '') { + if (!value || value === '') { this.updateStatus(mId, statusId, record); return 'Lade...'; } - var sta = Ext.data.StoreManager.getByKey('statuswerte'); - return sta.getById(value).get('wert'); + var kombis = Ext.data.StoreManager.get('statuskombi'); + var kombi = kombis.getById(value); + var st = kombi.raw.statusWert.wert + return st; } }, { header: 'Stufe', flex: 1, - dataIndex: 'statusStufe', + dataIndex: 'statusKombi', renderer: function(value, meta, record, rNdx, cNdx) { var statusId = record.get('status'); var mId = record.get('id'); //also fwd the record to the asynchronous loading of statuswerte // in order to add the statuswert to the record, // after the grid was rendered... - if (value === '') { + if (!value || value === '') { this.updateStatus(mId, statusId, record); return 'Lade...'; } - var sta = Ext.data.StoreManager.getByKey('statusstufe'); - return sta.getById(value).get('stufe'); + var kombis = Ext.data.StoreManager.get('statuskombi'); + var kombi = kombis.getById(value); + var st = kombi.raw.statusStufe.stufe + return st; } }, { header: 'OK-Flag', @@ -252,14 +256,12 @@ else { var rec = sstore.getById(opts.statusId); if (rec) { - value = rec.get('statusWert'); - var stufe = rec.get('statusStufe'); + value = rec.get('statusKombi'); //add the determined statuswert to the record. // this is necessary to let the controller determine // which actions are allowed. opts.record.beginEdit(); - opts.record.set('statusWert', value); - opts.record.set('statusStufe', stufe); + opts.record.set('statusKombi', value); opts.record.endEdit(); } }
--- a/app/view/grid/PKommentar.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/view/grid/PKommentar.js Fri Oct 14 18:34:19 2016 +0200 @@ -72,7 +72,7 @@ width: 110 }, { header: 'Erzeuger', - dataIndex: 'erzeuger', + dataIndex: 'mstId', width: 140, renderer: function(value) { var r = '';
--- a/app/view/grid/Probenzusatzwert.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/view/grid/Probenzusatzwert.js Fri Oct 14 18:34:19 2016 +0200 @@ -122,7 +122,6 @@ }, { header: 'Nachweisgrenze', dataIndex: 'nwgZuMesswert', - xtype: 'numbercolumn', flex: 1, editor: { xtype: 'expnumberfield', @@ -150,8 +149,11 @@ } var zstore = Ext.data.StoreManager.get('probenzusaetze'); var mstore = Ext.data.StoreManager.get('messeinheiten'); - var mehId = zstore.getById(value).get('mehId'); + var mehId = zstore.getById(value).get('messEinheitId'); var record = mstore.findRecord('id', mehId, 0, false, false, true); + if (!record) { + return ''; + } return record.get('einheit'); } }, {
--- a/app/view/grid/Status.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/view/grid/Status.js Fri Oct 14 18:34:19 2016 +0200 @@ -23,6 +23,7 @@ readOnly: true, allowDeselect: true, statusWerteStore: null, + statusStufeStore: null, initComponent: function() { var i18n = Lada.getApplication().bundle; @@ -34,8 +35,8 @@ messungsId: this.recordId } }); - var statusStufeStore = Ext.create('Lada.store.StatusStufe'); - statusStufeStore.load(); + this.statusStufeStore = Ext.create('Lada.store.StatusStufe'); + this.statusStufeStore.load(); this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToMoveEditor: 1, @@ -85,7 +86,7 @@ sortable: false }, { header: i18n.getMsg('statusgrid.header.erzeuger'), - dataIndex: 'erzeuger', + dataIndex: 'mstId', renderer: function(value) { var r = ''; if (!value || value === '') { @@ -110,33 +111,37 @@ sortable: false }, { header: i18n.getMsg('statusgrid.header.statusStufe'), - dataIndex: 'statusStufe', + dataIndex: 'statusKombi', renderer: function(value) { - var sta = Ext.data.StoreManager.get('statusstufe'); - var r; - if (value===null || value === '') { - r = i18n.getMsg('error'); - } - var item = sta.getById(value); + var kombi = Ext.data.StoreManager.get('statuskombi'); + var r = ''; + var item = kombi.getById(value); if (item) { - r = item.get('stufe'); + r = item.raw.statusStufe.stufe; } return r; }, + editor: { + xtype: 'combobox', + store: this.statusStufeStore, + queryMode: 'local', + displayField: 'stufe', + valueField: 'id', + allowBlank: false, + editable: false, + forceSelection: true + }, sortable: false }, { header: i18n.getMsg('statusgrid.header.statusWert'), - dataIndex: 'statusWert', + dataIndex: 'statusKombi', renderer: function(value) { - var sta = Ext.data.StoreManager.get('statuswerte'); + var kombi = Ext.data.StoreManager.get('statuskombi'); //This store is NOT used in the editor... - var r; - if (value===null || value === '') { - r = i18n.getMsg('error'); - } - var item = sta.getById(value); + var r = ''; + var item = kombi.getById(value); if (item) { - r = item.get('wert'); + r = item.raw.statusWert.wert; } return r; },
--- a/app/view/widget/DynamicGrid.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/view/widget/DynamicGrid.js Fri Oct 14 18:34:19 2016 +0200 @@ -98,7 +98,7 @@ if (rec.get('readonly') === false && rec.get('owner') === true && !rec.get('statusEdit')) { - return 'edit'; + return 'edit'; } else if (rec.get('readonly') === false && rec.get('owner') === true &&
--- a/app/view/widget/Netzbetreiber.js Fri Oct 14 16:06:21 2016 +0200 +++ b/app/view/widget/Netzbetreiber.js Fri Oct 14 18:34:19 2016 +0200 @@ -17,6 +17,8 @@ valueField: 'id', editable: this.editable || false, readOnly: this.readOnly, + isFormField: this.isFormField, + submitValue: this.submitValue, // Enable filtering of comboboxes queryMode: 'local', triggerAction: 'all', @@ -35,6 +37,8 @@ this.store.clearFilter(); } this.callParent(arguments); + this.down('combobox').isFormField = false; + this.down('combobox').submitValue = false; }, getValue: function() {