Mercurial > lada > lada-client
changeset 1230:38599f18c863
Fix setting status in bulk via SetStatus window.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 28 Oct 2016 18:44:10 +0200 |
parents | eeed1b92341f |
children | e8dd06450f2c |
files | app/view/widget/Status.js app/view/window/SetStatus.js |
diffstat | 2 files changed, 38 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/app/view/widget/Status.js Fri Oct 28 17:02:42 2016 +0200 +++ b/app/view/widget/Status.js Fri Oct 28 18:44:10 2016 +0200 @@ -6,36 +6,13 @@ * the documentation coming with IMIS-Labordaten-Application for details. */ -var statuswerteStore = Ext.create('Ext.data.Store', { - fields: ['id', 'wert'], - data: [{ - 'id': 1, - 'wert': 'plausibel' - }, { - 'id': 2, - 'wert': 'nicht repräsentativ' - }, { - 'id': 3, - 'wert': 'nicht plausibel' - }, { - 'id': 4, - 'wert': 'Rückfrage' - }, { - 'id': 7, - 'wert': 'nicht lieferbar' - }, { - 'id': 8, - 'wert': 'zurücksetzen' - }] -}); - /** * Combobox for Statuswert */ Ext.define('Lada.view.widget.Status', { extend: 'Lada.view.widget.base.ComboBox', alias: 'widget.statuswert', - store: statuswerteStore, + store: Ext.data.StoreManager.get('statuswerte'), displayField: 'wert', valueField: 'id', emptyText: 'Wählen Sie einen Status',
--- a/app/view/window/SetStatus.js Fri Oct 28 17:02:42 2016 +0200 +++ b/app/view/window/SetStatus.js Fri Oct 28 18:44:10 2016 +0200 @@ -30,6 +30,13 @@ initComponent: function() { var i18n = Lada.getApplication().bundle; var me = this; + var statusWerteStore = Ext.create('Lada.store.StatusWerte'); + statusWerteStore.load({ + params: { + messungsId: Ext.Array.pluck(this.selection, 'id').toString() + } + }); + this.items = [{ xtype: 'form', name: 'valueselection', @@ -52,11 +59,24 @@ fieldLabel: i18n.getMsg('statusgrid.header.erzeuger') }, { xtype: 'statuswert', + store: statusWerteStore, allowBlank: false, width: 300, labelWidth: 100, fieldLabel: i18n.getMsg('statusgrid.header.statusWert') }, { + xtype: 'combobox', + name: 'statusstufe', + store: Ext.data.StoreManager.get('statusstufe'), + displayField: 'stufe', + valueField: 'id', + allowBlank: false, + editable: false, + forceSelection: true, + width: 300, + labelWidth: 100, + fieldLabel: i18n.getMsg('statusgrid.header.statusStufe') + }, { xtype: 'textarea', width: 300, height: 100, @@ -131,12 +151,27 @@ var progress = me.down('progressbar'); var progressText = progress.getText(); var count = 0; + + var wert = me.down('statuswert').getValue(); + var stufe = me.down('[name=statusstufe]').getValue(); + var kombis = Ext.data.StoreManager.get('statuskombi'); + var kombiIdx = kombis.findBy(function(record) { + return record.get('statusStufe').id === stufe + && record.get('statusWert').id === wert; + }); + if (kombiIdx < 0) { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + 'Unerlaubte Kombination aus Status und Stufe'); + me.down('button[name=close]').show(); + return; + } + for (var i = 0; i < this.selection.length; i++) { var data = Ext.create('Lada.model.Status', { messungsId: this.selection[i].get('id'), - erzeuger: this.down('combobox').getValue(), + mstId: this.down('combobox').getValue(), datum: new Date(), - statusWert: this.down('statuswert').getValue(), + statusKombi: kombis.getAt(kombiIdx).get('id'), text: this.down('textarea').getValue() }); Ext.Ajax.request({