www/js/prod_edit.js

changeset 258
943fbe0e9fd6
parent 256
4767a790d1f6
child 259
ffab9ba3f532
equal deleted inserted replaced
257:62e294ab94f5 258:943fbe0e9fd6
113 var addedS = 0; // Added sugars after boil 113 var addedS = 0; // Added sugars after boil
114 var addedmass = 0; // Added mass after boil 114 var addedmass = 0; // Added mass after boil
115 var mvol = 0; // mash volume 115 var mvol = 0; // mash volume
116 var colort = 0; // Colors srm * vol totals 116 var colort = 0; // Colors srm * vol totals
117 var my_100 = false; 117 var my_100 = false;
118 var mashtime = 0; // Total mash time
119 var mashtemp = 0; // Average mash temperature
118 120
119 if ((rows = $('#mashGrid').jqxGrid('getrows'))) { 121 if ((rows = $('#mashGrid').jqxGrid('getrows'))) {
120 for (var i = 0; i < rows.length; i++) { 122 for (var i = 0; i < rows.length; i++) {
121 var row = rows[i]; 123 var row = rows[i];
122 if (row.step_type == 0) // Infusion 124 if (row.step_type == 0) // Infusion
123 mvol += parseFloat(row.step_infuse_amount); 125 mvol += parseFloat(row.step_infuse_amount);
126 mashtime += row.step_time;
127 mashtemp += row.step_time * row.step_temp;
124 } 128 }
129 mashtemp = mashtemp / mashtime;
130 console.log("mash time:"+mashtime+" temp:"+mashtemp);
125 } 131 }
126 132
127 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { 133 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
128 return; // grid not yet loaded. 134 return; // grid not yet loaded.
129 } 135 }
189 var aboil_volume = parseFloat(dataRecord.batch_size); 195 var aboil_volume = parseFloat(dataRecord.batch_size);
190 if (dataRecord.brew_aboil_volume > 0) 196 if (dataRecord.brew_aboil_volume > 0)
191 aboil_volume = dataRecord.brew_aboil_volume / 1.04; // volume @ 20 degrees 197 aboil_volume = dataRecord.brew_aboil_volume / 1.04; // volume @ 20 degrees
192 dataRecord.brew_fermenter_volume = aboil_volume - dataRecord.brew_fermenter_tcloss + dataRecord.brew_fermenter_extrawater; 198 dataRecord.brew_fermenter_volume = aboil_volume - dataRecord.brew_fermenter_tcloss + dataRecord.brew_fermenter_extrawater;
193 $("#brew_fermenter_volume").val(dataRecord.brew_fermenter_volume); 199 $("#brew_fermenter_volume").val(dataRecord.brew_fermenter_volume);
200 // Estimated needed sparge water corrected for the temperature.
201 var spoelw = (dataRecord.boil_size - mash_infuse + (mashkg * my_grain_absorbtion) + dataRecord.eq_lauter_deadspace) * 1.03;
202 $("#brew_sparge_est").val(spoelw);
194 203
195 // Calculate SG in fermenter 204 // Calculate SG in fermenter
196 var ogx = dataRecord.brew_aboil_sg; 205 var ogx = dataRecord.brew_aboil_sg;
197 if (ogx < 1.002) 206 if (ogx < 1.002)
198 ogx = aboil_sg; 207 ogx = aboil_sg;
239 //console.log("mash kg: "+mashkg+" max: "+dataRecord.eq_mash_max+" perc: "+pmalts); 248 //console.log("mash kg: "+mashkg+" max: "+dataRecord.eq_mash_max+" perc: "+pmalts);
240 $("#perc_malts").jqxProgressBar('val', pmalts); 249 $("#perc_malts").jqxProgressBar('val', pmalts);
241 $("#perc_sugars").jqxProgressBar('val', psugar); 250 $("#perc_sugars").jqxProgressBar('val', psugar);
242 $("#perc_cara").jqxProgressBar('val', pcara); 251 $("#perc_cara").jqxProgressBar('val', pcara);
243 calcStage(); 252 calcStage();
253
254 // Calculate estimated svg.
255 svg = 77; // default.
256 var rows = $('#yeastGrid').jqxGrid('getrows');
257 for (var i = 0; i < rows.length; i++) {
258 var row = rows[i];
259 if (row.y_use == 0) // Primary
260 svg = parseFloat(row.y_attenuation);
261 }
262
263 if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) {
264 dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og);
265 } else {
266 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
267 }
268 $('#est_fg').val(dataRecord.est_fg);
269 $('#est_fg2').val(dataRecord.est_fg);
270 $('#est_fg3').val(dataRecord.est_fg);
271
272 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg);
273 $("#est_abv").val(dataRecord.est_abv);
274 $("#est_abv2").val(dataRecord.est_abv);
275
276 // Calculate the final svg if available use the real value.
277 if ((dataRecord.stage >= 6) && (dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) {
278 svg = 100 * (dataRecord.brew_fermenter_sg - dataRecord.fg) / (dataRecord.brew_fermenter_sg - 1);
279 console.log("real svg:"+svg);
280 }
281
244 }; 282 };
245 283
246 /* 284 /*
247 * Change OG of recipe but keep the water volumes. 285 * Change OG of recipe but keep the water volumes.
248 */ 286 */
270 var row = $("#fermentableGrid").jqxGrid('getrowdata', i); 308 var row = $("#fermentableGrid").jqxGrid('getrowdata', i);
271 var amount = row.f_percentage / 100 * totmass; 309 var amount = row.f_percentage / 100 * totmass;
272 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_amount", amount); 310 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_amount", amount);
273 } 311 }
274 } 312 }
275 };
276
277 function calcFG() {
278 var fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
279 dataRecord.est_fg = fg;
280 $('#est_fg').val(fg);
281 $('#est_fg2').val(fg);
282 }
283
284 function calcABV() {
285 var abv = abvol(dataRecord.est_og, dataRecord.est_fg);
286 $("#est_abv").val(abv);
287 $("#est_abv2").val(abv);
288 }; 313 };
289 314
290 function hopFlavourContribution(bt, vol, use, amount) { 315 function hopFlavourContribution(bt, vol, use, amount) {
291 var result; 316 var result;
292 317
339 hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), 364 hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size),
340 row.h_useat, parseFloat(row.h_amount)); 365 row.h_useat, parseFloat(row.h_amount));
341 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), 366 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size),
342 row.h_useat, parseFloat(row.h_amount)); 367 row.h_useat, parseFloat(row.h_amount));
343 } 368 }
344 total_ibus = Math.round(total_ibus); 369 total_ibus = Math.round(total_ibus * 10) / 10;
345 ferm_ibus = Math.round(ferm_ibus); 370 ferm_ibus = Math.round(ferm_ibus * 10) / 10;
371 hop_flavour = Math.round(hop_flavour * 100) / 10;
372 hop_aroma = Math.round(hop_aroma * 100) / 10;
373 if (hop_flavour > 100)
374 hop_flavour = 100;
375 if (hop_aroma > 100)
376 hop_aroma = 100;
346 console.log("calcIBUs(): " + total_ibus + " flavour: " + hop_flavour + " aroma: " + hop_aroma+" fermenter:"+ferm_ibus); 377 console.log("calcIBUs(): " + total_ibus + " flavour: " + hop_flavour + " aroma: " + hop_aroma+" fermenter:"+ferm_ibus);
347 dataRecord.est_ibu = total_ibus; 378 dataRecord.est_ibu = total_ibus;
348 $('#est_ibu').val(total_ibus); 379 $('#est_ibu').val(total_ibus);
349 $('#est_ibu2').val(total_ibus); 380 $('#est_ibu2').val(total_ibus);
350 $("#hop_flavour").jqxProgressBar('val', hop_flavour * 10); 381 $("#hop_flavour").jqxProgressBar('val', hop_flavour);
351 $("#hop_aroma").jqxProgressBar('val', hop_aroma * 10); 382 $("#hop_aroma").jqxProgressBar('val', hop_aroma);
352 $("#brew_fermenter_ibu").val(ferm_ibus); 383 $("#brew_fermenter_ibu").val(ferm_ibus);
353 calcStage(); 384 calcStage();
354 }; 385 };
355
356 function calcSVG() {
357 var rows = $('#yeastGrid').jqxGrid('getrows');
358 for (var i = 0; i < rows.length; i++) {
359 var row = rows[i];
360 if (row.y_use == 0) // Primary
361 svg = parseFloat(row.y_attenuation);
362 }
363 }
364 386
365 function calcMashEfficiency() { 387 function calcMashEfficiency() {
366 // console.log("calcMashEfficiency()"); 388 // console.log("calcMashEfficiency()");
367 var c = sg_to_plato(est_mash_sg); 389 var c = sg_to_plato(est_mash_sg);
368 var m = sg_to_plato(parseFloat($("#brew_mash_sg").jqxNumberInput('decimal'))); 390 var m = sg_to_plato(parseFloat($("#brew_mash_sg").jqxNumberInput('decimal')));
1392 $("#boil_size").val(Math.round(new_boil * 100) / 100); 1414 $("#boil_size").val(Math.round(new_boil * 100) / 100);
1393 $("#est_pre_vol").val(Math.round(new_boil * 1.04 * 100) / 100); 1415 $("#est_pre_vol").val(Math.round(new_boil * 1.04 * 100) / 100);
1394 dataRecord.batch_size = parseFloat(event.args.value); 1416 dataRecord.batch_size = parseFloat(event.args.value);
1395 calcFermentablesFromOG(parseFloat($("#est_og").jqxNumberInput('decimal'))); // Keep the OG 1417 calcFermentablesFromOG(parseFloat($("#est_og").jqxNumberInput('decimal'))); // Keep the OG
1396 calcFermentables(); 1418 calcFermentables();
1397 calcSVG();
1398 calcFG();
1399 calcABV();
1400 // TODO: adjust the hops, miscs, yeast, water. 1419 // TODO: adjust the hops, miscs, yeast, water.
1401 calcIBUs(); 1420 calcIBUs();
1402 }); 1421 });
1403 $('#boil_time').on('change', function (event) { 1422 $('#boil_time').on('change', function (event) {
1404 console.log("boil_time change:"+parseFloat(event.args.value)+" old:"+dataRecord.boil_time); 1423 console.log("boil_time change:"+parseFloat(event.args.value)+" old:"+dataRecord.boil_time);
1408 dataRecord.boil_time = parseFloat(event.args.value); 1427 dataRecord.boil_time = parseFloat(event.args.value);
1409 dataRecord.boil_size = new_boil; 1428 dataRecord.boil_size = new_boil;
1410 $("#est_pre_vol").val(Math.round(new_boil * 1.04 * 100) / 100); 1429 $("#est_pre_vol").val(Math.round(new_boil * 1.04 * 100) / 100);
1411 $("#boil_size").val(Math.round(new_boil * 100) / 100); 1430 $("#boil_size").val(Math.round(new_boil * 100) / 100);
1412 calcFermentables(); 1431 calcFermentables();
1413 calcSVG();
1414 calcFG();
1415 calcABV();
1416 // TODO: adjust the hops, miscs, yeast, water. 1432 // TODO: adjust the hops, miscs, yeast, water.
1417 calcIBUs(); 1433 calcIBUs();
1418 }); 1434 });
1419 $('#efficiency').on('change', function (event) { 1435 $('#efficiency').on('change', function (event) {
1420 console.log("efficiency change:"+event.args.value); 1436 console.log("efficiency change:"+event.args.value);
1421 calcFermentables(); 1437 calcFermentables();
1422 calcSVG();
1423 calcFG();
1424 calcABV();
1425 calcIBUs(); 1438 calcIBUs();
1426 }); 1439 });
1427 $('#est_og').on('change', function (event) { 1440 $('#est_og').on('change', function (event) {
1428 console.log("est_og change:"+event.args.value); 1441 console.log("est_og change:"+event.args.value);
1429 $('#est_og2').val(event.args.value); 1442 $('#est_og2').val(event.args.value);
1430 calcFermentablesFromOG(event.args.value); // Adjust fermentables amounts 1443 calcFermentablesFromOG(event.args.value); // Adjust fermentables amounts
1431 calcFermentables(); // Update the recipe details 1444 calcFermentables(); // Update the recipe details
1432 calcSVG();
1433 calcFG();
1434 calcABV(); // and ABV
1435 calcIBUs(); // and the IBU's. 1445 calcIBUs(); // and the IBU's.
1436 }); 1446 });
1437 $('#mash_ph').on('change', function (event) { 1447 $('#mash_ph').on('change', function (event) {
1438 dataRecord.mash_ph = parseFloat(event.args.value); 1448 dataRecord.mash_ph = parseFloat(event.args.value);
1439 calcWater(); 1449 calcWater();
1615 dataRecord.efficiency = datarecord.efficiency; 1625 dataRecord.efficiency = datarecord.efficiency;
1616 $("#efficiency").val(datarecord.efficiency); 1626 $("#efficiency").val(datarecord.efficiency);
1617 1627
1618 calcFermentablesFromOG(parseFloat($("#est_og").jqxNumberInput('decimal'))); // Keep the OG 1628 calcFermentablesFromOG(parseFloat($("#est_og").jqxNumberInput('decimal'))); // Keep the OG
1619 calcFermentables(); 1629 calcFermentables();
1620 calcSVG();
1621 calcABV();
1622 // TODO: adjust the hops, miscs, yeast, water. 1630 // TODO: adjust the hops, miscs, yeast, water.
1623 calcIBUs(); 1631 calcIBUs();
1624 } 1632 }
1625 }); 1633 });
1626 1634
1941 $("#est_og").val(dataRecord.est_og); 1949 $("#est_og").val(dataRecord.est_og);
1942 $("#est_og2").val(dataRecord.est_og); 1950 $("#est_og2").val(dataRecord.est_og);
1943 $("#est_og3").val(0); 1951 $("#est_og3").val(0);
1944 $("#est_fg").val(dataRecord.est_fg); 1952 $("#est_fg").val(dataRecord.est_fg);
1945 $("#est_fg2").val(dataRecord.est_fg); 1953 $("#est_fg2").val(dataRecord.est_fg);
1954 $("#est_fg3").val(dataRecord.est_fg);
1946 $("#est_color").val(dataRecord.est_color); 1955 $("#est_color").val(dataRecord.est_color);
1947 $("#est_color2").val(dataRecord.est_color); 1956 $("#est_color2").val(dataRecord.est_color);
1948 $("#est_abv").val(dataRecord.est_abv); 1957 $("#est_abv").val(dataRecord.est_abv);
1949 $("#color_method").val(dataRecord.color_method); 1958 $("#color_method").val(dataRecord.color_method);
1950 $("#est_ibu").val(dataRecord.est_ibu); 1959 $("#est_ibu").val(dataRecord.est_ibu);
2159 } 2168 }
2160 } else { 2169 } else {
2161 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100); 2170 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100);
2162 } 2171 }
2163 calcFermentables(); 2172 calcFermentables();
2164 calcSVG();
2165 calcFG();
2166 calcABV();
2167 calcIBUs(); 2173 calcIBUs();
2168 }); 2174 });
2169 }, 2175 },
2170 ready: function() { 2176 ready: function() {
2171 calcFermentables(); 2177 calcFermentables();
2172 $('#jqxTabs').jqxTabs('next'); 2178 $('#jqxTabs').jqxTabs('next');
2173 }, 2179 },
2174 columns: [ 2180 columns: [
2175 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name', 2181 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name',
2176 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { 2182 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) {
2728 var commit = $("#yeastGrid").jqxGrid('deleterow', id); 2734 var commit = $("#yeastGrid").jqxGrid('deleterow', id);
2729 } 2735 }
2730 }); 2736 });
2731 }, 2737 },
2732 ready: function() { 2738 ready: function() {
2733 calcSVG(); 2739 calcFermentables();
2734 $('#jqxTabs').jqxTabs('next'); 2740 $('#jqxTabs').jqxTabs('next');
2735 }, 2741 },
2736 columns: [ 2742 columns: [
2737 { text: 'Gist', datafield: 'y_name' }, 2743 { text: 'Gist', datafield: 'y_name' },
2738 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' }, 2744 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
2876 var commit = $("#mashGrid").jqxGrid('deleterow', id); 2882 var commit = $("#mashGrid").jqxGrid('deleterow', id);
2877 } 2883 }
2878 }); 2884 });
2879 }, 2885 },
2880 ready: function() { 2886 ready: function() {
2881 calcFG();
2882 calcInit(); 2887 calcInit();
2883 $('#jqxLoader').jqxLoader('close'); 2888 $('#jqxLoader').jqxLoader('close');
2884 $('#jqxTabs').jqxTabs('first'); 2889 $('#jqxTabs').jqxTabs('first');
2885 }, 2890 },
2886 columns: [ 2891 columns: [
2996 $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); 3001 $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'});
2997 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); 3002 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2998 $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); 3003 $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'});
2999 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); 3004 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
3000 3005
3001 $("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); 3006 $("#est_fg").jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
3002 $("#est_fg").jqxNumberInput( Show3dec ); 3007 $("#est_fg").jqxNumberInput( Show3dec );
3003 $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); 3008 $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'});
3004 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); 3009 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
3005 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); 3010 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
3006 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); 3011 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
3141 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme }); 3146 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme });
3142 $("#FermentableReady").click(function () { 3147 $("#FermentableReady").click(function () {
3143 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc'); 3148 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
3144 // Recalc percentages 3149 // Recalc percentages
3145 calcFermentables(); 3150 calcFermentables();
3146 calcSVG();
3147 calcFG();
3148 calcABV();
3149 calcIBUs(); 3151 calcIBUs();
3150 // Waters: yes there is impact. 3152 // Waters: yes there is impact.
3151 }); 3153 });
3152 $("#wf_name").jqxInput({ theme: theme, width: 320, height: 23 }); 3154 $("#wf_name").jqxInput({ theme: theme, width: 320, height: 23 });
3153 $("#wf_instock").jqxCheckBox({ theme: theme, height: 23 }); 3155 $("#wf_instock").jqxCheckBox({ theme: theme, height: 23 });
3583 } 3585 }
3584 } 3586 }
3585 }); 3587 });
3586 3588
3587 // Tab 6, Yeasts 3589 // Tab 6, Yeasts
3588 $("#est_fg2").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); 3590 $("#est_fg2").jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
3589 $("#est_fg2").jqxNumberInput( Show3dec ); 3591 $("#est_fg2").jqxNumberInput( Show3dec );
3590 $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); 3592 $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
3591 $("#est_abv2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 3593 $("#est_abv2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
3592 $("#popupYeast").jqxWindow({ 3594 $("#popupYeast").jqxWindow({
3593 width: 800, 3595 width: 800,
3600 cancelButton: $("#YeastReady"), 3602 cancelButton: $("#YeastReady"),
3601 modalOpacity: 0.40 3603 modalOpacity: 0.40
3602 }); 3604 });
3603 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme }); 3605 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme });
3604 $("#YeastReady").click(function () { 3606 $("#YeastReady").click(function () {
3605 calcSVG(); 3607 calcFermentables();
3606 calcFG();
3607 calcABV();
3608 $("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc'); 3608 $("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
3609 }); 3609 });
3610 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 }); 3610 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 });
3611 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 }); 3611 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 });
3612 $("#wy_product_id").jqxInput({ theme: theme, width: 320, height: 23 }); 3612 $("#wy_product_id").jqxInput({ theme: theme, width: 320, height: 23 });
3654 } else if (rowdata.y_form == 1) { 3654 } else if (rowdata.y_form == 1) {
3655 $("#wy_pmpt_amount").html("Gewicht gram:"); 3655 $("#wy_pmpt_amount").html("Gewicht gram:");
3656 } else { 3656 } else {
3657 $("#wy_pmpt_amount").html("Volume ml:"); 3657 $("#wy_pmpt_amount").html("Volume ml:");
3658 } 3658 }
3659 calcSVG(); 3659 calcFermentables();
3660 calcFG();
3661 calcABV();
3662 } 3660 }
3663 }); 3661 });
3664 $("#wy_amount").jqxNumberInput( Spin1dec ); 3662 $("#wy_amount").jqxNumberInput( Spin1dec );
3665 $('#wy_amount').on('change', function (event) { 3663 $('#wy_amount').on('change', function (event) {
3666 console.log("amount changed: "+event.args.value); 3664 console.log("amount changed: "+event.args.value);
3668 if (rowdata.y_form == 0) // Liquid 3666 if (rowdata.y_form == 0) // Liquid
3669 var amount = parseFloat(event.args.value); 3667 var amount = parseFloat(event.args.value);
3670 else 3668 else
3671 var amount = parseFloat(event.args.value) / 1000; 3669 var amount = parseFloat(event.args.value) / 1000;
3672 rowdata.y_amount = amount; 3670 rowdata.y_amount = amount;
3673 calcSVG(); 3671 calcFermentables();
3674 calcFG();
3675 calcABV();
3676 }); 3672 });
3677 $("#wy_use").jqxDropDownList({ 3673 $("#wy_use").jqxDropDownList({
3678 theme: theme, 3674 theme: theme,
3679 source: YeastUseAdapter, 3675 source: YeastUseAdapter,
3680 valueMember: 'id', 3676 valueMember: 'id',
3687 $("#wy_use").on('select', function (event) { 3683 $("#wy_use").on('select', function (event) {
3688 if (event.args) { 3684 if (event.args) {
3689 var index = event.args.index; 3685 var index = event.args.index;
3690 var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow); 3686 var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow);
3691 rowdata.y_use = index; 3687 rowdata.y_use = index;
3692 calcSVG(); 3688 calcFermentables();
3693 calcFG();
3694 calcABV();
3695 } 3689 }
3696 }); 3690 });
3697 3691
3698 // Tab 7, Mashing 3692 // Tab 7, Mashing
3699 $("#mash_name").jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' }); 3693 $("#mash_name").jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' });
4096 $("#brew_preboil_efficiency").jqxNumberInput( Show1dec ); 4090 $("#brew_preboil_efficiency").jqxNumberInput( Show1dec );
4097 $("#brew_aboil_efficiency").jqxTooltip({ content: 'Het bereikte rendement na het koken.' }); 4091 $("#brew_aboil_efficiency").jqxTooltip({ content: 'Het bereikte rendement na het koken.' });
4098 $("#brew_aboil_efficiency").jqxNumberInput( Show1dec ); 4092 $("#brew_aboil_efficiency").jqxNumberInput( Show1dec );
4099 $("#brew_sparge_temperature").jqxNumberInput( Spin1dec ); 4093 $("#brew_sparge_temperature").jqxNumberInput( Spin1dec );
4100 $("#brew_sparge_volume").jqxNumberInput( Spin1dec ); 4094 $("#brew_sparge_volume").jqxNumberInput( Spin1dec );
4095 $("#brew_sparge_est").jqxNumberInput( Show1dec );
4101 $("#brew_whirlpool9").jqxNumberInput( PosInt ); 4096 $("#brew_whirlpool9").jqxNumberInput( PosInt );
4102 $("#brew_whirlpool9").jqxNumberInput({ max: 120 }); 4097 $("#brew_whirlpool9").jqxNumberInput({ max: 120 });
4103 $("#brew_cooling_to").jqxNumberInput( Spin1dec ); 4098 $("#brew_cooling_to").jqxNumberInput( Spin1dec );
4104 $("#brew_sparge_ph").jqxNumberInput( SpinpH ); 4099 $("#brew_sparge_ph").jqxNumberInput( SpinpH );
4105 $("#brew_whirlpool7").jqxNumberInput( PosInt ); 4100 $("#brew_whirlpool7").jqxNumberInput( PosInt );
4160 $("#secondary_end_date").jqxTooltip({ content: 'De eind datum van de navergisting en het begin van het lageren.' }); 4155 $("#secondary_end_date").jqxTooltip({ content: 'De eind datum van de navergisting en het begin van het lageren.' });
4161 $("#secondary_end_date").jqxDateTimeInput( Dateopts ); 4156 $("#secondary_end_date").jqxDateTimeInput( Dateopts );
4162 $('#secondary_end_date').on('close', function (event) { calcStage(); }); 4157 $('#secondary_end_date').on('close', function (event) { calcStage(); });
4163 $("#tertiary_temp").jqxNumberInput( YeastT ); 4158 $("#tertiary_temp").jqxNumberInput( YeastT );
4164 $("#fg").jqxNumberInput( Spin3dec ); 4159 $("#fg").jqxNumberInput( Spin3dec );
4160 $("#est_fg3").jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
4161 $("#est_fg3").jqxNumberInput( Show3dec );
4165 $("#final_abv").jqxNumberInput( Show1dec ); 4162 $("#final_abv").jqxNumberInput( Show1dec );
4166 $("#final_svg").jqxNumberInput( Show1dec ); 4163 $("#final_svg").jqxNumberInput( Show1dec );
4167 $("#FLog").jqxButton({ template: "info", width: '150px', theme: theme }); 4164 $("#FLog").jqxButton({ template: "info", width: '150px', theme: theme });
4168 $("#FLog").click(function () { 4165 $("#FLog").click(function () {
4169 // Open log in a new tab. 4166 // Open log in a new tab.

mercurial