[Lada-commits] [PATCH] Fix setting status in bulk via SetStatus window
Wald Commits
scm-commit at wald.intevation.org
Fri Oct 28 18:46:06 CEST 2016
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1477673050 -7200
# Node ID 38599f18c8634e22ddb478b12f3a83f2b66049e4
# Parent eeed1b92341fb100d0ac2f000fb3fa68fe5ce7af
Fix setting status in bulk via SetStatus window.
diff -r eeed1b92341f -r 38599f18c863 app/view/widget/Status.js
--- 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',
diff -r eeed1b92341f -r 38599f18c863 app/view/window/SetStatus.js
--- 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({
More information about the Lada-commits
mailing list