Merged with 0.3.4 stable

Thu, 30 May 2019 23:18:48 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 30 May 2019 23:18:48 +0200
branch
stable
changeset 387
541503502b1b
parent 377
6e80a5515dd3 (current diff)
parent 386
031842114e9d (diff)
child 388
0a31e1e80a1d

Merged with 0.3.4

config.status file | annotate | diff | comparison | revisions
configure file | annotate | diff | comparison | revisions
configure.ac file | annotate | diff | comparison | revisions
--- a/README.design	Sun May 26 20:45:01 2019 +0200
+++ b/README.design	Thu May 30 23:18:48 2019 +0200
@@ -3,7 +3,6 @@
 
 
 	Main table: products.
-	  In Progress: view logs. 
 	  Calendar: shows upcoming events.
 
 -----------------------------------------------------------------------------
--- a/bmsd/Makefile	Sun May 26 20:45:01 2019 +0200
+++ b/bmsd/Makefile	Thu May 30 23:18:48 2019 +0200
@@ -60,7 +60,7 @@
 nodes.o: bms.h xutil.h nodes.h mysql.h
 futil.o: bms.h futil.h
 fermenters.o: bms.h xutil.h fermenters.h mysql.h
-bms.o: bms.h xutil.h futil.h rdconfig.h lock.h mqtt.h mysql.h
+bms.o: bms.h xutil.h futil.h rdconfig.h lock.h mqtt.h mysql.h nodes.h
 xutil.o: bms.h xutil.h
 rdconfig.o: bms.h xutil.h futil.h rdconfig.h
 mysql.o: bms.h xutil.h mysql.h nodes.h
--- a/bmsd/bms.c	Sun May 26 20:45:01 2019 +0200
+++ b/bmsd/bms.c	Thu May 30 23:18:48 2019 +0200
@@ -27,6 +27,7 @@
 #include "lock.h"
 #include "mqtt.h"
 #include "mysql.h"
+#include "nodes.h"
 
 
 int			my_shutdown = FALSE;
@@ -133,6 +134,7 @@
     while (my_shutdown == FALSE) {
 
 	usleep(100000);
+	nodes_check_online();
     }
     if (debug)
 	fprintf(stdout, "[main] Exit from main loop\n");
--- a/bmsd/mysql.c	Sun May 26 20:45:01 2019 +0200
+++ b/bmsd/mysql.c	Thu May 30 23:18:48 2019 +0200
@@ -355,6 +355,7 @@
 
     if (mysql_query(con, query)) {
 	syslog(LOG_NOTICE, "MySQL: INSERT INTO mon_nodes error %u (%s))", mysql_errno(con), mysql_error(con));
+	syslog(LOG_NOTICE, query);
     } else {
 	syslog(LOG_NOTICE,  "MySQL: insert new node %s", node->node);
     }
@@ -383,6 +384,7 @@
 
     if (mysql_query(con, query)) {
 	syslog(LOG_NOTICE, "MySQL: UPDATE mon_nodes error %u (%s))", mysql_errno(con), mysql_error(con));
+	syslog(LOG_NOTICE, query);
     }
 
     free(query);
@@ -395,10 +397,10 @@
     char        *query = malloc(512);
 
     snprintf(query, 511, "UPDATE mon_nodes SET online='N' WHERE node='%s'", node);
-//    printf("%s\n", query);
 
     if (mysql_query(con, query)) {
 	syslog(LOG_NOTICE, "MySQL: UPDATE mon_nodes error %u (%s))", mysql_errno(con), mysql_error(con));
+	syslog(LOG_NOTICE, query);
     }
 
     free(query);
@@ -445,10 +447,9 @@
 	fermenter->profile_steps ? fermenter->profile_steps : "", fermenter->stage, fermenter->yeast_lo, fermenter->yeast_hi,
 	fermenter->webcam_url ? fermenter->webcam_url : "", fermenter->webcam_light);
 
-//    printf("%s\n", query);
-
     if (mysql_query(con, query)) {
 	syslog(LOG_NOTICE, "MySQL: INSERT INTO mon_fermenters error %u (%s))", mysql_errno(con), mysql_error(con));
+	syslog(LOG_NOTICE, query);
     } else {
 	syslog(LOG_NOTICE,  "MySQL: insert new fermenter %s/%s", fermenter->node, fermenter->alias);
     }
