83 if (row.f_added == "Mash") { |
85 if (row.f_added == "Mash") { |
84 d = parseFloat($("#efficiency").jqxNumberInput('decimal')) / 100 * d; |
86 d = parseFloat($("#efficiency").jqxNumberInput('decimal')) / 100 * d; |
85 sugarsm += d; |
87 sugarsm += d; |
86 } |
88 } |
87 sugarsf += d; |
89 sugarsf += d; |
88 colorw += row.f_amount * ebc_to_srm(row.f_color) / parseFloat($("#batch_size").jqxNumberInput('decimal')) * 8.34436; |
90 colorw += row.f_amount * ebc_to_srm(row.f_color) / g_batch_size * 8.34436; |
89 } |
91 } |
90 if (to_100 != my_100) |
92 if (to_100 != my_100) |
91 console.log("change to_100 to:"+my_100); |
93 console.log("change to_100 to:"+my_100); |
92 to_100 = my_100; |
94 to_100 = my_100; |
93 $('#est_og').val(estimate_sg(sugarsf, parseFloat($("#batch_size").jqxNumberInput('decimal')))); |
95 $('#est_og').val(estimate_sg(sugarsf, g_batch_size)); |
94 preboil_sg = estimate_sg(sugarsm, parseFloat($("#boil_size").jqxNumberInput('decimal'))); |
96 preboil_sg = estimate_sg(sugarsm, parseFloat($("#boil_size").jqxNumberInput('decimal'))); |
95 $('#est_color').val(kw_to_ebc($("#color_method").val(), colorw)); |
97 $('#est_color').val(kw_to_ebc($("#color_method").val(), colorw)); |
96 }; |
98 }; |
97 |
99 |
98 function calcIBUs() { |
100 function calcIBUs() { |
146 $('#color_method').on('change', function (event) { calcFermentables(); }); |
148 $('#color_method').on('change', function (event) { calcFermentables(); }); |
147 $('#ibu_method').on('change', function (event) { |
149 $('#ibu_method').on('change', function (event) { |
148 calcFermentables(); |
150 calcFermentables(); |
149 calcIBUs(); |
151 calcIBUs(); |
150 }); |
152 }); |
151 // $('#efficiency').on('change', function (event) { calcFermentables(); }); |
153 $('#batch_size').on('change', function (event) { |
152 // $('#batch_size').on('change', function (event) { calcFermentables(); }); |
154 console.log("batch_size change:"+event.args.value+" old:"+g_batch_size); |
153 // $('#boil_time').on('change', function (event) { calcFermentables(); }); |
155 var new_boil = Math.round((parseFloat(event.args.value) + parseFloat($("#boil_size").jqxNumberInput('decimal')) - g_batch_size) * 10) / 10; |
|
156 $("#boil_size").val(new_boil); |
|
157 calcFermentablesFromOG(parseFloat($("#est_og").jqxNumberInput('decimal'))); // Keep the OG |
|
158 calcFermentables(); |
|
159 calcABV(); |
|
160 // TODO: adjust the hops, miscs, yeast, water. |
|
161 calcIBUs(); |
|
162 }); |
|
163 $('#boil_time').on('change', function (event) { |
|
164 console.log("boil_time change:"+event.args.value); |
|
165 }); |
|
166 $('#efficiency').on('change', function (event) { |
|
167 console.log("efficiency change:"+event.args.value); |
|
168 calcFermentables(); |
|
169 calcABV(); |
|
170 calcIBUs(); |
|
171 }); |
|
172 $('#est_og').on('change', function (event) { |
|
173 console.log("est_og change:"+event.args.value); |
|
174 calcFermentablesFromOG(event.args.value); // Adjust fermentables amounts |
|
175 calcFermentables(); // Update the recipe details |
|
176 calcABV(); // and ABV |
|
177 calcIBUs(); // and the IBU's. |
|
178 }); |
154 }; |
179 }; |
155 |
180 |
156 // Styles dropdown list |
181 // Styles dropdown list |
157 var stylesUrl = "includes/db_profile_styles.php"; |
182 var stylesUrl = "includes/db_profile_styles.php"; |
158 var stylesSource = { |
183 var stylesSource = { |
1433 $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 125, height: 23, dropDownHeight: 95 }); |
1458 $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 125, height: 23, dropDownHeight: 95 }); |
1434 $("#batch_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: 'L', symbolPosition: 'right' }); |
1459 $("#batch_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: 'L', symbolPosition: 'right' }); |
1435 $("#boil_size").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 1, readOnly: true, symbol: 'L', symbolPosition: 'right' }); |
1460 $("#boil_size").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 1, readOnly: true, symbol: 'L', symbolPosition: 'right' }); |
1436 $("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 360, decimalDigits: 0, spinButtons: true }); |
1461 $("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 360, decimalDigits: 0, spinButtons: true }); |
1437 $("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 40, max: 100, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); |
1462 $("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 40, max: 100, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); |
1438 |
|
1439 $("#est_og").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 1.000, max: 1.200, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); |
1463 $("#est_og").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 1.000, max: 1.200, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); |
1440 $('#est_og').on('change', function (event) { |
|
1441 console.log("est_og change:"+event.args.value+" by:"+event.args.type); |
|
1442 calcFermentablesFromOG(event.args.value); // Adjust fermentables amounts |
|
1443 calcFermentables(); // Update the recipe details |
|
1444 calcABV(); // and ABV |
|
1445 calcIBUs(); // and the IBU's. |
|
1446 }); |
|
1447 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
1464 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
1448 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
1465 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
1449 |
1466 |
1450 $("#est_fg").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 3, readOnly: true }); |
1467 $("#est_fg").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 3, readOnly: true }); |
1451 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
1468 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |