|
@@ -4,6 +4,7 @@
|
4
|
4
|
<button type="push" id="target" name="Load profile as target" />
|
5
|
5
|
<button type="push" id="viewprofile" name="View profile" />
|
6
|
6
|
<button type="push" id="compare" name="Compare profile" />
|
|
7
|
+ <button type="push" id="edit" name="Edit" />
|
7
|
8
|
</layout>
|
8
|
9
|
<webview id="view" />
|
9
|
10
|
</layout>
|
|
@@ -14,10 +15,22 @@
|
14
|
15
|
var fileID;
|
15
|
16
|
var target = findChildObject(this, 'target');
|
16
|
17
|
var compare = findChildObject(this, 'compare');
|
|
18
|
+ var edit = findChildObject(this, 'edit');
|
|
19
|
+ edit.enabled = false;
|
17
|
20
|
if(typeof(navigationwindow.loggingWindow) == "undefined") {
|
18
|
21
|
compare.enabled = false;
|
19
|
22
|
target.enabled = false;
|
20
|
23
|
}
|
|
24
|
+ var tableReference;
|
|
25
|
+ var rowReference;
|
|
26
|
+ var batchTime;
|
|
27
|
+ var machine;
|
|
28
|
+ var approval;
|
|
29
|
+ var annotation;
|
|
30
|
+ edit.clicked.connect(function() {
|
|
31
|
+ var editWindow = createWindow("editBatchDetails");
|
|
32
|
+ editWindow.loadData(window, tableReference, rowReference, batchTime, machine, approval, annotation);
|
|
33
|
+ });
|
21
|
34
|
compare.clicked.connect(function() {
|
22
|
35
|
var query = new QSqlQuery;
|
23
|
36
|
query.prepare("SELECT file, name FROM files WHERE id = :id");
|
|
@@ -135,6 +148,8 @@
|
135
|
148
|
query = query.invalidate();
|
136
|
149
|
});
|
137
|
150
|
window.loadData = function(table, row) {
|
|
151
|
+ tableReference = table;
|
|
152
|
+ rowReference = row;
|
138
|
153
|
var buffer = new QBuffer;
|
139
|
154
|
buffer.open(3);
|
140
|
155
|
var output = new XmlWriter(buffer);
|
|
@@ -157,7 +172,8 @@
|
157
|
172
|
output.writeAttribute("style", "float: left");
|
158
|
173
|
output.writeStartElement("p");
|
159
|
174
|
output.writeTextElement("strong", "Roasted On: ");
|
160
|
|
- output.writeTextElement("span", table.data(row, 0));
|
|
175
|
+ batchTime = table.data(row, 0);
|
|
176
|
+ output.writeTextElement("span", batchTime);
|
161
|
177
|
output.writeEndElement();
|
162
|
178
|
output.writeStartElement("p");
|
163
|
179
|
output.writeTextElement("strong", "Batch Duration: ");
|
|
@@ -177,10 +193,13 @@
|
177
|
193
|
output.writeStartElement("tbody");
|
178
|
194
|
var query = new QSqlQuery();
|
179
|
195
|
query.prepare("SELECT unroasted_id, unroasted_quantity, approval, files, annotation FROM roasting_log WHERE time = :time AND machine = :machine");
|
180
|
|
- query.bind(":time", table.data(row, 0));
|
181
|
|
- query.bind(":machine", table.data(row, 1));
|
|
196
|
+ query.bind(":time", batchTime);
|
|
197
|
+ machine = table.data(row, 1);
|
|
198
|
+ query.bind(":machine", machine);
|
182
|
199
|
query.exec();
|
183
|
200
|
query.next();
|
|
201
|
+ approval = query.value(2);
|
|
202
|
+ annotation = query.value(4);
|
184
|
203
|
var items = sqlToArray(query.value(0));
|
185
|
204
|
var quantities = sqlToArray(query.value(1));
|
186
|
205
|
var nameQuery = new QSqlQuery();
|
|
@@ -235,11 +254,12 @@
|
235
|
254
|
output.writeEndElement();
|
236
|
255
|
output.writeStartElement("p");
|
237
|
256
|
output.writeTextElement("strong", "Approved: ");
|
238
|
|
- output.writeCharacters(query.value(2));
|
|
257
|
+ output.writeCharacters(approval);
|
239
|
258
|
output.writeEndElement();
|
240
|
259
|
output.writeStartElement("p");
|
241
|
260
|
output.writeTextElement("strong", "Files: ");
|
242
|
|
- output.writeCharacters(query.value(3)); output.writeEndElement();
|
|
261
|
+ output.writeCharacters(query.value(3));
|
|
262
|
+ output.writeEndElement();
|
243
|
263
|
output.writeStartElement("p");
|
244
|
264
|
output.writeTextElement("strong", "Annotations:");
|
245
|
265
|
var files = sqlToArray(query.value(3));
|
|
@@ -299,7 +319,7 @@
|
299
|
319
|
}
|
300
|
320
|
output.writeEndElement();
|
301
|
321
|
output.writeEndElement();
|
302
|
|
- output.writeCharacters(query.value(4));
|
|
322
|
+ output.writeCharacters(annotation);
|
303
|
323
|
output.writeEndElement();
|
304
|
324
|
output.writeEndElement();
|
305
|
325
|
output.writeEndElement();
|
|
@@ -307,6 +327,7 @@
|
307
|
327
|
dataView.setContent(buffer);
|
308
|
328
|
buffer.close();
|
309
|
329
|
query = query.invalidate();
|
|
330
|
+ edit.enabled = true;
|
310
|
331
|
};
|
311
|
332
|
]]>
|
312
|
333
|
</program>
|