Fixed initial display of the yeast propagation window

Wed, 20 Feb 2019 21:57:40 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 20 Feb 2019 21:57:40 +0100
changeset 280
c1f2a90c93ca
parent 279
60d56f39e63e
child 281
fef03c7ae353

Fixed initial display of the yeast propagation window

www/js/prod_edit.js file | annotate | diff | comparison | revisions
--- a/www/js/prod_edit.js	Wed Feb 20 21:39:29 2019 +0100
+++ b/www/js/prod_edit.js	Wed Feb 20 21:57:40 2019 +0100
@@ -1825,6 +1825,21 @@
 		}
 	}
 
+	function showStarter() {
+
+		if (dataRecord.starter_enable) {
+			$("#propagator").show();
+			$("#starter_type").jqxDropDownList( {disabled: false });
+			$("#starter_try").jqxButton({ disabled: false });
+			$("#starter_sg").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
+		} else {
+			$("#propagator").hide();
+			$("#starter_type").jqxDropDownList( {disabled: true });
+			$("#starter_try").jqxButton({ disabled: true });
+			$("#starter_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
+		}
+	}
+
 	function calcInit () {
 		console.log("calcInit()");
 
@@ -1834,18 +1849,12 @@
 
 		$("#starter_enable").on('checked', function (event) {
 			dataRecord.starter_enable = 1;
-			$("#propagator").show();
-			$("#starter_type").jqxDropDownList( {disabled: false });
-			$("#starter_try").jqxButton({ disabled: false });
-			$("#starter_sg").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
+			showStarter();
 			calcYeast();
 		});
 		$("#starter_enable").on('unchecked', function (event) {
 			dataRecord.starter_enable = 0;
-			$("#propagator").hide();
-			$("#starter_type").jqxDropDownList( {disabled: true });
-			$("#starter_try").jqxButton({ disabled: true });
-			$("#starter_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
+			showStarter();
 		});
 		$("#starter_try").click(function () {
 			$("#prop1_volume").val(0);
@@ -3615,6 +3624,7 @@
                         },
                         ready: function() {
 				calcFermentables();
+				showStarter();
 				calcYeast();
                                 $('#jqxTabs').jqxTabs('next');
                         },

mercurial