www/js/prod_edit.js

changeset 457
b9055393b802
parent 456
00b199dccf72
child 458
47b592993dd5
--- a/www/js/prod_edit.js	Sat Aug 24 19:48:23 2019 +0200
+++ b/www/js/prod_edit.js	Sat Aug 24 21:52:46 2019 +0200
@@ -346,7 +346,7 @@
 				if (parseFloat(row.y_attenuation) > svg)
 					svg = parseFloat(row.y_attenuation);	// Take the highest if multiple yeasts.
 				if (row.y_form == 0)
-					initcells += (parseFloat(row.y_cells) / 1000000000) * parseFloat(row.y_amount);
+					initcells += (parseFloat(row.y_cells) / 1000000000) * parseFloat(row.y_amount) * (dataRecord.starter_viability / 100);
 				else
 					initcells += (parseFloat(row.y_cells) / 1000000) * parseFloat(row.y_amount);
 			}
@@ -2012,6 +2012,7 @@
 			$("#starter_type").jqxDropDownList({ disabled: true });
                         $("#starter_try").jqxButton({ disabled: true });
                         $("#starter_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
+			$("#starter_viability").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
 		}
 		if (dataRecord.stage > 3) { // Primary fermentation done
 			$("#brew_date_start").jqxDateTimeInput({ disabled: true });
@@ -2103,11 +2104,13 @@
 			$("#starter_type").jqxDropDownList( {disabled: false });
 			$("#starter_try").jqxButton({ disabled: false });
 			$("#starter_sg").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
+			$("#starter_viability").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 });
+			$("#starter_viability").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
 		}
 	}
 
@@ -2148,6 +2151,13 @@
 				calcYeast();
 			}
 		});
+		$('#starter_viability').on('change', function (event) {
+                        if (event.args) {
+                                dataRecord.starter_viability = event.args.value;
+				calcFermentables();
+                                calcYeast();
+                        }
+                });
 		$('#prop1_type').on('change', function (event) {
 			if (event.args) {
 				var index = event.args.index;
@@ -2840,6 +2850,7 @@
 			starter_enable: dataRecord.starter_enable,
 			starter_type: $("#starter_type").val(),
 			starter_sg: parseFloat($("#starter_sg").jqxNumberInput('decimal')),
+			starter_viability: parseFloat($("#starter_viability").jqxNumberInput('decimal')),
 			prop1_type: $("#prop1_type").val(),
 			prop1_volume: parseFloat($("#prop1_volume").jqxNumberInput('decimal')),
 			prop2_type: $("#prop2_type").val(),
@@ -3066,6 +3077,7 @@
 			{ name: 'starter_enable', type: 'int' },
 			{ name: 'starter_type', type: 'int' },
 			{ name: 'starter_sg', type: 'float' },
+			{ name: 'starter_viability', type: 'int' },
 			{ name: 'prop1_type', type: 'int' },
 			{ name: 'prop1_volume', type: 'float' },
 			{ name: 'prop2_type', type: 'int' },
@@ -3287,6 +3299,7 @@
 			$("#starter_enable").val(dataRecord.starter_enable);
 			$("#starter_type").val(dataRecord.starter_type);
 			$("#starter_sg").val(dataRecord.starter_sg);
+			$("#starter_viability").val(dataRecord.starter_viability);
 			$("#prop1_type").val(dataRecord.prop1_type);
 			$("#prop1_volume").val(dataRecord.prop1_volume);
 			$("#prop2_type").val(dataRecord.prop2_type);
@@ -5264,6 +5277,7 @@
 		autoDropDownHeight: true
 	});
 	$("#starter_sg").jqxNumberInput( SGopts );
+	$("#starter_viability").jqxNumberInput( Perc0 );
 	$("#starter_try").jqxButton({ template: "primary", width: '100px', height: 23, theme: theme });
 
 	// Tab 7, Mashing

mercurial