www/js/prod_edit.js

branch
stable
changeset 387
541503502b1b
parent 382
547c23b50d00
child 389
eb8ce63eb489
--- a/www/js/prod_edit.js	Sun May 26 20:45:01 2019 +0200
+++ b/www/js/prod_edit.js	Thu May 30 23:18:48 2019 +0200
@@ -489,8 +489,8 @@
 		}
 		total_ibus = Math.round(total_ibus * 10) / 10;
 		ferm_ibus = Math.round(ferm_ibus * 10) / 10;
-		hop_flavour = Math.round(hop_flavour * 100) / 10;
-		hop_aroma = Math.round(hop_aroma * 100) / 10;
+		hop_flavour = Math.round(hop_flavour * 1000 / 5) / 10;
+		hop_aroma = Math.round(hop_aroma * 1000 / 6) / 10;
 		if (hop_flavour > 100)
 			hop_flavour = 100;
 		if (hop_aroma > 100)
@@ -3203,6 +3203,7 @@
                         height: 470,
                         source: fermentableAdapter,
                         theme: theme,
+                	sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -3322,6 +3323,11 @@
                                 });
                         },
                         ready: function() {
+				var datainformation = $('#fermentableGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#fermentableGrid").jqxGrid('sortby', 'f_added', 'asc');
+					$("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
+				}
 				calcFermentables();
                                 $('#jqxTabs').jqxTabs('next');
                         },
@@ -3432,6 +3438,7 @@
                         height: 560,
                         source: hopAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -3506,6 +3513,12 @@
                                 });
                         },
                         ready: function() {
+				var datainformation = $('#hopGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#hopGrid").jqxGrid('sortby', 'h_useat', 'asc');
+					$("#hopGrid").jqxGrid('sortby', 'h_time', 'desc');
+					$("#hopGrid").jqxGrid('sortby', 'h_amount', 'desc');
+				}
 				calcIBUs();
                                 $('#jqxTabs').jqxTabs('next');
                         },
@@ -3691,6 +3704,7 @@
                         height: 575,
                         source: miscAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -3748,6 +3762,11 @@
                                 });
                         },
                         ready: function() {
+				var datainformation = $('#miscGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
+					$("#miscGrid").jqxGrid('sortby', 'm_type', 'asc');
+				}
 				calcMiscs();
                                 $('#jqxTabs').jqxTabs('next');
                         },
@@ -3862,6 +3881,7 @@
                         height: 350,
                         source: yeastAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -3932,6 +3952,10 @@
                                 });
                         },
                         ready: function() {
+				var datainformation = $('#yeastGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
+				}
 				calcFermentables();
 				showStarter();
 				calcYeast();
@@ -4320,41 +4344,67 @@
 	$("#est_og2").jqxNumberInput( Show3dec );
 	$("#mash_kg").jqxTooltip({ content: 'Het gewicht van alle mouten in de maisch.' });
 	$("#mash_kg").jqxNumberInput( Show3dec );
-	$("#ferm_lintner").jqxTooltip({ content: 'De enzymkracht van alle mouten in de maisch. Moet hoger dan 35 zijn.' });
-	$("#ferm_lintner").jqxNumberInput( Show0dec );
 	$("#perc_malts").jqxProgressBar({
 		width: 300,
 		height: 23,
 		theme: theme,
 		showText: true,
+		max: 120,
 		animationDuration: 0,
 		colorRanges: [
 			{ stop:  90, color: '#008C00' },
-			{ stop:  95, color: '#EB7331' },
-			{ stop: 100, color: '#FF0000' }
-		]
+			{ stop: 100, color: '#EB7331' },
+			{ stop: 120, color: '#FF0000' }
+		],
+		renderText: function (text) {
+			return (Math.round(parseInt(text) * 1.2)) + '%';
+    		}
 	});
 	$("#perc_sugars").jqxProgressBar({
 		width: 300,
 		height: 23,
 		theme: theme,
 		showText: true,
+		max: 50,
 		animationDuration: 0,
 		colorRanges: [
-			{ stop:  20, color: '#008C00' },
-			{ stop: 100, color: '#FF0000' }
-		]
+			{ stop: 20, color: '#008C00' },
+			{ stop: 50, color: '#FF0000' }
+		],
+		renderText: function (text) {
+			return (Math.round(parseInt(text) * 5) / 10) + '%';
+		}
 	});
 	$("#perc_cara").jqxProgressBar({
 		width: 300,
 		height: 23,
 		theme: theme,
 		showText: true,
+		max: 50,
 		animationDuration: 0,
 		colorRanges: [
-			{ stop:  25, color: '#008C00' },
-			{ stop: 100, color: '#FF0000' }
-		]
+			{ stop: 25, color: '#008C00' },
+			{ stop: 50, color: '#FF0000' }
+		],
+		renderText: function (text) {
+			return (Math.round(parseInt(text) * 5) / 10) + '%';
+		}
+	});
+	$("#ferm_lintner").jqxProgressBar({
+		width: 300,
+		height: 23,
+		theme: theme,
+		showText: true,
+		max: 200,
+		animationDuration: 0,
+		colorRanges: [
+			{ stop:  30, color: '#FF0000' },
+			{ stop:  40, color: '#EB7331' },
+			{ stop: 200, color: '#008C00' }
+		],
+		renderText: function (text) {
+			return (parseInt(text) * 2) + ' lintner';
+		}
 	});
 	$("#popupFermentable").jqxWindow({
 		width: 800,
@@ -4369,7 +4419,6 @@
 	});
 	$("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#FermentableReady").click(function () {
-		$("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
 		// Recalc percentages
 		calcFermentables();
 		calcIBUs();
@@ -4570,7 +4619,20 @@
 			{ stop:  60, color: '#00BF00' },
 			{ stop:  80, color: '#00FF00' },
 			{ stop: 100, color: '#80FF80' }
-		]
+		],
+                renderText: function (text) {
+                        var val = parseInt(text);
+                        if (val < 20)
+                                return 'Weinig';
+                        else if (val < 40)
+                                return 'Matig';
+                        else if (val < 60)
+                                return 'Redelijk';
+                        else if (val < 80)
+                                return 'Veel';
+                        else
+                                return 'Zeer veel';
+                }
 	});
 	$("#hop_aroma").jqxProgressBar({
 		width: 300, height: 23, theme: theme, showText: true,
@@ -4581,7 +4643,20 @@
 			{ stop:  60, color: '#00BF00' },
 			{ stop:  80, color: '#00FF00' },
 			{ stop: 100, color: '#80FF80' }
-		]
+		],
+		renderText: function (text) {
+			var val = parseInt(text);
+			if (val < 20)
+				return 'Weinig';
+			else if (val < 40)
+				return 'Matig';
+			else if (val < 60)
+				return 'Redelijk';
+			else if (val < 80)
+				return 'Veel';
+			else
+				return 'Zeer veel';
+		}
 	});
 	$("#popupHop").jqxWindow({
 		width: 800,
@@ -4596,7 +4671,6 @@
 	});
 	$("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#HopReady").click(function () {
-		$("#hopGrid").jqxGrid('sortby', 'h_amount', 'asc');
 		calcIBUs();
 	});
 	$("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 });
@@ -4735,7 +4809,6 @@
 	});
 	$("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#MiscReady").click(function () {
-		$("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
 		calcMiscs();
 	});
 	$("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 });
@@ -4843,7 +4916,6 @@
 	$("#YeastReady").click(function () {
 		calcFermentables();
 		calcYeast();
-		$("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
 	});
 	$("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 });
 	$("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 });

mercurial