@@ -494,10 +495,9 @@
 	fermenter->profile_steps ? fermenter->profile_steps : "", fermenter->stage, fermenter->yeast_lo, fermenter->yeast_hi,
 	fermenter->webcam_url ? fermenter->webcam_url : "", fermenter->webcam_light, fermenter->uuid);
 
-//    printf("%s\n", query);
-
     if (mysql_query(con, query)) {
 	syslog(LOG_NOTICE, "MySQL: UPDATE mon_fermenters error %u (%s))", mysql_errno(con), mysql_error(con));
+	syslog(LOG_NOTICE, query);
     }
 
     free(query);
@@ -516,6 +516,7 @@
 
     if (mysql_query(con, query)) {
 	syslog(LOG_NOTICE, "MySQL: UPDATE mon_fermenters error %u (%s))", mysql_errno(con), mysql_error(con));
+	syslog(LOG_NOTICE, query);
     }
 
     free(query);
--- a/bmsd/nodes.c	Sun May 26 20:45:01 2019 +0200
+++ b/bmsd/nodes.c	Thu May 30 23:18:48 2019 +0200
@@ -29,10 +29,10 @@
 #include "mysql.h"
 
 
-sys_node_list		*nodes = NULL;
+sys_node_list			*nodes = NULL;
 
-extern int		debug;
-
+extern int			debug;
+extern sys_fermenter_list	*fermenters;
 
 
 void node_birth_data(char *topic, char *payload)
@@ -239,3 +239,30 @@
 }
 
 
+
+void nodes_check_online()
+{
+    sys_node_list	*tmpn;
+    sys_fermenter_list  *tmpf;
+    time_t		now = time(NULL);
+
+    for (tmpn = nodes; tmpn; tmpn = tmpn->next) {
+	if (tmpn->online && ((now - tmpn->lastseen) > 600)) {
+	    syslog(LOG_NOTICE, "Timeout node `%s/%s'", tmpn->group_id, tmpn->node);
+	    tmpn->online = false;
+	    node_mysql_death(tmpn->node);
+
+	    for (tmpf = fermenters; tmpf; tmpf = tmpf->next) {
+            	if (strcmp(tmpf->node, tmpn->node) == 0) {
+                    if (tmpf->online) {
+                    	syslog(LOG_NOTICE, "Timeout fermenter %s/%s", tmpf->node, tmpf->alias);
+                	tmpf->online = false;
+			fermenter_mysql_death(tmpf->node, tmpf->alias);
+		    }
+            	}
+            }
+	}
+    }
+}
+
+
--- a/bmsd/nodes.h	Sun May 26 20:45:01 2019 +0200
+++ b/bmsd/nodes.h	Thu May 30 23:18:48 2019 +0200
@@ -21,4 +21,10 @@
  */
 void node_death(char *topic);
 
+/**
+ * @brief Check if nodes are still online and mark them offline if not
+ *        been seen for 10 minutes.
+ */
+void nodes_check_online(void);
+
 #endif
