www/js/rec_edit.js

changeset 261
8d55ca45c29e
parent 254
3d61397fe9cd
child 262
36cf32fcd210
--- a/www/js/rec_edit.js	Sun Feb 10 17:53:29 2019 +0100
+++ b/www/js/rec_edit.js	Sun Feb 10 20:08:27 2019 +0100
@@ -46,8 +46,8 @@
 
 	var	to_100 = false;		// Fermentables adjust to 100%
 	var	preboil_sg = 0;
-	var	sugarsm = 0;		// Sugars after mash
-	var	sugarsf = 0;		// Sugars after boil
+//	var	sugarsm = 0;		// Sugars after mash
+//	var	sugarsf = 0;		// Sugars after boil
 	var     psugar = 0;     	// Percentage real sugars
 	var     pcara = 0;      	// Percentage cara/crystal malts
 	var	svg = 77;		// Default attenuation
@@ -156,15 +156,38 @@
 
 	function calcFermentables() {
 		console.log("calcFermentables()");
-		sugarsf = 0;
-		sugarsm = 0;
+		sugarsf = 0;		// fermentable sugars mash + boil
+		sugarsm = 0;		// fermentable sugars in mash
 		psugar = 0;
 		pcara = 0;
 		mashkg = 0;
-		var colorw = 0;	// Colors working
+		var vol = 0;		// Volume sugars after boil
+		var addedS = 0;		// Added sugars after boil
+		var addedmass = 0;	// Added mass after boil
+		var mvol = 0;		// mash volume
+		var colort = 0;		// Colors srm * vol totals
 		var my_100 = false;
+		var mashtime = 0;       // Total mash time
+		var mashtemp = 0;       // Average mash temperature
 
-		var rows = $('#fermentableGrid').jqxGrid('getrows');
+		if ((rows = $('#mashGrid').jqxGrid('getrows'))) {
+			for (var i = 0; i < rows.length; i++) {
+				var row = rows[i];
+				if (row.step_type == 0) // Infusion
+					mvol += parseFloat(row.step_infuse_amount);
+				if (row.step_temp <= 75) { // Ignore mashout
+					mashtime += row.step_time;
+					mashtemp += row.step_time * row.step_temp;
+				}
+			}
+			mashtemp = mashtemp / mashtime;
+		}
+
+		if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
+			return; // grid not yet loaded.
+		}
+
+		var s = 0;
 		for (var i = 0; i < rows.length; i++) {
 			var row = rows[i];
 			if (row.f_adjust_to_total_100)
@@ -175,12 +198,23 @@
 				pcara += row.f_percentage;
 			var d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100);
 			if (row.f_added == 0) {		// Mash
+				if (mvol > 0) { 	// Only if mash already known
+					mvol += row.f_amount * row.f_moisture / 100;
+					s += d;
+				}
 				d = parseFloat(dataRecord.efficiency) / 100 * d;
 				sugarsm += d;
 				mashkg += row.f_amount;
 			}
-			sugarsf += d;
-			colorw += row.f_amount * ebc_to_srm(row.f_color) / parseFloat(dataRecord.batch_size) * 8.34436;
+			if (row.f_added == 0 || row.f_added == 1)	// Mash or Boil
+				sugarsf += d;
+			if (row.f_added == 2 || row.f_added == 3) {
+				var x = (row.f_yield / 100) * (1 - row.f_moisture / 100);
+				addedS += row.f_amount * x;
+				addedmass += row.f_amount;
+				vol += (x * sugardensity + (1 - x) * 1) * row.f_amount;
+			}
+			colort += row.f_amount * ebc_to_srm(row.f_color);
 		}
 		to_100 = my_100;
 		if (to_100) {
@@ -188,21 +222,56 @@
 		} else {
 			$("#wf_amount").jqxNumberInput({ width: 110, readOnly: false, spinButtons: true });
 		}
