diff -r 4a4cc3497a57 -r 0a5abea575a9 www/js/prod_edit.js --- a/www/js/prod_edit.js Wed Jan 02 14:49:17 2019 +0100 +++ b/www/js/prod_edit.js Wed Jan 02 17:34:53 2019 +0100 @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2018 + * Copyright (C) 2018-2019 * * Michiel Broek * @@ -985,6 +985,22 @@ $("#sparge_acid_amount").val(Acid); } + function calcFermentation() { + if (dataRecord.brew_fermenter_sg < 1.020) + return; + if ((dataRecord.primary_end_sg > 0.990) && (dataRecord.primary_end_sg < dataRecord.brew_fermenter_sg)) { + var primary_svg = 100 * (dataRecord.brew_fermenter_sg - dataRecord.primary_end_sg) / (dataRecord.brew_fermenter_sg - 1); + console.log("primary svg: "+primary_svg); + $("#primary_svg").val(primary_svg); + if ((dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) { + var final_svg = 100 * (dataRecord.brew_fermenter_sg - dataRecord.fg) / (dataRecord.brew_fermenter_sg - 1); + $("#final_svg").val(final_svg); + var ABV = abvol(dataRecord.brew_fermenter_sg, dataRecord.fg); + $("#final_abv").val(ABV); + } + } + } + function CarbCO2toS(CO2, T, SFactor) { // Calcuation of disolved CO2 in the beer. // Brewersfriend uses: 3.0378 - (0.050062 * temp) + (0.00026555 * temp^2) @@ -1210,6 +1226,7 @@ calcSparge(); }); + calcFermentation(); calcCarbonation(); $('#bottle_amount').on('change', function (event) { dataRecord.bottle_amount = parseFloat(event.args.value); @@ -1617,6 +1634,7 @@ // Header Naar gistvat $("#brew_fermenter_volume").val(dataRecord.brew_fermenter_volume); $("#brew_fermenter_sg").val(dataRecord.brew_fermenter_sg); + $("#brew_fermenter_sg2").val(dataRecord.brew_fermenter_sg); $("#brew_fermenter_ibu").val(dataRecord.brew_fermenter_ibu); $("#brew_aboil_ph").val(dataRecord.brew_aboil_ph); @@ -1635,6 +1653,14 @@ $("#brew_date_end").val(dataRecord.brew_date_end); $("#og").val(dataRecord.og); $("#fg").val(dataRecord.fg); + $("#primary_start_temp").val(dataRecord.primary_start_temp); + $("#primary_max_temp").val(dataRecord.primary_max_temp); + $("#primary_end_temp").val(dataRecord.primary_end_temp); + $("#primary_end_sg").val(dataRecord.primary_end_sg); + $("#primary_end_date").val(dataRecord.primary_end_date); + $("#secondary_temp").val(dataRecord.secondary_temp); + $("#secondary_end_date").val(dataRecord.secondary_end_date); + $("#tertiary_temp").val(dataRecord.tertiary_temp); $("#package_date").val(dataRecord.package_date); $("#bottle_amount").val(dataRecord.bottle_amount); $("#bottle_carbonation").val(dataRecord.bottle_carbonation); @@ -1689,6 +1715,7 @@ $("#est_og2").val(dataRecord.est_og); $("#est_og3").val(dataRecord.est_og); $("#est_fg").val(dataRecord.est_fg); + $("#est_fg2").val(dataRecord.est_fg); $("#est_color").val(dataRecord.est_color); $("#est_color2").val(dataRecord.est_color); $("#est_abv").val(dataRecord.est_abv); @@ -2807,6 +2834,7 @@ var fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, parseFloat(parseFloat($("#est_og").jqxNumberInput('decimal')))); dataRecord.est_fg = fg; $('#est_fg').val(fg); + $('#est_fg2').val(fg); calcInit(); $('#jqxLoader').jqxLoader('close'); $('#jqxTabs').jqxTabs('first'); @@ -2943,6 +2971,7 @@ $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); $("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); $("#est_fg").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 3, readOnly: true }); + $("#est_fg2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 70, height: 23, decimalDigits: 3, readOnly: true }); $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); @@ -3243,7 +3272,39 @@ // Tab 10, Fermentation // Note, fermentation temps changes must do calcCarbonation() + $("#brew_fermenter_sg2").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 3 }); + $("#primary_start_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 40, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); + $("#primary_max_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 40, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); + $("#primary_end_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 40, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); + $("#primary_end_sg").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0.990, max: 1.2, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); + $("#primary_svg").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); + $("#primary_end_date").jqxTooltip({ content: 'De eind datum van de hoofdvergisting en eventueel overhevelen.' }); + $("#primary_end_date").jqxDateTimeInput({ + theme: theme, + width: 150, + height: 23, + allowNullDate: true, + todayString: 'Vandaag', + clearString: 'Wissen', + showFooter: true, + formatString: 'yyyy-MM-dd' + }); + $("#secondary_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 40, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); + $("#secondary_end_date").jqxTooltip({ content: 'De eind datum van de navergisting en het begin van het lageren.' }); + $("#secondary_end_date").jqxDateTimeInput({ + theme: theme, + width: 150, + height: 23, + allowNullDate: true, + todayString: 'Vandaag', + clearString: 'Wissen', + showFooter: true, + formatString: 'yyyy-MM-dd' + }); + $("#tertiary_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 40, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); $("#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 }); // Tab 11, Packaging $("#package_date").jqxTooltip({ content: 'De verpakkings datum van dit bier.' }); @@ -3400,9 +3461,45 @@ eq_mash_volume: parseFloat($("#eq_mash_volume").jqxNumberInput('decimal')), eq_mash_max: parseFloat($("#eq_mash_max").jqxNumberInput('decimal')), eq_efficiency: parseFloat($("#eq_efficiency").jqxNumberInput('decimal')), - + brew_date_start: $("#brew_date_start").val(), + brew_mash_ph: parseFloat($("#brew_mash_ph").jqxNumberInput('decimal')), + brew_mash_sg: parseFloat($("#brew_mash_sg").jqxNumberInput('decimal')), + brew_sparge_temperature: parseFloat($("#brew_sparge_temperature").jqxNumberInput('decimal')), + brew_sparge_volume: parseFloat($("#brew_sparge_volume").jqxNumberInput('decimal')), + brew_sparge_ph: parseFloat($("#brew_sparge_ph").jqxNumberInput('decimal')), + brew_preboil_volume: parseFloat($("#brew_preboil_volume").jqxNumberInput('decimal')), + brew_preboil_sg: parseFloat($("#brew_preboil_sg").jqxNumberInput('decimal')), + brew_preboil_ph: parseFloat($("#brew_preboil_ph").jqxNumberInput('decimal')), + brew_aboil_volume: parseFloat($("#brew_aboil_volume").jqxNumberInput('decimal')), + brew_aboil_sg: parseFloat($("#brew_aboil_sg").jqxNumberInput('decimal')), + brew_aboil_ph: parseFloat($("#brew_aboil_ph").jqxNumberInput('decimal')), + brew_aboil_efficiency: parseFloat($("#brew_aboil_efficiency").jqxNumberInput('decimal')), + brew_cooling_method: $("#brew_cooling_method").val(), + brew_cooling_time: parseFloat($("#brew_cooling_time").jqxNumberInput('decimal')), + brew_cooling_to: parseFloat($("#brew_cooling_to").jqxNumberInput('decimal')), + brew_whirlpool9: parseFloat($("#brew_whirlpool9").jqxNumberInput('decimal')), + brew_whirlpool7: parseFloat($("#brew_whirlpool7").jqxNumberInput('decimal')), + brew_whirlpool6: parseFloat($("#brew_whirlpool6").jqxNumberInput('decimal')), + brew_whirlpool2: parseFloat($("#brew_whirlpool2").jqxNumberInput('decimal')), + brew_fermenter_volume: parseFloat($("#brew_fermenter_volume").jqxNumberInput('decimal')), + brew_fermenter_extrawater: parseFloat($("#brew_fermenter_extrawater").jqxNumberInput('decimal')), + brew_aeration_time: parseFloat($("#brew_aeration_time").jqxNumberInput('decimal')), + brew_aeration_speed: parseFloat($("#brew_aeration_speed").jqxNumberInput('decimal')), + brew_aeration_type: $("#brew_aeration_type").val(), + brew_fermenter_sg: parseFloat($("#brew_fermenter_sg").jqxNumberInput('decimal')), + brew_fermenter_ibu: parseFloat($("#brew_fermenter_ibu").jqxNumberInput('decimal')), + brew_date_end: $("#brew_date_end").val(), + brew_log_available: $("#brew_log_available").val(), og: dataRecord.og, fg: parseFloat($("#fg").jqxNumberInput('decimal')), + primary_start_temp: parseFloat($("#primary_start_temp").jqxNumberInput('decimal')), + primary_max_temp: parseFloat($("#primary_max_temp").jqxNumberInput('decimal')), + primary_end_temp: parseFloat($("#primary_end_temp").jqxNumberInput('decimal')), + primary_end_sg: parseFloat($("#primary_end_sg").jqxNumberInput('decimal')), + primary_end_date: $("#primary_end_date").val(), + secondary_temp: parseFloat($("#secondary_temp").jqxNumberInput('decimal')), + secondary_end_date: $("#secondary_end_date").val(), + tertiary_temp: parseFloat($("#tertiary_temp").jqxNumberInput('decimal')), package_date: $("#package_date").val(), bottle_amount: parseFloat($("#bottle_amount").jqxNumberInput('decimal')), bottle_carbonation: parseFloat($("#bottle_carbonation").jqxNumberInput('decimal')),