--- a/www/crontasks.php	Sun May 26 20:45:01 2019 +0200
+++ b/www/crontasks.php	Thu May 30 23:18:48 2019 +0200
@@ -519,7 +519,7 @@
      */
     if ($savethis == 1) {
     	$sql2 = "UPDATE products SET inventory_reduced=".$row['inventory_reduced']." WHERE uuid = '" . $row['uuid'] . "';";
-//    	syslog(LOG_NOTICE, $sql2);
+    	syslog(LOG_NOTICE, $sql2);
     	$result2 = mysqli_query($connect, $sql2);
     	$ar = mysqli_affected_rows($connect);
 	if ($ar != 1) {
--- a/www/jqwidgets/styles/jqx.ui-mbse.css	Sun May 26 20:45:01 2019 +0200
+++ b/www/jqwidgets/styles/jqx.ui-mbse.css	Thu May 30 23:18:48 2019 +0200
@@ -89,7 +89,8 @@
 .jqx-input-button-content-ui-mbse{font-size:10px}
 .jqx-input-icon-ui-mbse{margin-left:2px; margin-top:-1px}
 .jqx-checkbox-check-checked-ui-mbse{margin-top:0px; background-position:-65px -147px; background-image:url(images/darkness/ui-icons_cccccc_256x240.png)}
-.jqx-grid-cell-sort-ui-mbse, .jqx-grid-cell-filter-ui-mbse, .jqx-grid-cell-pinned-ui-mbse{background-color:#626262;}
+/*.jqx-grid-cell-sort-ui-mbse, */
+.jqx-grid-cell-filter-ui-mbse, .jqx-grid-cell-pinned-ui-mbse{background-color:#626262;}
 .jqx-grid-cell-alt-ui-mbse, .jqx-grid-cell-sort-alt-ui-mbse, .jqx-grid-cell-filter-alt-ui-mbse{background-color:#626262}
 .jqx-splitter-collapse-button-horizontal-ui-mbse, .jqx-splitter-collapse-button-vertical-ui-mbse{ background:#ec8e0c; border:1px solid #fdd02e}
 .jqx-dropdownlist-content-ui-mbse{ color:#fff}
--- a/www/js/mon_fermenter.js	Sun May 26 20:45:01 2019 +0200
+++ b/www/js/mon_fermenter.js	Thu May 30 23:18:48 2019 +0200
@@ -169,7 +169,7 @@
 		value: 0,
 		colorScheme: 'scheme05',
 		easing: 'easeOutBack',
-		animationDuration: 1200
+		animationDuration: 600
 	};
 	var gaugeSmalloptions = {
 		min: -15, max: 25, width: 190, height: 190,
@@ -183,7 +183,7 @@
 		value: 0,
 		colorScheme: 'scheme05',
 		easing: 'easeOutBack',
-		animationDuration: 1200,
+		animationDuration: 400,
 		caption: { value: 'Chiller', position: 'bottom', offset: [0, 10] }
 	};
 	$("#gaugeContainer_air").jqxGauge( gaugeoptions );
--- 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 });
--- a/www/js/rec_edit.js	Sun May 26 20:45:01 2019 +0200
+++ b/www/js/rec_edit.js	Thu May 30 23:18:48 2019 +0200
@@ -362,8 +362,8 @@
 					        row.h_useat, parseFloat(row.h_amount));
 		}
 		total_ibus = Math.round(total_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)
@@ -1776,6 +1776,7 @@
 			height: 470,
 			source: fermentableAdapter,
 			theme: theme,
+			sortmode: "many",
 			selectionmode: 'singlerow',
 			showtoolbar: true,
 			rendertoolbar: function (toolbar) {
@@ -1894,6 +1895,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');
 			},
@@ -1995,6 +2001,7 @@
                         height: 560,
                         source: hopAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -2067,6 +2074,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');
 			},
@@ -2245,6 +2258,7 @@
                         height: 575,
                         source: miscAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -2301,6 +2315,11 @@
                                 });
                         },
 			ready: function() {
+				var datainformation = $('#miscGrid').jqxGrid('getdatainformation');
+				if (datainformation.rowscount) {
+					$("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
+					$("#miscGrid").jqxGrid('sortby', 'm_type', 'asc');
+				}
 				$('#jqxTabs').jqxTabs('next');
 			},
 			columns: [
@@ -2405,6 +2424,7 @@
                         height: 350,
                         source: yeastAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -2472,6 +2492,10 @@
                                 });
                         },
 			ready: function() {
+				var datainformation = $('#yeastGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
+				}
 				calcFermentables();
 				$('#jqxTabs').jqxTabs('next');
 			},
@@ -2789,42 +2813,68 @@
 	$("#est_color2").jqxNumberInput( Show0dec );
 	$("#est_og2").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
 	$("#est_og2").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,
 		height: 300,
@@ -2838,7 +2888,6 @@
 	});
 	$("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#FermentableReady").click(function () {
-		$("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
 		// Recalc percentages
 		calcFermentables();
 		calcIBUs();
@@ -3037,7 +3086,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,
@@ -3051,7 +3113,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,
@@ -3066,7 +3141,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 });
@@ -3205,9 +3279,6 @@
 		modalOpacity: 0.40
 	});
 	$("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme });
-	$("#MiscReady").click(function () {
-		$("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
-	});
 	$("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 });
 	$("#wm_instock").jqxCheckBox({ theme: theme, height: 23 });
 	$("#wm_instock").on('change', function (event) {
@@ -3309,7 +3380,6 @@
 	$("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#YeastReady").click(function () {
 		calcFermentables();
-		$("#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