www/js/rec_edit.js

changeset 428
a5d4467c9201
parent 406
0ad967f2d6ee
child 474
7b7df475e67d
equal deleted inserted replaced
425:7671a5fc5171 428:a5d4467c9201
269 269
270 // Estimate total recipe OG. 270 // Estimate total recipe OG.
271 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size)); 271 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size));
272 $('#est_og').val(dataRecord.est_og); 272 $('#est_og').val(dataRecord.est_og);
273 $('#est_og2').val(dataRecord.est_og); 273 $('#est_og2').val(dataRecord.est_og);
274 var org = dataRecord.est_og;
274 275
275 // Estimate SG in kettle before boil 276 // Estimate SG in kettle before boil
276 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size)); 277 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size));
277 278
278 // Color of the wort 279 // Color of the wort
316 } else { 317 } else {
317 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og); 318 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
318 } 319 }
319 $('#est_fg').val(dataRecord.est_fg); 320 $('#est_fg').val(dataRecord.est_fg);
320 $('#est_fg2').val(dataRecord.est_fg); 321 $('#est_fg2').val(dataRecord.est_fg);
322 var fig = dataRecord.est_fg;
321 323
322 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg); 324 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg);
323 $("#est_abv").val(dataRecord.est_abv); 325 $("#est_abv").val(dataRecord.est_abv);
324 $("#est_abv2").val(dataRecord.est_abv); 326 $("#est_abv2").val(dataRecord.est_abv);
327
328 // Calculate the calories in kcal/l (from brouwhulp)
329 var alc = 1881.22 * fig * (org - fig) / (1.775 - org);
330 var sug = 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004);
331 $("#kcal").val(Math.round((alc + sug) / (12 * 0.0295735296)));
325 }; 332 };
326 333
327 function hopFlavourContribution(bt, vol, use, amount) { 334 function hopFlavourContribution(bt, vol, use, amount) {
328 var result; 335 var result;
329 336
2807 $("#boil_time").jqxNumberInput({ min: 4, max: 360 }); 2814 $("#boil_time").jqxNumberInput({ min: 4, max: 360 });
2808 2815
2809 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); 2816 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
2810 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); 2817 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 });
2811 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); 2818 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
2812 $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 }); 2819 $("#st_letter").jqxInput({ theme: theme, width: 90, height: 23 });
2813 $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'}); 2820 $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'});
2814 $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 }); 2821 $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 });
2815 $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); 2822 $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
2816 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); 2823 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 });
2817 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); 2824 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
2818 $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 2825 $("#st_category_number").jqxNumberInput( Smal0dec );
2819 $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'}); 2826 $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'});
2820 $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); 2827 $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 });
2821 2828
2822 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); 2829 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
2823 $("#est_og").jqxNumberInput( SGopts ); 2830 $("#est_og").jqxNumberInput( SGopts );
2832 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); 2839 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2833 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); 2840 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
2834 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); 2841 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2835 2842
2836 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); 2843 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
2837 $("#est_abv").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 2844 $("#est_abv").jqxNumberInput( Smal1dec );
2838 $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); 2845 $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'});
2839 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 2846 $("#st_abv_min").jqxNumberInput( Smal1dec );
2840 $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); 2847 $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'});
2841 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 2848 $("#st_abv_max").jqxNumberInput( Smal1dec );
2842 2849
2843 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); 2850 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
2844 $("#est_color").jqxNumberInput( Show0dec ); 2851 $("#est_color").jqxNumberInput( Show0dec );
2845 $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); 2852 $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'});
2846 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 2853 $("#st_color_min").jqxNumberInput( Smal0dec );
2847 $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); 2854 $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'});
2848 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 2855 $("#st_color_max").jqxNumberInput( Smal0dec );
2849 $("#color_method").jqxDropDownList({ 2856 $("#color_method").jqxDropDownList({
2850 theme: theme, 2857 theme: theme,
2851 source: ColorMethodAdapter, 2858 source: ColorMethodAdapter,
2852 valueMember: 'id', 2859 valueMember: 'id',
2853 displayMember: 'nl', 2860 displayMember: 'nl',
2854 width: 180, 2861 width: 180,
2855 height: 23, 2862 height: 23,
2856 autoDropDownHeight: true 2863 autoDropDownHeight: true
2857 }); 2864 });
2858
2859 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); 2865 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
2860 $("#est_ibu").jqxNumberInput( Show0dec ); 2866 $("#est_ibu").jqxNumberInput( Show0dec );
2861 $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); 2867 $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'});
2862 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 2868 $("#st_ibu_min").jqxNumberInput( Smal0dec );
2863 $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); 2869 $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'});
2864 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 2870 $("#st_ibu_max").jqxNumberInput( Smal0dec );
2865 $("#ibu_method").jqxDropDownList({ 2871 $("#ibu_method").jqxDropDownList({
2866 theme: theme, 2872 theme: theme,
2867 source: IBUmethodAdapter, 2873 source: IBUmethodAdapter,
2868 valueMember: 'id', 2874 valueMember: 'id',
2869 displayMember: 'nl', 2875 displayMember: 'nl',
2870 width: 180, 2876 width: 180,
2871 height: 23, 2877 height: 23,
2872 autoDropDownHeight: true, 2878 autoDropDownHeight: true,
2873 dropDownVerticalAlignment: 'top' 2879 dropDownVerticalAlignment: 'top'
2874 }); 2880 });
2875 2881 $("#kcal").jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' });
2882 $("#kcal").jqxNumberInput( Smal0dec );
2876 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); 2883 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' });
2877 $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 2884 $("#est_carb").jqxNumberInput( Smal1dec );
2878 $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); 2885 $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'});
2879 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 2886 $("#st_carb_min").jqxNumberInput( Smal1dec );
2880 $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); 2887 $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'});
2881 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 2888 $("#st_carb_max").jqxNumberInput( Smal1dec );
2882 2889
2883 // Tab 2, Vergistbaar 2890 // Tab 2, Vergistbaar
2884 $("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); 2891 $("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
2885 $("#est_color2").jqxNumberInput( Show0dec ); 2892 $("#est_color2").jqxNumberInput( Show0dec );
2886 $("#est_og2").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); 2893 $("#est_og2").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
3161 } 3168 }
3162 }); 3169 });
3163 3170
3164 // Tab 3, Hoppen 3171 // Tab 3, Hoppen
3165 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); 3172 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
3166 $("#est_ibu2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 3173 $("#est_ibu2").jqxNumberInput( Smal0dec );
3167 $("#hop_flavour").jqxProgressBar({ 3174 $("#hop_flavour").jqxProgressBar({
3168 width: 300, 3175 width: 300,
3169 height: 23, 3176 height: 23,
3170 theme: theme, 3177 theme: theme,
3171 showText: true, 3178 showText: true,
3478 3485
3479 // Tab 5, Gist 3486 // Tab 5, Gist
3480 $("#est_fg2").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); 3487 $("#est_fg2").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
3481 $("#est_fg2").jqxNumberInput( Show3dec ); 3488 $("#est_fg2").jqxNumberInput( Show3dec );
3482 $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); 3489 $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
3483 $("#est_abv2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); 3490 $("#est_abv2").jqxNumberInput( Smal1dec );
3484 $("#popupYeast").jqxWindow({ 3491 $("#popupYeast").jqxWindow({
3485 width: 800, 3492 width: 800,
3486 height: 300, 3493 height: 300,
3487 position: { x: 230, y: 100 }, 3494 position: { x: 230, y: 100 },
3488 resizable: false, 3495 resizable: false,

mercurial