diff -r 7671a5fc5171 -r a5d4467c9201 www/js/prod_edit.js --- a/www/js/prod_edit.js Thu Jun 20 22:16:05 2019 +0200 +++ b/www/js/prod_edit.js Fri Jun 21 16:55:36 2019 +0200 @@ -270,6 +270,7 @@ dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size)); $('#est_og').val(dataRecord.est_og); $('#est_og2').val(dataRecord.est_og); + var org = dataRecord.est_og; // Estimate SG in kettle after boil aboil_sg = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size)); @@ -387,6 +388,7 @@ $('#est_fg').val(dataRecord.est_fg); $('#est_fg2').val(dataRecord.est_fg); $('#est_fg3').val(dataRecord.est_fg); + var fig = dataRecord.est_fg; dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg); $("#est_abv").val(dataRecord.est_abv); @@ -395,10 +397,17 @@ // Calculate the final svg if available use the real value. if ((dataRecord.stage >= 6) && (dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) { svg = 100 * (dataRecord.brew_fermenter_sg - dataRecord.fg) / (dataRecord.brew_fermenter_sg - 1); + org = dataRecord.brew_fermenter_sg; + fig = dataRecord.fg; } $("#yeast_cells").val(initcells); $("#need_cells").val(getNeededYeastCells()); + + // Calculate the calories in kcal/l (from brouwhulp) + var alc = 1881.22 * fig * (org - fig) / (1.775 - org); + var sug = 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004); + $("#kcal").val(Math.round((alc + sug) / (12 * 0.0295735296))); }; function calcMash() { @@ -4437,13 +4446,13 @@ $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); - $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 }); + $("#st_letter").jqxInput({ theme: theme, width: 90, height: 23 }); $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'}); $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); - $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); + $("#st_category_number").jqxNumberInput(Smal0dec); $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); $("#est_og").jqxNumberInput( SGopts ); @@ -4460,18 +4469,18 @@ $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); - $("#est_abv").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); + $("#est_abv").jqxNumberInput(Smal1dec); $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); - $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); + $("#st_abv_min").jqxNumberInput(Smal1dec); $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); - $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); + $("#st_abv_max").jqxNumberInput(Smal1dec); $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); $("#est_color").jqxNumberInput( Show0dec ); $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); - $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); + $("#st_color_min").jqxNumberInput(Smal0dec); $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); - $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); + $("#st_color_max").jqxNumberInput(Smal0dec); $("#color_method").jqxDropDownList({ theme: theme, source: ColorMethodAdapter, @@ -4481,13 +4490,12 @@ height: 23, autoDropDownHeight: true }); - $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); $("#est_ibu").jqxNumberInput( Show0dec ); $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); - $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); + $("#st_ibu_min").jqxNumberInput(Smal0dec); $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); - $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); + $("#st_ibu_max").jqxNumberInput(Smal0dec); $("#ibu_method").jqxDropDownList({ theme: theme, source: IBUmethodAdapter, @@ -4498,13 +4506,14 @@ autoDropDownHeight: true, dropDownVerticalAlignment: 'top' }); - + $("#kcal").jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' }); + $("#kcal").jqxNumberInput( Smal0dec ); $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); - $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); + $("#est_carb").jqxNumberInput(Smal1dec); $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); - $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); + $("#st_carb_min").jqxNumberInput(Smal1dec); $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); - $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); + $("#st_carb_max").jqxNumberInput(Smal1dec); // Tab 2, Equipment $("#eq_name").jqxTooltip({ content: 'De naam van deze brouw apparatuur.' }); @@ -4829,7 +4838,7 @@ // Tab 4, Hops $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); - $("#est_ibu2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); + $("#est_ibu2").jqxNumberInput(Smal0dec); $("#hop_flavour").jqxProgressBar({ width: 300, height: 23, @@ -5145,7 +5154,7 @@ $("#est_fg2").jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); $("#est_fg2").jqxNumberInput( Show3dec ); $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); - $("#est_abv2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); + $("#est_abv2").jqxNumberInput(Smal1dec); $("#yeast_cells").jqxNumberInput( Show1dec ); $("#need_cells").jqxNumberInput( Show1dec ); $("#plato_cells").jqxNumberInput( Show2dec ); @@ -5824,9 +5833,9 @@ $('#package_abv').jqxTooltip({ content: 'De uiteindelijke hoeveelheid alcohol volume %.' }); $('#package_abv').jqxNumberInput( Show1dec ); $("#st_carb_min2").jqxTooltip({ content: 'Het minimum aanbevolen koolzuur volume voor deze bierstijl.'}); - $("#st_carb_min2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); + $("#st_carb_min2").jqxNumberInput(Smal1dec); $("#st_carb_max2").jqxTooltip({ content: 'Het maximum aamnevolen koolzuur volume voor deze bierstijl.'}); - $("#st_carb_max2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); + $("#st_carb_max2").jqxNumberInput(Smal1dec); $("#bottle_amount").jqxTooltip({ content: 'De totale hoeveelheid te bottelen bier.' }); $("#bottle_amount").jqxNumberInput( Spin1dec ); $("#keg_amount").jqxTooltip({ content: 'De totale hoeveelheid op fust te zetten bier.' });