www/js/prod_edit.js

changeset 240
a85c1d4c4d12
parent 237
9337b5ff8698
child 241
e95d2886f49f
equal deleted inserted replaced
239:03e81378182d 240:a85c1d4c4d12
130 $("#wf_amount").jqxNumberInput({ width: 90, readOnly: true, spinButtons: false }); 130 $("#wf_amount").jqxNumberInput({ width: 90, readOnly: true, spinButtons: false });
131 } else { 131 } else {
132 $("#wf_amount").jqxNumberInput({ width: 110, readOnly: false, spinButtons: true }); 132 $("#wf_amount").jqxNumberInput({ width: 110, readOnly: false, spinButtons: true });
133 } 133 }
134 var est_og = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size)); 134 var est_og = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size));
135 dataRecord.est_og = est_og;
135 $('#est_og').val(est_og); 136 $('#est_og').val(est_og);
136 $('#est_og2').val(est_og); 137 $('#est_og2').val(est_og);
137 $('#est_og3').val(est_og); 138 $('#est_og3').val(est_og);
138 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size)); 139 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size));
139 var color = kw_to_ebc(dataRecord.color_method, colorw); 140 var color = kw_to_ebc(dataRecord.color_method, colorw);
141 dataRecord.est_color = color;
140 $('#est_color').val(color); 142 $('#est_color').val(color);
141 $('#est_color2').val(color); 143 $('#est_color2').val(color);
142 var scolor = ebc_to_color(color); 144 var scolor = ebc_to_color(color);
143 document.getElementById("bcolor").style.background= scolor; 145 document.getElementById("bcolor").style.background= scolor;
144 document.getElementById("bcolor2").style.background= scolor; 146 document.getElementById("bcolor2").style.background= scolor;
145 pmalts = mashkg / dataRecord.eq_mash_max * 100; 147 pmalts = mashkg / dataRecord.eq_mash_max * 100;
146 // console.log("mash kg: "+mashkg+" max: "+dataRecord.eq_mash_max+" perc: "+pmalts); 148 // console.log("mash kg: "+mashkg+" max: "+dataRecord.eq_mash_max+" perc: "+pmalts);
147 $("#perc_malts").jqxProgressBar('val', pmalts); 149 $("#perc_malts").jqxProgressBar('val', pmalts);
148 $("#perc_sugars").jqxProgressBar('val', psugar); 150 $("#perc_sugars").jqxProgressBar('val', psugar);
149 $("#perc_cara").jqxProgressBar('val', pcara); 151 $("#perc_cara").jqxProgressBar('val', pcara);
152 calcStage();
150 }; 153 };
151 154
152 function calcFermentablesFromOG(OG) { 155 function calcFermentablesFromOG(OG) {
153 156
154 console.log("calcFermentablesFromOG("+OG+")"); 157 console.log("calcFermentablesFromOG("+OG+")");
274 dataRecord.est_ibu = total_ibus; 277 dataRecord.est_ibu = total_ibus;
275 $('#est_ibu').val(total_ibus); 278 $('#est_ibu').val(total_ibus);
276 $('#est_ibu2').val(total_ibus); 279 $('#est_ibu2').val(total_ibus);
277 $("#hop_flavour").jqxProgressBar('val', hop_flavour * 10); 280 $("#hop_flavour").jqxProgressBar('val', hop_flavour * 10);
278 $("#hop_aroma").jqxProgressBar('val', hop_aroma * 10); 281 $("#hop_aroma").jqxProgressBar('val', hop_aroma * 10);
282 calcStage();
279 }; 283 };
280 284
281 function calcSVG() { 285 function calcSVG() {
282 var rows = $('#yeastGrid').jqxGrid('getrows'); 286 var rows = $('#yeastGrid').jqxGrid('getrows');
283 for (var i = 0; i < rows.length; i++) { 287 for (var i = 0; i < rows.length; i++) {
1089 1093
1090 function calcStage() { 1094 function calcStage() {
1091 1095
1092 var newstage = dataRecord.stage; 1096 var newstage = dataRecord.stage;
1093 1097
1098 if (newstage < 1 && dataRecord.est_og > 1.005 && dataRecord.est_color > 3 && dataRecord.est_ibu > 3)
1099 newstage = 1;
1094 if (newstage < 2 && dataRecord.brew_date_start != '') 1100 if (newstage < 2 && dataRecord.brew_date_start != '')
1095 newstage = 2; // Brewday 1101 newstage = 2; // Brewday
1096 if (newstage < 3 && dataRecord.brew_date_end != '') 1102 if (newstage < 3 && dataRecord.brew_date_end != '')
1097 newstage = 3; // Primary 1103 newstage = 3; // Primary
1098 if (newstage < 4 && dataRecord.primary_end_date != '') 1104 if (newstage < 4 && dataRecord.primary_end_date != '')
1123 newstage = 9; 1129 newstage = 9;
1124 } 1130 }
1125 if (newstage < 10 && dataRecord.taste_date != '') 1131 if (newstage < 10 && dataRecord.taste_date != '')
1126 newstage = 10; // Ready 1132 newstage = 10; // Ready
1127 1133
1128 1134 if (newstage > dataRecord.stage) {
1129 console.log("calcStage() now: "+dataRecord.stage+" new: "+newstage); 1135 console.log("calcStage() old: "+dataRecord.stage+" new: "+newstage);
1136 dataRecord.stage = newstage;
1137 }
1130 1138
1131 /* 1139 /*
1132 * Set stage and enable or disable parts of the screens. 1140 * Set stage and enable or disable parts of the screens.
1133 */ 1141 */
1134 $("#stage").val(StageData[dataRecord.stage].nl); 1142 $("#stage").val(StageData[dataRecord.stage].nl);
1142 if (dataRecord.stage > 1) 1150 if (dataRecord.stage > 1)
1143 $("#equipmentSelect").jqxDropDownList({ disabled: true }); 1151 $("#equipmentSelect").jqxDropDownList({ disabled: true });
1144 if (dataRecord.stage > 0) { 1152 if (dataRecord.stage > 0) {
1145 $("#Delete").jqxButton({ disabled: true }); 1153 $("#Delete").jqxButton({ disabled: true });
1146 } 1154 }
1155
1156 if (dataRecord.stage < 1) // Planning, no ingredients
1157 $('#jqxTabs').jqxTabs('disableAt', 8); // Brewday tab
1158 else
1159 $('#jqxTabs').jqxTabs('enableAt', 8);
1160
1147 if (dataRecord.stage < 3) { // Primary 1161 if (dataRecord.stage < 3) { // Primary
1148 $('#jqxTabs').jqxTabs('disableAt', 9); // Fermentation tab 1162 $('#jqxTabs').jqxTabs('disableAt', 9); // Fermentation tab
1149 // If recipe not complete, disable 8 too.
1150 } else { 1163 } else {
1151 $('#jqxTabs').jqxTabs('enableAt', 9); 1164 $('#jqxTabs').jqxTabs('enableAt', 9);
1152 } 1165 }
1153 if (dataRecord.stage < 4) { // At least primary 1166 if (dataRecord.stage < 4) { // At least primary
1154 $('#jqxTabs').jqxTabs('disableAt', 10); // Packaging tab 1167 $('#jqxTabs').jqxTabs('disableAt', 10); // Packaging tab
1794 $("#st_name").val(dataRecord.st_name); 1807 $("#st_name").val(dataRecord.st_name);
1795 $("#st_letter").val(dataRecord.st_letter); 1808 $("#st_letter").val(dataRecord.st_letter);
1796 $("#st_guide").val(dataRecord.st_guide); 1809 $("#st_guide").val(dataRecord.st_guide);
1797 $("#st_category").val(dataRecord.st_category); 1810 $("#st_category").val(dataRecord.st_category);
1798 $("#st_category_number").val(dataRecord.st_category_number); 1811 $("#st_category_number").val(dataRecord.st_category_number);
1799 $("#st_type").val(dataRecord.st_type); 1812 $("#st_type").val(StyleTypeData[dataRecord.st_type].nl);
1800 $("#st_og_min").val(dataRecord.st_og_min); 1813 $("#st_og_min").val(dataRecord.st_og_min);
1801 $("#st_og_max").val(dataRecord.st_og_max); 1814 $("#st_og_max").val(dataRecord.st_og_max);
1802 $("#st_fg_min").val(dataRecord.st_fg_min); 1815 $("#st_fg_min").val(dataRecord.st_fg_min);
1803 $("#st_fg_max").val(dataRecord.st_fg_max); 1816 $("#st_fg_max").val(dataRecord.st_fg_max);
1804 $("#st_abv_min").val(dataRecord.st_abv_min); 1817 $("#st_abv_min").val(dataRecord.st_abv_min);
2067 return "<div style='margin: 4px;'>" + AddedData[value].nl + "</div>"; 2080 return "<div style='margin: 4px;'>" + AddedData[value].nl + "</div>";
2068 } 2081 }
2069 }, 2082 },
2070 { text: 'Opbrengst', datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, 2083 { text: 'Opbrengst', datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
2071 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, 2084 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
2085 { text: 'Voorr. Kg', datafield: 'f_inventory', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
2072 { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, 2086 { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
2073 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }, 2087 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 },
2074 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { 2088 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
2075 return "Wijzig"; 2089 return "Wijzig";
2076 }, buttonclick: function (row) { 2090 }, buttonclick: function (row) {
2868 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); 2882 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
2869 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); 2883 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 });
2870 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); 2884 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
2871 $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 }); 2885 $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 });
2872 $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'}); 2886 $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'});
2873 $("#st_type").jqxInput({ theme: theme, width: 90, height: 23 }); 2887 $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 });
2874 $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); 2888 $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
2875 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); 2889 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 });
2876 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); 2890 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
2877 $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 2891 $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2878 2892

mercurial