diff -r 03e81378182d -r a85c1d4c4d12 www/js/prod_edit.js --- a/www/js/prod_edit.js Sun Feb 03 23:21:55 2019 +0100 +++ b/www/js/prod_edit.js Mon Feb 04 15:21:49 2019 +0100 @@ -132,11 +132,13 @@ $("#wf_amount").jqxNumberInput({ width: 110, readOnly: false, spinButtons: true }); } var est_og = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size)); + dataRecord.est_og = est_og; $('#est_og').val(est_og); $('#est_og2').val(est_og); $('#est_og3').val(est_og); preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size)); var color = kw_to_ebc(dataRecord.color_method, colorw); + dataRecord.est_color = color; $('#est_color').val(color); $('#est_color2').val(color); var scolor = ebc_to_color(color); @@ -147,6 +149,7 @@ $("#perc_malts").jqxProgressBar('val', pmalts); $("#perc_sugars").jqxProgressBar('val', psugar); $("#perc_cara").jqxProgressBar('val', pcara); + calcStage(); }; function calcFermentablesFromOG(OG) { @@ -276,6 +279,7 @@ $('#est_ibu2').val(total_ibus); $("#hop_flavour").jqxProgressBar('val', hop_flavour * 10); $("#hop_aroma").jqxProgressBar('val', hop_aroma * 10); + calcStage(); }; function calcSVG() { @@ -1091,6 +1095,8 @@ var newstage = dataRecord.stage; + if (newstage < 1 && dataRecord.est_og > 1.005 && dataRecord.est_color > 3 && dataRecord.est_ibu > 3) + newstage = 1; if (newstage < 2 && dataRecord.brew_date_start != '') newstage = 2; // Brewday if (newstage < 3 && dataRecord.brew_date_end != '') @@ -1125,8 +1131,10 @@ if (newstage < 10 && dataRecord.taste_date != '') newstage = 10; // Ready - - console.log("calcStage() now: "+dataRecord.stage+" new: "+newstage); + if (newstage > dataRecord.stage) { + console.log("calcStage() old: "+dataRecord.stage+" new: "+newstage); + dataRecord.stage = newstage; + } /* * Set stage and enable or disable parts of the screens. @@ -1144,9 +1152,14 @@ if (dataRecord.stage > 0) { $("#Delete").jqxButton({ disabled: true }); } + + if (dataRecord.stage < 1) // Planning, no ingredients + $('#jqxTabs').jqxTabs('disableAt', 8); // Brewday tab + else + $('#jqxTabs').jqxTabs('enableAt', 8); + if (dataRecord.stage < 3) { // Primary $('#jqxTabs').jqxTabs('disableAt', 9); // Fermentation tab - // If recipe not complete, disable 8 too. } else { $('#jqxTabs').jqxTabs('enableAt', 9); } @@ -1796,7 +1809,7 @@ $("#st_guide").val(dataRecord.st_guide); $("#st_category").val(dataRecord.st_category); $("#st_category_number").val(dataRecord.st_category_number); - $("#st_type").val(dataRecord.st_type); + $("#st_type").val(StyleTypeData[dataRecord.st_type].nl); $("#st_og_min").val(dataRecord.st_og_min); $("#st_og_max").val(dataRecord.st_og_max); $("#st_fg_min").val(dataRecord.st_fg_min); @@ -2069,6 +2082,7 @@ }, { 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: 'Voorr. Kg', datafield: 'f_inventory', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }, { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { @@ -2870,7 +2884,7 @@ $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 }); $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'}); - $("#st_type").jqxInput({ theme: theme, width: 90, height: 23 }); + $("#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.'});