www/js/prod_edit.js

changeset 331
8d7fad771dde
parent 322
167f3144210d
child 332
f0ca77097236
--- a/www/js/prod_edit.js	Mon Mar 11 16:37:57 2019 +0100
+++ b/www/js/prod_edit.js	Wed Mar 13 20:17:15 2019 +0100
@@ -3189,6 +3189,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', 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: 'Voorraad Kg', datafield: 'f_inventory', width: 120, align: 'right',
@@ -3200,7 +3201,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";
@@ -3211,6 +3220,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.
@@ -4316,6 +4326,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