Hops inventory disable filter menu on some fields. Friendy display of stock inventory.

Fri, 25 Jan 2019 20:24:00 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 25 Jan 2019 20:24:00 +0100
changeset 203
e29b53962cd1
parent 202
64a9c935a66b
child 204
5df88c6dc903

Hops inventory disable filter menu on some fields. Friendy display of stock inventory.

www/js/inv_hops.js file | annotate | diff | comparison | revisions
--- a/www/js/inv_hops.js	Fri Jan 25 16:57:59 2019 +0100
+++ b/www/js/inv_hops.js	Fri Jan 25 20:24:00 2019 +0100
@@ -132,8 +132,6 @@
 			});
 		}
 	};
-	var srcType = [ "Bittering", "Aroma", "Both" ];
-	var srcForm = [ "Pellet", "Plug", "Leaf" ];
 	// initialize the input fields.
 	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
 	$("#alpha").jqxNumberInput( Perc1dec1 );
@@ -219,26 +217,33 @@
 		filterable: true,
 		filtermode: 'excel',
 		columns: [
-			{ text: 'Herkomst', datafield: 'origin', align: 'center', cellsalign: 'center', width: 150 },
-			{ text: 'Hop Naam', datafield: 'name' },
-			{ text: 'Soort', datafield: 'type', align: 'center', cellsalign: 'center', width: 90,
+			{ text: 'Herkomst', datafield: 'origin', width: 150 },
+			{ text: 'Hop Naam', datafield: 'name', menu: false },
+			{ text: 'Soort', datafield: 'type', align: 'center', menu: false, width: 90,
 			  cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
 				return "<div style='margin: 4px;' class='jqx-center-align'>" + HopTypeData[value].nl + "</div>";
 			  }
 			},
-			{ text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', width: 90,
+			{ text: 'Vorm', datafield: 'form', align: 'center', menu: false, width: 90,
 			  cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
 				return "<div style='margin: 4px;' class='jqx-center-align'>" + HopFormData[value].nl + "</div>";
 			  }
 		       	},
-			{ text: 'Alpha %', datafield: 'alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
-			{ text: 'Beta %', datafield: 'beta', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
-			{ text: 'Cohumuloon %%', datafield: 'cohumulone', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
-			{ text: 'HSI', datafield: 'hsi', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
-			{ text: 'Oogst datum', datafield: 'production_date', align: 'center', cellsalign: 'center', width: 100 },
-			{ text: 'Voor, gr.', datafield: 'inventory', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
-			{ text: 'Prijs /kg', datafield: 'cost', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'c2' },
-			{ text: 'Wijzig', datafield: 'Wijzig', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
+			{ text: 'Alpha %', datafield: 'alpha', width: 80, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' },
+			{ text: 'Beta %', datafield: 'beta', width: 80, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' },
+			{ text: 'Cohumuloon %%', datafield: 'cohumulone', width: 80, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' },
+			{ text: 'HSI', datafield: 'hsi', width: 60, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'f1' },
+			{ text: 'Oogst datum', datafield: 'production_date', align: 'center', cellsalign: 'center', menu: false, width: 110 },
+			{ text: 'Voorraad', datafield: 'inventory', width: 100, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'f1',
+			  cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
+				if (value == 0)
+					return "<div style='margin: 4px;' class='jqx-right-align'></div>";
+				if (value < 1000)
+					return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value,"f1")+" gr</div>";
+				return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value / 1000.0,"f1")+" kg</div>";
+			  }
+		       	},
+			{ text: 'Wijzig', datafield: 'Wijzig', columntype: 'button', width: 100, align: 'center', menu: false, cellsrenderer: function () {
 				return "Wijzig";
 				}, buttonclick: function (row) {
 					// open the popup window when the user clicks a button.

mercurial