Browse Source

Add capacity checks on no profile and submit

Neal Wilson 8 years ago
parent
commit
fc658422f4
1 changed files with 24 additions and 2 deletions
  1. 24
    2
      config/Windows/newbatch.xml

+ 24
- 2
config/Windows/newbatch.xml View File

@@ -472,11 +472,22 @@
472 472
             }
473 473
             var noprofilebutton = findChildObject(this, 'noprofile');
474 474
             noprofilebutton.clicked.connect(function() {
475
+                var proceed = false;
476
+                if(validateCapacity()) {
477
+                    proceed = true;
478
+                } else {
479
+                    proceed = displayWarning("Suspicious Input", "Entered green coffee weight exceeds maximum batch size. Continue?");
480
+                }
481
+                if(proceed) {
482
+                    doNoProfile();
483
+                }
484
+            });
485
+            var doNoProfile = function() {
475 486
                 batch.windowModified = true;
476 487
                 currentBatchInfo = batch;
477 488
                 navigationwindow.loggingWindow.raise();
478 489
                 navigationwindow.loggingWindow.activateWindow();
479
-            });
490
+            }
480 491
             var submitbutton = findChildObject(this, 'submit');
481 492
             var timefield = findChildObject(this, 'time');
482 493
             var notes = findChildObject(this, 'annotation');
@@ -485,6 +496,17 @@
485 496
             approval.checked = true;
486 497
             var target = findChildObject(this, 'target');
487 498
             submitbutton.clicked.connect(function() {
499
+                var proceed = false;
500
+                if(validateCapacity()) {
501
+                    proceed = true;
502
+                } else {
503
+                    proceed = displayWarning("Suspicious Input", "Entered green coffee weight exceeds maximum batch size. Continue?");
504
+                }
505
+                if(proceed) {
506
+                    doSubmit();
507
+                }
508
+            });
509
+            var doSubmit = function() {
488 510
                 checkQuery = new QSqlQuery();
489 511
                 checkQuery.exec("SELECT 1 FROM machine WHERE id = " + selectedRoasterID);
490 512
                 if(!checkQuery.next())
@@ -544,7 +566,7 @@
544 566
                 query = query.invalidate();
545 567
                 batch.windowModified = false;
546 568
                 batch.close();
547
-            });
569
+            }
548 570
         ]]>
549 571
     </program>
550 572
 </window>

Loading…
Cancel
Save