-		var est_og = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size));
-		$('#est_og').val(est_og);
-		$('#est_og2').val(est_og);
-		preboil_sg = estimate_sg(sugarsm, dataRecord.boil_size);
-		var color = kw_to_ebc(dataRecord.color_method, colorw);
+
+		// Estimate total recipe OG.
+		dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size));
+		$('#est_og').val(dataRecord.est_og);
+		$('#est_og2').val(dataRecord.est_og);
+
+		// Estimate SG in kettle before boil
+		preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size));
+
+		// Color of the wort
+		var cw = colort / parseFloat(dataRecord.batch_size) * 8.34436;
+		var color = kw_to_ebc(dataRecord.color_method, cw);
+		dataRecord.est_color = color;
 		$('#est_color').val(color);
 		$('#est_color2').val(color);
 		var scolor = ebc_to_color(color);
 		document.getElementById("bcolor").style.background= scolor;
 		document.getElementById("bcolor2").style.background= scolor;
-		// Use boil_size instead of mash_max from equipment.
+
+		// Progress bars
 		pmalts = mashkg / (dataRecord.boil_size / 3) * 100;
 		$("#perc_malts").jqxProgressBar('val', pmalts);
 		$("#perc_sugars").jqxProgressBar('val', psugar);
 		$("#perc_cara").jqxProgressBar('val', pcara);
+
+		// Calculate estimated svg.
+		svg = 0; // default.
+		var rows = $('#yeastGrid').jqxGrid('getrows');
+		for (var i = 0; i < rows.length; i++) {
+			var row = rows[i];
+			if (row.y_use == 0) {   // Primary
+				if (parseFloat(row.y_attenuation) > svg)
+					svg = parseFloat(row.y_attenuation);    // Take the highest if multiple yeasts.
+			}
+			// TODO: brett in secondary ??
+		}
+		if (svg == 0)
+			svg = 77;
+
+		if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) {
+			dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og);
+		} else {
+			dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
+		}
+		$('#est_fg').val(dataRecord.est_fg);
+		$('#est_fg2').val(dataRecord.est_fg);
+
+		dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg);
+		$("#est_abv").val(dataRecord.est_abv);
+		$("#est_abv2").val(dataRecord.est_abv);
 	};
 
 	function hopFlavourContribution(bt, vol, use, amount) {
@@ -265,15 +334,6 @@
 		$("#hop_aroma").jqxProgressBar('val', hop_aroma * 10);
 	};
 
