annotate app/view/window/SetStatus.js @ 1249:979b4b9200a7

Removed reference to the not existing field 'name' in messprogramm.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 10 Nov 2016 14:44:29 +0100
parents 38599f18c863
children
rev   line source
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /**
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * This is a simple Window to set the Status for multiple Messungen on bulk.
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.window.SetStatus', {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.window.Window',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'setstatuswindow',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 requires: [
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'Lada.view.widget.Status'
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 ],
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 grid: null,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 selection: null,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 modal: true,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 closable: false,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 resultMessage: '',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 /**
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 * This function initialises the Window
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 */
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 initComponent: function() {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 var i18n = Lada.getApplication().bundle;
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 var me = this;
1230
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
33 var statusWerteStore = Ext.create('Lada.store.StatusWerte');
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
34 statusWerteStore.load({
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
35 params: {
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
36 messungsId: Ext.Array.pluck(this.selection, 'id').toString()
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
37 }
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
38 });
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
39
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 this.items = [{
1228
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
41 xtype: 'form',
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 name: 'valueselection',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 border: 0,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 items: [{
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 xtype: 'fieldset',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 title: 'Status für ' + this.selection.length + ' Messung(en) setzen',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 margin: '5, 5, 10, 5',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 items: [{
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 xtype: 'combobox',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 store: Ext.data.StoreManager.get('messstellenFiltered'),
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 displayField: 'messStelle',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 valueField: 'id',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 allowBlank: false,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 queryMode: 'local',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 editable: false,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 width: 300,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 labelWidth: 100,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 emptyText: 'Wählen Sie einen Erzeuger aus.',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 fieldLabel: i18n.getMsg('statusgrid.header.erzeuger')
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }, {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 xtype: 'statuswert',
1230
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
62 store: statusWerteStore,
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 allowBlank: false,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 width: 300,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 labelWidth: 100,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 fieldLabel: i18n.getMsg('statusgrid.header.statusWert')
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 }, {
1230
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
68 xtype: 'combobox',
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
69 name: 'statusstufe',
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
70 store: Ext.data.StoreManager.get('statusstufe'),
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
71 displayField: 'stufe',
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
72 valueField: 'id',
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
73 allowBlank: false,
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
74 editable: false,
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
75 forceSelection: true,
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
76 width: 300,
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
77 labelWidth: 100,
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
78 fieldLabel: i18n.getMsg('statusgrid.header.statusStufe')
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
79 }, {
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 xtype: 'textarea',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 width: 300,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 height: 100,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 labelWidth: 100,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 fieldLabel: i18n.getMsg('statusgrid.header.text'),
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 emptyText: 'Geben Sie einen Kommentar ein.'
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 }]
1228
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
87 }],
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
88 buttons: [{
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
89 text: i18n.getMsg('statusSetzen'),
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
90 name: 'start',
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
91 icon: 'resources/img/mail-mark-notjunk.png',
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
92 formBind: true,
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
93 disabled: true,
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
94 handler: this.setStatus
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
95 }, {
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
96 text: i18n.getMsg('cancel'),
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
97 name: 'abort',
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
98 handler: this.closeWindow
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 }]
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 }, {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 xtype: 'panel',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 hidden: true,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 margin: '5, 5, 5, 5',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 overflow: 'auto',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 name: 'result'
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 }, {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 xtype: 'progressbar',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 margin: '5, 5, 5, 5',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 hidden: true,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 text: 'Verarbeite Statusänderungen'
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 }];
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 this.buttons = [{
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 text: i18n.getMsg('close'),
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 name: 'close',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 hidden: true,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 handler: this.closeWindow
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 }];
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 this.callParent(arguments);
1228
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
120
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
121 // Initially validate to indicate mandatory fields clearly.
d5b9a5c75872 Enable validation for SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1114
diff changeset
122 this.down('form').isValid();
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 },
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 /**
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 * @private
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 * A handler for a Abort-Button
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 */
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 closeWindow: function(button) {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 var win = button.up('window');
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 win.close();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 },
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 /**
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
135 * @private
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 * A handler to setStatus on Bulk.
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
137 */
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138 setStatus: function(button) {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 var win = button.up('window');
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 win.down('panel').disable();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 win.down('button[name=start]').disable();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 win.down('button[name=abort]').disable();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 var progress = win.down('progressbar');
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 progress.show();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 win.send();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 },
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 send: function() {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 var i18n = Lada.getApplication().bundle;
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 var me = this;
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 var progress = me.down('progressbar');
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 var progressText = progress.getText();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 var count = 0;
1230
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
154
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
155 var wert = me.down('statuswert').getValue();
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
156 var stufe = me.down('[name=statusstufe]').getValue();
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
157 var kombis = Ext.data.StoreManager.get('statuskombi');
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
158 var kombiIdx = kombis.findBy(function(record) {
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
159 return record.get('statusStufe').id === stufe
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
160 && record.get('statusWert').id === wert;
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
161 });
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
162 if (kombiIdx < 0) {
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
163 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
164 'Unerlaubte Kombination aus Status und Stufe');
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
165 me.down('button[name=close]').show();
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
166 return;
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
167 }
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
168
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 for (var i = 0; i < this.selection.length; i++) {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 var data = Ext.create('Lada.model.Status', {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 messungsId: this.selection[i].get('id'),
1230
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
172 mstId: this.down('combobox').getValue(),
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 datum: new Date(),
1230
38599f18c863 Fix setting status in bulk via SetStatus window.
Tom Gottfried <tom@intevation.de>
parents: 1228
diff changeset
174 statusKombi: kombis.getAt(kombiIdx).get('id'),
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 text: this.down('textarea').getValue()
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 });
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 Ext.Ajax.request({
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 url: 'lada-server/rest/status',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 method: 'POST',
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 jsonData: data.raw,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 success: function(response) {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 var json = Ext.JSON.decode(response.responseText);
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 me.resultMessage += '<strong>' + i18n.getMsg('messung') + ': ';
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 var sel = me.selection[count];
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 me.resultMessage += sel.get('hauptprobenNr') + ' - ' + sel.get('nebenprobenNr') + '</strong><br><dd>';
1099
7a71723fda83 Added status protocol specific messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1082
diff changeset
186 me.resultMessage += i18n.getMsg('status-' + json.message) + '</dd><br>';
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 count++;
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 progress.updateProgress(count / me.selection.length, progressText + ' (' + count + ')');
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 if (count === me.selection.length) {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 var result = me.down('panel[name=result]');
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 var values = me.down('panel[name=valueselection]');
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 me.down('button[name=start]').hide();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 me.down('button[name=abort]').hide();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 me.down('button[name=close]').show();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 result.setSize(values.getWidth(), values.getHeight());
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 result.getEl().setHTML(me.resultMessage);
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 result.show();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 values.hide();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 }
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 },
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 failure: function(response) {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202 console.log(response);
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203 count++;
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 progress.updateProgress(count / me.selection.length);
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205 if (count === me.selection.length) {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 me.close();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 }
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 }
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 });
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
210 }
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
211 }
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212 });
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213

http://lada.wald.intevation.org