Mercurial > lada > lada-client
comparison app/view/grid/Messungen.js @ 561:ea2c35cd9c19
Ein grid für Messungen hinzugefügt und im Window ProbeEdit eingesetzt. Ohne Funktion sind die Felder: Status, OK-Flag, Anzahl Nuklide/Kommentare
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Mon, 09 Mar 2015 11:55:51 +0100 |
parents | |
children | 83c0f476d825 |
comparison
equal
deleted
inserted
replaced
560:98dee8166459 | 561:ea2c35cd9c19 |
---|---|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 | |
9 /* | |
10 * Grid to list Messungen | |
11 */ | |
12 Ext.define('Lada.view.grid.Messungen', { | |
13 extend: 'Ext.grid.Panel', | |
14 alias: 'widget.messungengrid', | |
15 | |
16 maxHeight: 350, | |
17 emptyText: 'Keine Messungen gefunden', | |
18 minHeight: 110, | |
19 viewConfig: { | |
20 deferEmptyText: false | |
21 }, | |
22 margin: '0, 5, 5, 5', | |
23 | |
24 recordId: null, | |
25 | |
26 warnings: null, | |
27 errors: null, | |
28 | |
29 initComponent: function() { | |
30 var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { | |
31 clicksToMoveEditor: 1, | |
32 autoCancel: false, | |
33 itemId: 'rowedit' | |
34 }); | |
35 this.plugins = [rowEditing]; | |
36 this.dockedItems = [{ | |
37 xtype: 'toolbar', | |
38 dock: 'bottom', | |
39 items: ['->', { | |
40 text: 'Details', | |
41 icon: 'resources/img/document-open.png', | |
42 action: 'open', | |
43 disabled: true | |
44 }, { | |
45 text: 'Hinzufügen', | |
46 icon: 'resources/img/list-add.png', | |
47 action: 'add', | |
48 probeId: this.recordId | |
49 }, { | |
50 text: 'Löschen', | |
51 icon: 'resources/img/list-remove.png', | |
52 action: 'delete' | |
53 }] | |
54 }]; | |
55 this.columns = [{ | |
56 header: 'Mess-ID', | |
57 dataIndex: 'id', | |
58 flex: 1, | |
59 editor: { | |
60 allowBlank: false | |
61 } | |
62 }, { | |
63 /* | |
64 header: 'Probe-ID', | |
65 dataIndex: 'probeId', | |
66 flex: 1, | |
67 editor: { | |
68 allowBlank: false | |
69 } | |
70 }, { | |
71 */ | |
72 header: 'Nebenproben-Nr.', | |
73 dataIndex: 'nebenprobenNr', | |
74 flex: 1, | |
75 editor: { | |
76 allowBlank: false | |
77 } | |
78 }, { | |
79 header: 'MMT', | |
80 dataIndex: 'mmtId', | |
81 flex: 1, | |
82 editor: { | |
83 allowBlank: false | |
84 } | |
85 }, { | |
86 header: 'Messzeit', | |
87 dataIndex: 'messzeitpunkt', | |
88 flex: 2, | |
89 editor: { | |
90 xtype: 'datefield', | |
91 allowBlank: false, | |
92 format: 'd.m.Y', | |
93 //minValue: '01.01.2001', //todo: gibt es das? | |
94 //minText: 'Das Datum der Messung darf nicht vor dem 01.01.2001 liegen.', | |
95 maxValue: Ext.Date.format(new Date(), 'd.m.Y') | |
96 } | |
97 } | |
98 /* | |
99 , { | |
100 header: 'Messdauer', | |
101 dataIndex: 'messdauer', | |
102 width: 50, | |
103 editor: { | |
104 allowBlank: false | |
105 } | |
106 }, { | |
107 header: 'Geplant', | |
108 dataIndex: 'geplant', | |
109 width: 10, | |
110 editor: { | |
111 xtype: 'checkboxfield', | |
112 allowBlank: false | |
113 } | |
114 }, { | |
115 header: 'Letzte Änderung', | |
116 dataIndex: 'letzteAenderung', | |
117 width: 50, | |
118 editor: { | |
119 xtype: 'datefield', | |
120 allowBlank: false, | |
121 format: 'd.m.Y', | |
122 //minValue: '01.01.2001', //todo: gibt es das? | |
123 //minText: 'Das Datum der letzten Änderung darf nicht vor dem 01.01.2001 liegen.', | |
124 maxValue: Ext.Date.format(new Date(), 'd.m.Y') | |
125 } | |
126 }*/ | |
127 , { | |
128 header: 'Status', | |
129 dataIndex: 'id', | |
130 flex: 1, | |
131 renderer: function(value) { | |
132 var sstore = Ext.getStore('Status'); // Es existiert derzeit kein StatusModel. Der Status Store referenziert jedoch darauf. | |
133 sstore.load({ | |
134 params: { | |
135 probeId: value.recordId, | |
136 messungsId: value.id | |
137 } | |
138 }); | |
139 if (sstore.getTotalCount() === 0) { | |
140 return 'unbekannt'; | |
141 } | |
142 return sstore.last().get('status'); | |
143 } | |
144 }, { | |
145 header: 'OK-Flag', | |
146 dataIndex: 'fertig', | |
147 flex: 1, | |
148 renderer: function(value){ | |
149 if(value){ | |
150 return 'Ja'; | |
151 } | |
152 return 'Nein'; | |
153 }, | |
154 editor: { | |
155 xtype: 'checkboxfield', | |
156 allowBlank: false | |
157 } | |
158 }, { | |
159 header: 'Anzahl Nuklide', | |
160 flex: 1, | |
161 renderer: function(value) { | |
162 var mstore = Ext.getStore('Messwerte'); | |
163 mstore.load({ | |
164 params: { | |
165 probeId: value.recordId, | |
166 messungsId: value.id | |
167 } | |
168 }); | |
169 return mstore.getTotalCount(); | |
170 } | |
171 }, { | |
172 header: 'Anzahl Kommentare', | |
173 flex: 1, | |
174 renderer: function(value) { | |
175 var kstore = Ext.getStore('MKommentare'); | |
176 kstore.load({ | |
177 params: { | |
178 probeId: value.probeId, | |
179 messungsId: value.id | |
180 } | |
181 }); | |
182 return kstore.getTotalCount(); | |
183 } | |
184 }]; | |
185 this.initData(); | |
186 this.callParent(arguments); | |
187 }, | |
188 | |
189 initData: function(){ | |
190 this.store = Ext.create('Lada.store.Messungen'); | |
191 this.store.load({ | |
192 params: { | |
193 probeId: this.recordId | |
194 } | |
195 }); | |
196 }, | |
197 listeners: { | |
198 selectionchange: function(model, selected, eOpts) { | |
199 /* | |
200 * Enable the 'details' button only when an item is selected | |
201 */ | |
202 if (selected.length > 0) { | |
203 this.down('button[action=open]').enable(); | |
204 } | |
205 } | |
206 } | |
207 }); |