www/js/rec_edit.js

changeset 331
8d7fad771dde
parent 317
454851b335ad
child 332
f0ca77097236
--- a/www/js/rec_edit.js	Mon Mar 11 16:37:57 2019 +0100
+++ b/www/js/rec_edit.js	Wed Mar 13 20:17:15 2019 +0100
@@ -1882,6 +1882,7 @@
 					return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + AddedData[value].nl + "</span>";
 				  }
 				},
+				{ text:'Maxinbatch', datafield: 'f_max_in_batch', hidden: true },
 				{ text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
 				{ text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
 				{ text: 'Voorr. Kg', datafield: 'f_inventory', width: 120, align: 'right',
@@ -1893,7 +1894,15 @@
 						color + ';">' +fermentableAdapter.formatNumber(value, "f3") + '</span>';
 				  }
 				},
-				{ text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
+				{ text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right',
+				  cellsrenderer:  function (row, columnfield, value, defaulthtml, columnproperties, rowdata) {
+					var color = '#ffffff';
+					if (value > rowdata.f_max_in_batch)
+						color = '#ff4040';
+					return  '<span style="margin: 4px; margin-top: 6px; float: right; color: ' +
+						color + ';">' +fermentableAdapter.formatNumber(value, "p1") + '</span>';
+				  }
+				},
 				{ text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 },
 				{ text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
 					return "Wijzig";
@@ -1903,6 +1912,7 @@
 						$("#wf_name").val(fermentableData.f_name);
 						$("#wf_amount").val(fermentableData.f_amount);
 						$("#wf_percentage").val(fermentableData.f_percentage);
+						$("#wf_max_in_batch").val(fermentableData.f_max_in_batch);
 						$("#wf_adjust_to_total_100").val(fermentableData.f_adjust_to_total_100);
 						$("#wf_added").val(fermentableData.f_added);
 						// show the popup window.
@@ -2912,6 +2922,7 @@
 		}
 
 	});
+	$("#wf_max_in_batch").jqxNumberInput( Show1dec );
 	$("#wf_adjust_to_total_100").jqxCheckBox({ theme: theme, width: 120, height: 23 });
 	$("#wf_adjust_to_total_100").on('checked', function (event) {
 		if (fermentableData.f_adjust_to_total_100 == 0) {

mercurial