www/js/prod_edit.js

changeset 171
48cf3ea270f8
parent 169
9a685ee91537
child 172
684c651dd165
--- a/www/js/prod_edit.js	Fri Jan 04 20:32:11 2019 +0100
+++ b/www/js/prod_edit.js	Fri Jan 04 21:51:59 2019 +0100
@@ -1259,6 +1259,9 @@
 			dataRecord.keg_carbonation_temp = parseFloat(event.args.value);
 			calcCarbonation();
 		});
+
+		$("#BLog").jqxButton({ disabled: (dataRecord.log_brew) ? false:true });
+		$("#FLog").jqxButton({ disabled: (dataRecord.log_fermentation) ? false:true });
 	};
 
 	$("#styleSelect").jqxDropDownList({
@@ -1549,8 +1552,6 @@
 			$("#birth").val(dataRecord.birth);
 			$("#stage").val(dataRecord.stage);
 			$("#notes").val(dataRecord.notes);
-			$("#log_brew").val(dataRecord.log_brew);
-			$("#log_fermentation").val(dataRecord.log_fermentation);
 			$("#inventory_reduced").val(dataRecord.inventory_reduced);
 			$("#locked").val(dataRecord.locked);
 			$("#eq_name").val(dataRecord.eq_name);
@@ -1749,14 +1750,8 @@
 			if (brewstage < 3) {
 				$('#jqxTabs').jqxTabs('disableAt', 9);
 				// If recipe not complete, disable 8 too.
-		//		$("#brew_log").jqxButton({ disabled: true });
-		//		$("#ferment_log").jqxButton({ disabled: true });
 			} else {
 				$('#jqxTabs').jqxTabs('enableAt', 9);
-		//		if (! dataRecord.log_brew)
-		//			$("#brew_log").jqxButton({ disabled: true });
-		//		if (! dataRecord.log_fermentation)
-		//			$("#ferment_log").jqxButton({ disabled: true });
 			}
 			if (brewstage < 4) { // At least primary
 				$('#jqxTabs').jqxTabs('disableAt', 10);
@@ -2876,8 +2871,6 @@
 	$("#birth").jqxInput({ theme: theme, width: 120, height: 23 });
 	$("#stage").jqxTooltip({ content: 'De productie fase van dit product.' });
 	$("#stage").jqxInput({ theme: theme, width: 100, height: 23 });
-	$("#log_brew").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled : true });
-	$("#log_fermentation").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled : true });
 	$("#inventory_reduced").jqxCheckBox({ theme: theme, width: 120, height: 23 });
 	$('#inventory_reduced').on('checked', function (event) {
 		// Call a script to do the work and block this.
@@ -3230,6 +3223,12 @@
 	$("#brew_fermenter_extrasugar").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 });
 	$("#brew_fermenter_ibu").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 });
 	$("#brew_fermenter_color").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 });
+	$("#BLog").jqxButton({ template: "info", width: '150px', theme: theme });
+	$("#BLog").click(function () {
+		// Open log in a new tab.
+		var url="log_brew.php?code=" + dataRecord.code;
+		window.open(url);
+	});
 
 	// Tab 10, Fermentation
 	// Note, fermentation temps changes must do calcCarbonation()
@@ -3266,6 +3265,12 @@
 	$("#fg").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 });
 	$("#final_abv").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
 	$("#final_svg").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+	$("#FLog").jqxButton({ template: "info", width: '150px', theme: theme });
+	$("#FLog").click(function () {
+		// Open log in a new tab.
+		var url="log_fermentation.php?code=" + dataRecord.code;
+		window.open(url);
+	});
 
 	// Tab 11, Packaging
 	$("#package_date").jqxTooltip({ content: 'De verpakkings datum van dit bier.' });
@@ -3394,8 +3399,8 @@
 			birth: $("#birth").val(),
 			stage: $("#stage").val(),
 			notes: $("#notes").val(),
-			log_brew: $("#log_brew").val(),
-			log_fermentation: $("#log_fermentation").val(),
+			log_brew: dataRecord.log_brew,
+			log_fermentation: dataRecord.log_fermentation,
 			inventory_reduced: $("#inventory_reduced").val(),
 			locked: $("#locked").val(),
 			eq_name: $("#eq_name").val(),

mercurial