www/js/prod_edit.js

changeset 428
a5d4467c9201
parent 422
7943afc0fcde
child 432
99dcd8488b62
equal deleted inserted replaced
425:7671a5fc5171 428:a5d4467c9201
268 268
269 // Estimate total recipe OG. 269 // Estimate total recipe OG.
270 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size)); 270 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size));
271 $('#est_og').val(dataRecord.est_og); 271 $('#est_og').val(dataRecord.est_og);
272 $('#est_og2').val(dataRecord.est_og); 272 $('#est_og2').val(dataRecord.est_og);
273 var org = dataRecord.est_og;
273 274
274 // Estimate SG in kettle after boil 275 // Estimate SG in kettle after boil
275 aboil_sg = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size)); 276 aboil_sg = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size));
276 $('#est_og3').val(aboil_sg); 277 $('#est_og3').val(aboil_sg);
277 278
385 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og); 386 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
386 } 387 }
387 $('#est_fg').val(dataRecord.est_fg); 388 $('#est_fg').val(dataRecord.est_fg);
388 $('#est_fg2').val(dataRecord.est_fg); 389 $('#est_fg2').val(dataRecord.est_fg);
389 $('#est_fg3').val(dataRecord.est_fg); 390 $('#est_fg3').val(dataRecord.est_fg);
391 var fig = dataRecord.est_fg;
390 392
391 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg); 393 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg);
392 $("#est_abv").val(dataRecord.est_abv); 394 $("#est_abv").val(dataRecord.est_abv);
393 $("#est_abv2").val(dataRecord.est_abv); 395 $("#est_abv2").val(dataRecord.est_abv);
394 396
395 // Calculate the final svg if available use the real value. 397 // Calculate the final svg if available use the real value.
396 if ((dataRecord.stage >= 6) && (dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) { 398 if ((dataRecord.stage >= 6) && (dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) {
397 svg = 100 * (dataRecord.brew_fermenter_sg - dataRecord.fg) / (dataRecord.brew_fermenter_sg - 1); 399 svg = 100 * (dataRecord.brew_fermenter_sg - dataRecord.fg) / (dataRecord.brew_fermenter_sg - 1);
400 org = dataRecord.brew_fermenter_sg;
401 fig = dataRecord.fg;
398 } 402 }
399 403
400 $("#yeast_cells").val(initcells); 404 $("#yeast_cells").val(initcells);
401 $("#need_cells").val(getNeededYeastCells()); 405 $("#need_cells").val(getNeededYeastCells());
406
407 // Calculate the calories in kcal/l (from brouwhulp)
408 var alc = 1881.22 * fig * (org - fig) / (1.775 - org);
409 var sug = 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004);
410 $("#kcal").val(Math.round((alc + sug) / (12 * 0.0295735296)));
402 }; 411 };
403 412
404 function calcMash() { 413 function calcMash() {
405 414
406 if (!(rows = $('#mashGrid').jqxGrid('getrows'))) 415 if (!(rows = $('#mashGrid').jqxGrid('getrows')))
4435 $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'}); 4444 $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'});
4436 $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 }); 4445 $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 });
4437 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); 4446 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
4438 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); 4447 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 });
4439 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); 4448 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
4440 $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 }); 4449 $("#st_letter").jqxInput({ theme: theme, width: 90, height: 23 });
4441 $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'}); 4450 $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'});
4442 $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); 4451 $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 });
4443 $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); 4452 $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
4444 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); 4453 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 });
4445 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); 4454 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
4446 $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 4455 $("#st_category_number").jqxNumberInput(Smal0dec);
4447 4456
4448 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); 4457 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
4449 $("#est_og").jqxNumberInput( SGopts ); 4458 $("#est_og").jqxNumberInput( SGopts );
4450 $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); 4459 $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'});
4451 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); 4460 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
4458 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); 4467 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
4459 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); 4468 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
4460 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); 4469 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
4461 4470
4462 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); 4471 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
4463 $("#est_abv").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 4472 $("#est_abv").jqxNumberInput(Smal1dec);
4464 $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); 4473 $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'});
4465 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 4474 $("#st_abv_min").jqxNumberInput(Smal1dec);
4466 $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); 4475 $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'});
4467 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 4476 $("#st_abv_max").jqxNumberInput(Smal1dec);
4468 4477
4469 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); 4478 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
4470 $("#est_color").jqxNumberInput( Show0dec ); 4479 $("#est_color").jqxNumberInput( Show0dec );
4471 $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); 4480 $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'});
4472 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 4481 $("#st_color_min").jqxNumberInput(Smal0dec);
4473 $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); 4482 $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'});
4474 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 4483 $("#st_color_max").jqxNumberInput(Smal0dec);
4475 $("#color_method").jqxDropDownList({ 4484 $("#color_method").jqxDropDownList({
4476 theme: theme, 4485 theme: theme,
4477 source: ColorMethodAdapter, 4486 source: ColorMethodAdapter,
4478 valueMember: 'id', 4487 valueMember: 'id',
4479 displayMember: 'nl', 4488 displayMember: 'nl',
4480 width: 180, 4489 width: 180,
4481 height: 23, 4490 height: 23,
4482 autoDropDownHeight: true 4491 autoDropDownHeight: true
4483 }); 4492 });
4484
4485 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); 4493 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
4486 $("#est_ibu").jqxNumberInput( Show0dec ); 4494 $("#est_ibu").jqxNumberInput( Show0dec );
4487 $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); 4495 $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'});
4488 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 4496 $("#st_ibu_min").jqxNumberInput(Smal0dec);
4489 $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); 4497 $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'});
4490 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 4498 $("#st_ibu_max").jqxNumberInput(Smal0dec);
4491 $("#ibu_method").jqxDropDownList({ 4499 $("#ibu_method").jqxDropDownList({
4492 theme: theme, 4500 theme: theme,
4493 source: IBUmethodAdapter, 4501 source: IBUmethodAdapter,
4494 valueMember: 'id', 4502 valueMember: 'id',
4495 displayMember: 'nl', 4503 displayMember: 'nl',
4496 width: 180, 4504 width: 180,
4497 height: 23, 4505 height: 23,
4498 autoDropDownHeight: true, 4506 autoDropDownHeight: true,
4499 dropDownVerticalAlignment: 'top' 4507 dropDownVerticalAlignment: 'top'
4500 }); 4508 });
4501 4509 $("#kcal").jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' });
4510 $("#kcal").jqxNumberInput( Smal0dec );
4502 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); 4511 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' });
4503 $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 4512 $("#est_carb").jqxNumberInput(Smal1dec);
4504 $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); 4513 $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'});
4505 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 4514 $("#st_carb_min").jqxNumberInput(Smal1dec);
4506 $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); 4515 $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'});
4507 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 4516 $("#st_carb_max").jqxNumberInput(Smal1dec);
4508 4517
4509 // Tab 2, Equipment 4518 // Tab 2, Equipment
4510 $("#eq_name").jqxTooltip({ content: 'De naam van deze brouw apparatuur.' }); 4519 $("#eq_name").jqxTooltip({ content: 'De naam van deze brouw apparatuur.' });
4511 $("#eq_name").jqxInput({ theme: theme, width: 250, height: 23 }); 4520 $("#eq_name").jqxInput({ theme: theme, width: 250, height: 23 });
4512 $("#eq_boil_size").jqxTooltip({ content: 'Normaal kook volume in liters' }); 4521 $("#eq_boil_size").jqxTooltip({ content: 'Normaal kook volume in liters' });
4827 } 4836 }
4828 }); 4837 });
4829 4838
4830 // Tab 4, Hops 4839 // Tab 4, Hops
4831 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); 4840 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
4832 $("#est_ibu2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 4841 $("#est_ibu2").jqxNumberInput(Smal0dec);
4833 $("#hop_flavour").jqxProgressBar({ 4842 $("#hop_flavour").jqxProgressBar({
4834 width: 300, 4843 width: 300,
4835 height: 23, 4844 height: 23,
4836 theme: theme, 4845 theme: theme,
4837 showText: true, 4846 showText: true,
5143 5152
5144 // Tab 6, Yeasts 5153 // Tab 6, Yeasts
5145 $("#est_fg2").jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); 5154 $("#est_fg2").jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
5146 $("#est_fg2").jqxNumberInput( Show3dec ); 5155 $("#est_fg2").jqxNumberInput( Show3dec );
5147 $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); 5156 $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
5148 $("#est_abv2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 5157 $("#est_abv2").jqxNumberInput(Smal1dec);
5149 $("#yeast_cells").jqxNumberInput( Show1dec ); 5158 $("#yeast_cells").jqxNumberInput( Show1dec );
5150 $("#need_cells").jqxNumberInput( Show1dec ); 5159 $("#need_cells").jqxNumberInput( Show1dec );
5151 $("#plato_cells").jqxNumberInput( Show2dec ); 5160 $("#plato_cells").jqxNumberInput( Show2dec );
5152 $("#popupYeast").jqxWindow({ 5161 $("#popupYeast").jqxWindow({
5153 width: 800, 5162 width: 800,
5822 $('#package_infuse_notes').jqxTooltip({ content: 'Omschrijving van de extra toevoeging.' }); 5831 $('#package_infuse_notes').jqxTooltip({ content: 'Omschrijving van de extra toevoeging.' });
5823 $('#package_infuse_notes').jqxInput({ theme: theme, width: 640, height: 23 }); 5832 $('#package_infuse_notes').jqxInput({ theme: theme, width: 640, height: 23 });
5824 $('#package_abv').jqxTooltip({ content: 'De uiteindelijke hoeveelheid alcohol volume %.' }); 5833 $('#package_abv').jqxTooltip({ content: 'De uiteindelijke hoeveelheid alcohol volume %.' });
5825 $('#package_abv').jqxNumberInput( Show1dec ); 5834 $('#package_abv').jqxNumberInput( Show1dec );
5826 $("#st_carb_min2").jqxTooltip({ content: 'Het minimum aanbevolen koolzuur volume voor deze bierstijl.'}); 5835 $("#st_carb_min2").jqxTooltip({ content: 'Het minimum aanbevolen koolzuur volume voor deze bierstijl.'});
5827 $("#st_carb_min2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 5836 $("#st_carb_min2").jqxNumberInput(Smal1dec);
5828 $("#st_carb_max2").jqxTooltip({ content: 'Het maximum aamnevolen koolzuur volume voor deze bierstijl.'}); 5837 $("#st_carb_max2").jqxTooltip({ content: 'Het maximum aamnevolen koolzuur volume voor deze bierstijl.'});
5829 $("#st_carb_max2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 5838 $("#st_carb_max2").jqxNumberInput(Smal1dec);
5830 $("#bottle_amount").jqxTooltip({ content: 'De totale hoeveelheid te bottelen bier.' }); 5839 $("#bottle_amount").jqxTooltip({ content: 'De totale hoeveelheid te bottelen bier.' });
5831 $("#bottle_amount").jqxNumberInput( Spin1dec ); 5840 $("#bottle_amount").jqxNumberInput( Spin1dec );
5832 $("#keg_amount").jqxTooltip({ content: 'De totale hoeveelheid op fust te zetten bier.' }); 5841 $("#keg_amount").jqxTooltip({ content: 'De totale hoeveelheid op fust te zetten bier.' });
5833 $("#keg_amount").jqxNumberInput( Spin1dec ); 5842 $("#keg_amount").jqxNumberInput( Spin1dec );
5834 $("#bottle_carbonation").jqxTooltip({ content: 'Het gewenste CO2 volume in de flessen.' }); 5843 $("#bottle_carbonation").jqxTooltip({ content: 'Het gewenste CO2 volume in de flessen.' });

mercurial