-	function calcSVG() {
-		var rows = $('#yeastGrid').jqxGrid('getrows');
-		for (var i = 0; i < rows.length; i++) {
-			var row = rows[i];
-			if (row.y_use == 0)	// Primary
-				svg = parseFloat(row.y_attenuation);
-		}
-	}
-
 /*	function GetBUGUMin() {
 
 		var Result = 0;
@@ -1020,19 +1080,6 @@
 		}
 	};
 
-	function calcFG() {
-		var fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, parseFloat(parseFloat($("#est_og").jqxNumberInput('decimal'))));
-	        dataRecord.est_fg = fg;
-		$('#est_fg').val(fg);
-		$('#est_fg2').val(fg);
-	}
-
-	function calcABV() {
-		var abv = abvol(parseFloat($("#est_og").jqxNumberInput('decimal')), parseFloat($("#est_fg").jqxNumberInput('decimal')));
-		$("#est_abv").val(abv);
-		$("#est_abv2").val(abv);
-	};
-
 	function calcInit () {
 		console.log("calc.init()");
 
@@ -1147,9 +1194,6 @@
 			dataRecord.batch_size = parseFloat(event.args.value);
 			calcFermentablesFromOG(parseFloat($("#est_og").jqxNumberInput('decimal')));     // Keep the OG
 			calcFermentables();
-			calcSVG();
-			calcFG();
-			calcABV();
 			// TODO: adjust the hops, miscs, yeast, water.
 			calcIBUs();
 		});
@@ -1163,27 +1207,18 @@
 			dataRecord.boil_size = new_boil;
 			$("#boil_size").val(Math.round(new_boil * 100) / 100);
 			calcFermentables();
-			calcSVG();
-			calcFG();
-			calcABV();
 			// TODO: adjust the hops, miscs, yeast, water.
 			calcIBUs();
 		});
 		$('#efficiency').on('change', function (event) {
 			console.log("efficiency change:"+event.args.value);
 			calcFermentables();
-			calcSVG();
-			calcFG();
-			calcABV();
 			calcIBUs();
 		});
 		$('#est_og').on('change', function (event) {
 			console.log("est_og change:"+event.args.value);
 			calcFermentablesFromOG(event.args.value);       // Adjust fermentables amounts
 			calcFermentables();                             // Update the recipe details
-			calcSVG();
-			calcFG();
-			calcABV();                                      // and ABV
 			calcIBUs();                                     // and the IBU's.
 		});
 		$('#mash_ph').on('change', function (event) {
@@ -1607,9 +1642,6 @@
 						$("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100);
 					}
 					calcFermentables();
-					calcSVG();
-					calcFG();
-					calcABV();
 					calcIBUs();
 				});
 			},
@@ -2176,7 +2208,7 @@
                                 });
                         },
 			ready: function() {
-				calcSVG();
+				calcFermentables();
 				$('#jqxTabs').jqxTabs('next');
 			},
                         columns: [
@@ -2324,7 +2356,7 @@
                                 });
                         },
 			ready: function() {
-				calcFG();
+				calcFermentables();
 				calcInit();
 				$('#jqxLoader').jqxLoader('close');
 				$('#jqxTabs').jqxTabs('first');
@@ -2370,10 +2402,6 @@
         };
 
 	// initialize the input fields.
-	var srcBase = [ "NaHCO3", "Na2CO3", "CaCO3", "Ca(OH)2" ];
-	var srcAcid = [ "Melkzuur", "Zoutzuur", "Fosforzuur", "Zwavelzuur" ];
-	var srcSource = [ "Bron 1", "Bron 2", "Gemengd" ];
-
 	// Tab 1, Algemeen
 	$("#name").jqxTooltip({ content: 'De naam voor dit recept.' });
 	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
@@ -2412,7 +2440,7 @@
 	$("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
 	$("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
 	$("#st_type").jqxTooltip({ content: 'Het bierstijl type.'});
-	$("#st_type").jqxInput({ theme: theme, width: 180, height: 23 });
+	$("#st_type").jqxInput({ theme: theme, width: 250, height: 23 });
 
 	$("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
 	$("#est_og").jqxNumberInput( SGopts );
@@ -2422,7 +2450,7 @@
 	$("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
 
 	$("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
-	$("#est_fg").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true });
+	$("#est_fg").jqxNumberInput( Show3dec );
 	$("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'});
 	$("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
 	$("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
@@ -2436,7 +2464,7 @@
 	$("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
 
 	$("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
-	$("#est_color").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true });
+	$("#est_color").jqxNumberInput( Show0dec );
 	$("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'});
 	$("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
 	$("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'});
@@ -2452,7 +2480,7 @@
 	});
 
 	$("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
-	$("#est_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true });
+	$("#est_ibu").jqxNumberInput( Show0dec );
 	$("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'});
 	$("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
 	$("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'});
@@ -2477,12 +2505,43 @@
 
 	// Tab 2, Vergistbaar
 	$("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
-	$("#est_color2").jqxNumberInput({ inputMode: 'simple', theme: theme, symbol: ' EBC', symbolPosition: 'right', width: 100, height: 23, decimalDigits: 0, readOnly: true });
+	$("#est_color2").jqxNumberInput( Show0dec );
 	$("#est_og2").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
-	$("#est_og2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 3, readOnly: true });
-	$("#perc_malts").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
-	$("#perc_sugars").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
-	$("#perc_cara").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
+	$("#est_og2").jqxNumberInput( Show3dec );
+	$("#perc_malts").jqxProgressBar({
+		width: 300,
+		height: 23,
+		theme: theme,
+		showText: true,
+		animationDuration: 0,
+		colorRanges: [
+			{ stop:  90, color: '#008C00' },
+			{ stop:  95, color: '#EB7331' },
+			{ stop: 100, color: '#FF0000' }
+		]
+	});
+	$("#perc_sugars").jqxProgressBar({
+		width: 300,
+		height: 23,
+		theme: theme,
+		showText: true,
+		animationDuration: 0,
+		colorRanges: [
+			{ stop:  20, color: '#008C00' },
+			{ stop: 100, color: '#FF0000' }
+		]
+	});
+	$("#perc_cara").jqxProgressBar({
+		width: 300,
+		height: 23,
+		theme: theme,
+		showText: true,
+		animationDuration: 0,
+		colorRanges: [
+			{ stop:  25, color: '#008C00' },
+			{ stop: 100, color: '#FF0000' }
+		]
+	});
 	$("#popupFermentable").jqxWindow({
 		width: 800,
 		height: 300,
@@ -2499,9 +2558,6 @@
 		$("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
 		// Recalc percentages
 		calcFermentables();
-		calcSVG();
-		calcFG();
-		calcABV();
 		calcIBUs();
 		// Waters: yes there is impact.
 	});
@@ -2668,12 +2724,46 @@
 		autoDropDownHeight: true,
 		dropDownVerticalAlignment: 'top'
 	});
+	$("#wf_added").on('select', function (event) {
+		if (event.args) {
+			var index = event.args.index;
+			$("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_added', index);
+			calcFermentables();
+			calcIBUs();
+		}
+	});
 
 	// Tab 3, Hoppen
 	$("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
 	$("#est_ibu2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
-	$("#hop_flavour").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
-	$("#hop_aroma").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
+	$("#hop_flavour").jqxProgressBar({
+		width: 300,
+		height: 23,
+		theme: theme,
+		showText: true,
+		animationDuration: 0,
+		colorRanges: [
+			{ stop:  20, color: '#004D00' },
+			{ stop:  40, color: '#008C00' },
+			{ stop:  60, color: '#00BF00' },
+			{ stop:  80, color: '#00FF00' },
+			{ stop: 100, color: '#80FF80' }
+		]
+	});
+	$("#hop_aroma").jqxProgressBar({
+		width: 300,
+		height: 23,
+		theme: theme,
+		showText: true,
+		animationDuration: 0,
+		colorRanges: [
+			{ stop:  20, color: '#004D00' },
+			{ stop:  40, color: '#008C00' },
+			{ stop:  60, color: '#00BF00' },
+			{ stop:  80, color: '#00FF00' },
+			{ stop: 100, color: '#80FF80' }
+		]
+	});
 	$("#popupHop").jqxWindow({
 		width: 800,
 		height: 300,
@@ -2746,7 +2836,7 @@
 		rowdata.h_amount = amount;
 		calcIBUs();
 	});
-	$("#wh_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true });
+	$("#wh_ibu").jqxNumberInput( Show1dec );
 	$("#wh_time").jqxNumberInput( PosInt );
 	$("#wh_time").on('change', function (event) {
 		console.log("time changed: "+event.args.value);
@@ -2910,7 +3000,7 @@
 
 	// Tab 5, Gist
 	$("#est_fg2").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
-	$("#est_fg2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true });
+	$("#est_fg2").jqxNumberInput( Show3dec );
 	$("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
 	$("#est_abv2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
 	$("#popupYeast").jqxWindow({
@@ -2926,9 +3016,7 @@
 	});
 	$("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#YeastReady").click(function () {
-		calcSVG();
-		calcFG();
-		calcABV();
+		calcFermentables();
 		$("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
 	});
 	$("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 });
@@ -2980,9 +3068,7 @@
 			} else {
 				$("#wy_pmpt_amount").html("Volume ml:");
 			}
-			calcSVG();
-			calcFG();
-			calcABV();
+			calcFermentables();
 		}
 	});
 	$("#wy_amount").jqxNumberInput( Spin1dec );
@@ -2994,9 +3080,7 @@
 		else
 			var amount = parseFloat(event.args.value) / 1000;
 		rowdata.y_amount = amount;
-		calcSVG();
-		calcFG();
-		calcABV();
+		calcFermentables();
 	});
 	$("#wy_use").jqxDropDownList({
 		theme: theme,
@@ -3013,9 +3097,7 @@
 			var index = event.args.index;
 			var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow);
 			rowdata.y_use = index;
-			calcSVG();
-			calcFG();
-			calcABV();
+			calcFermentabes();
 		}
 	});
 
@@ -3147,8 +3229,8 @@
 	});
 
 	// Tab 7, Water
-	$("#tgt_bu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 2, readOnly: true });
-	$("#tgt_cl_so4").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
+	$("#tgt_bu").jqxNumberInput( Show2wat );
+	$("#tgt_cl_so4").jqxNumberInput( Show1wat );
 
 	// Water source 1
 	$("#w1_name").jqxDropDownList({
@@ -3185,14 +3267,14 @@
 			calcWater();
 		}
 	});
-	$("#w1_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w1_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w1_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w1_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w1_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w1_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w1_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w1_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
+	$("#w1_amount").jqxNumberInput( Show1wat );
+	$("#w1_calcium").jqxNumberInput( Show1wat );
+	$("#w1_magnesium").jqxNumberInput( Show1wat );
+	$("#w1_sodium").jqxNumberInput( Show1wat );
+	$("#w1_total_alkalinity").jqxNumberInput( Show1wat );
+	$("#w1_chloride").jqxNumberInput( Show1wat );
+	$("#w1_sulfate").jqxNumberInput( Show1wat );
+	$("#w1_ph").jqxNumberInput( Show1wat );
 	// Water source 2
 	$("#w2_name").jqxDropDownList({
 		placeHolder: "Kies meng water:",
@@ -3230,36 +3312,36 @@
 		}
 	});
 	$("#w2_amount").jqxTooltip({ content: 'De verdeling van het hoofd en meng water. Het totale maisch water volume blijft gelijk.'});
-	$("#w2_amount").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5, readOnly: true });
-	$("#w2_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w2_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w2_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w2_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w2_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w2_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#w2_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
+	$("#w2_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1, spinButtons: true, readOnly: true });
+	$("#w2_calcium").jqxNumberInput( Show1wat );
+	$("#w2_magnesium").jqxNumberInput( Show1wat );
+	$("#w2_sodium").jqxNumberInput( Show1wat );
+	$("#w2_total_alkalinity").jqxNumberInput( Show1wat );
+	$("#w2_chloride").jqxNumberInput( Show1wat );
+	$("#w2_sulfate").jqxNumberInput( Show1wat );
+	$("#w2_ph").jqxNumberInput( Show1wat );
 	// Water mixed
-	$("#wg_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#wg_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#wg_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#wg_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#wg_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#wg_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#wg_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#wg_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
+	$("#wg_amount").jqxNumberInput( Show1wat );
+	$("#wg_calcium").jqxNumberInput( Show1wat );
+	$("#wg_magnesium").jqxNumberInput( Show1wat );
+	$("#wg_sodium").jqxNumberInput( Show1wat );
+	$("#wg_total_alkalinity").jqxNumberInput( Show1wat );
+	$("#wg_chloride").jqxNumberInput( Show1wat );
+	$("#wg_sulfate").jqxNumberInput( Show1wat );
+	$("#wg_ph").jqxNumberInput( Show1wat );
 	// Water treated
 	$("#wb_calcium").jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'});
-	$("#wb_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
+	$("#wb_calcium").jqxNumberInput( Show1wat );
 	$("#wb_magnesium").jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is lager dan 30.'});
-	$("#wb_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
+	$("#wb_magnesium").jqxNumberInput( Show1wat );
 	$("#wb_sodium").jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
-	$("#wb_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
+	$("#wb_sodium").jqxNumberInput( Show1wat );
 	$("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is lager dan 100.'});
-	$("#wb_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
+	$("#wb_chloride").jqxNumberInput( Show1wat );
 	$("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is lager dan 350.'});
-	$("#wb_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#wb_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#wb_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
+	$("#wb_sulfate").jqxNumberInput( Show1wat );
+	$("#wb_total_alkalinity").jqxNumberInput( Show1wat );
+	$("#wb_ph").jqxNumberInput( Show1wat );
 	// Water target profile
 	$("#pr_name").jqxDropDownList({
 		placeHolder: "Kies doel profiel:",
@@ -3283,12 +3365,12 @@
 			$("#pr_total_alkalinity").val(datarecord.total_alkalinity);
 		}
         });
-	$("#pr_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#pr_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#pr_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#pr_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#pr_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
-	$("#pr_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
+	$("#pr_calcium").jqxNumberInput( Show1wat );
+	$("#pr_magnesium").jqxNumberInput( Show1wat );
+	$("#pr_sodium").jqxNumberInput( Show1wat );
+	$("#pr_total_alkalinity").jqxNumberInput( Show1wat );
+	$("#pr_chloride").jqxNumberInput( Show1wat );
+	$("#pr_sulfate").jqxNumberInput( Show1wat );
 
 	// Water agents
 	$("#wa_cacl2").jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.'});

mercurial