Neal Wilson 9 years ago
parent
commit
886a2aadb8
1 changed files with 34 additions and 4 deletions
  1. 34
    4
      config/Windows/newsamplebatch.xml

+ 34
- 4
config/Windows/newsamplebatch.xml View File

179
 			stop.clicked.connect(function() {
179
 			stop.clicked.connect(function() {
180
 				submit.setEnabled(true);
180
 				submit.setEnabled(true);
181
 			});
181
 			});
182
-			roastButton.clicked.connect(function() {
182
+                        var validateCapacity = function() {
183
+                            if(checkCapacity == "true") {
184
+                                if(convertToPounds(parseFloat(green.text), GunitBox.currentText) > poundsCapacity) {
185
+                                    return false;
186
+                                }
187
+                            }
188
+                            return true;
189
+                        }
190
+                        roastButton.clicked.connect(function() {
191
+                            var proceed = false;
192
+                            if(validateCapacity()) {
193
+                                proceed = true;
194
+                            } else {
195
+                                proceed = displayWarning("Suspicious Input", "Entered green coffee weight exceeds maximum batch size. Continue?");
196
+                            }
197
+                            if(proceed) {
198
+                                doRoast();
199
+                            }
200
+                        });
201
+                        var doRoast = function() {
183
 				var lc = 1;
202
 				var lc = 1;
184
 				currentBatchInfo = batch;
203
 				currentBatchInfo = batch;
185
 				query = new QSqlQuery();
204
 				query = new QSqlQuery();
242
 					t = t + ", " + profileName.currentText;
261
 					t = t + ", " + profileName.currentText;
243
 				}
262
 				}
244
 				navigationwindow.loggingWindow.windowTitle = t;
263
 				navigationwindow.loggingWindow.windowTitle = t;
245
-			});
264
+			};
246
 			var notes = findChildObject(this, 'annotation');
265
 			var notes = findChildObject(this, 'annotation');
247
 			var machine = findChildObject(this, 'machine');
266
 			var machine = findChildObject(this, 'machine');
248
 			var duration = findChildObject(this, 'duration');
267
 			var duration = findChildObject(this, 'duration');
250
 			var vendor = findChildObject(this, 'vendor');
269
 			var vendor = findChildObject(this, 'vendor');
251
 			var attributes = findChildObject(this, 'attributes');
270
 			var attributes = findChildObject(this, 'attributes');
252
 			var target = findChildObject(this, 'target');
271
 			var target = findChildObject(this, 'target');
253
-			submit.clicked.connect(function() {
272
+                        submit.clicked.connect(function() {
273
+                            var proceed = false;
274
+                            if(validateCapacity()) {
275
+                                proceed = true;
276
+                            } else {
277
+                                proceed = displayWarning("Suspicious Input", "Entered green coffee weight exceeds maximum batch size. Continue?");
278
+                            }
279
+                            if(proceed) {
280
+                                doLoadProfile();
281
+                            }
282
+                        });
283
+                        var doSubmit = function() {
254
 				query = new QSqlQuery();
284
 				query = new QSqlQuery();
255
 				query.prepare("INSERT INTO files (id, name, type, note, file) VALUES(DEFAULT, :name, 'profile', NULL, :data) RETURNING id");
285
 				query.prepare("INSERT INTO files (id, name, type, note, file) VALUES(DEFAULT, :name, 'profile', NULL, :data) RETURNING id");
256
 				query.bind(":name", timefield.text + " " + name.text + " " + profileName.currentText);
286
 				query.bind(":name", timefield.text + " " + name.text + " " + profileName.currentText);
328
 				query.exec();
358
 				query.exec();
329
 				query = query.invalidate();
359
 				query = query.invalidate();
330
 				batch.close();
360
 				batch.close();
331
-			});
361
+			}
332
 		]]>
362
 		]]>
333
 	</program>
363
 	</program>
334
 </window>
364
 </window>

Loading…
Cancel
Save