www/js/rec_edit.js

branch
stable
changeset 387
541503502b1b
parent 382
547c23b50d00
child 392
544d7d0183b2
equal deleted inserted replaced
377:6e80a5515dd3 387:541503502b1b
360 row.h_useat, parseFloat(row.h_amount)); 360 row.h_useat, parseFloat(row.h_amount));
361 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), 361 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size),
362 row.h_useat, parseFloat(row.h_amount)); 362 row.h_useat, parseFloat(row.h_amount));
363 } 363 }
364 total_ibus = Math.round(total_ibus * 10) / 10; 364 total_ibus = Math.round(total_ibus * 10) / 10;
365 hop_flavour = Math.round(hop_flavour * 100) / 10; 365 hop_flavour = Math.round(hop_flavour * 1000 / 5) / 10;
366 hop_aroma = Math.round(hop_aroma * 100) / 10; 366 hop_aroma = Math.round(hop_aroma * 1000 / 6) / 10;
367 if (hop_flavour > 100) 367 if (hop_flavour > 100)
368 hop_flavour = 100; 368 hop_flavour = 100;
369 if (hop_aroma > 100) 369 if (hop_aroma > 100)
370 hop_aroma = 100; 370 hop_aroma = 100;
371 console.log("calcIBUs(): " + total_ibus + " flavour: " + hop_flavour + " aroma: " + hop_aroma); 371 console.log("calcIBUs(): " + total_ibus + " flavour: " + hop_flavour + " aroma: " + hop_aroma);
1774 $("#fermentableGrid").jqxGrid({ 1774 $("#fermentableGrid").jqxGrid({
1775 width: 1240, 1775 width: 1240,
1776 height: 470, 1776 height: 470,
1777 source: fermentableAdapter, 1777 source: fermentableAdapter,
1778 theme: theme, 1778 theme: theme,
1779 sortmode: "many",
1779 selectionmode: 'singlerow', 1780 selectionmode: 'singlerow',
1780 showtoolbar: true, 1781 showtoolbar: true,
1781 rendertoolbar: function (toolbar) { 1782 rendertoolbar: function (toolbar) {
1782 var me = this; 1783 var me = this;
1783 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 1784 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
1892 calcFermentables(); 1893 calcFermentables();
1893 calcIBUs(); 1894 calcIBUs();
1894 }); 1895 });
1895 }, 1896 },
1896 ready: function() { 1897 ready: function() {
1898 var datainformation = $('#fermentableGrid').jqxGrid('getdatainformation');
1899 if (datainformation.rowscount) {
1900 $("#fermentableGrid").jqxGrid('sortby', 'f_added', 'asc');
1901 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
1902 }
1897 calcFermentables(); 1903 calcFermentables();
1898 $('#jqxTabs').jqxTabs('next'); 1904 $('#jqxTabs').jqxTabs('next');
1899 }, 1905 },
1900 columns: [ 1906 columns: [
1901 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name', 1907 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name',
1993 $("#hopGrid").jqxGrid({ 1999 $("#hopGrid").jqxGrid({
1994 width: 1240, 2000 width: 1240,
1995 height: 560, 2001 height: 560,
1996 source: hopAdapter, 2002 source: hopAdapter,
1997 theme: theme, 2003 theme: theme,
2004 sortmode: "many",
1998 selectionmode: 'singlerow', 2005 selectionmode: 'singlerow',
1999 showtoolbar: true, 2006 showtoolbar: true,
2000 rendertoolbar: function (toolbar) { 2007 rendertoolbar: function (toolbar) {
2001 var me = this; 2008 var me = this;
2002 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 2009 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2065 } 2072 }
2066 calcIBUs(); 2073 calcIBUs();
2067 }); 2074 });
2068 }, 2075 },
2069 ready: function() { 2076 ready: function() {
2077 var datainformation = $('#hopGrid').jqxGrid('getdatainformation');
2078 if (datainformation.rowscount) {
2079 $("#hopGrid").jqxGrid('sortby', 'h_useat', 'asc');
2080 $("#hopGrid").jqxGrid('sortby', 'h_time', 'desc');
2081 $("#hopGrid").jqxGrid('sortby', 'h_amount', 'desc');
2082 }
2070 calcIBUs(); 2083 calcIBUs();
2071 $('#jqxTabs').jqxTabs('next'); 2084 $('#jqxTabs').jqxTabs('next');
2072 }, 2085 },
2073 columns: [ 2086 columns: [
2074 { text: 'Hop', datafield: 'h_name', 2087 { text: 'Hop', datafield: 'h_name',
2243 $("#miscGrid").jqxGrid({ 2256 $("#miscGrid").jqxGrid({
2244 width: 1240, 2257 width: 1240,
2245 height: 575, 2258 height: 575,
2246 source: miscAdapter, 2259 source: miscAdapter,
2247 theme: theme, 2260 theme: theme,
2261 sortmode: "many",
2248 selectionmode: 'singlerow', 2262 selectionmode: 'singlerow',
2249 showtoolbar: true, 2263 showtoolbar: true,
2250 rendertoolbar: function (toolbar) { 2264 rendertoolbar: function (toolbar) {
2251 var me = this; 2265 var me = this;
2252 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 2266 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2299 var commit = $("#miscGrid").jqxGrid('deleterow', id); 2313 var commit = $("#miscGrid").jqxGrid('deleterow', id);
2300 } 2314 }
2301 }); 2315 });
2302 }, 2316 },
2303 ready: function() { 2317 ready: function() {
2318 var datainformation = $('#miscGrid').jqxGrid('getdatainformation');
2319 if (datainformation.rowscount) {
2320 $("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
2321 $("#miscGrid").jqxGrid('sortby', 'm_type', 'asc');
2322 }
2304 $('#jqxTabs').jqxTabs('next'); 2323 $('#jqxTabs').jqxTabs('next');
2305 }, 2324 },
2306 columns: [ 2325 columns: [
2307 { text: 'Ingredient', datafield: 'm_name' }, 2326 { text: 'Ingredient', datafield: 'm_name' },
2308 { text: 'Type', width: 140, datafield: 'm_type', 2327 { text: 'Type', width: 140, datafield: 'm_type',
2403 $("#yeastGrid").jqxGrid({ 2422 $("#yeastGrid").jqxGrid({
2404 width: 1240, 2423 width: 1240,
2405 height: 350, 2424 height: 350,
2406 source: yeastAdapter, 2425 source: yeastAdapter,
2407 theme: theme, 2426 theme: theme,
2427 sortmode: "many",
2408 selectionmode: 'singlerow', 2428 selectionmode: 'singlerow',
2409 showtoolbar: true, 2429 showtoolbar: true,
2410 rendertoolbar: function (toolbar) { 2430 rendertoolbar: function (toolbar) {
2411 var me = this; 2431 var me = this;
2412 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 2432 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2470 var commit = $("#yeastGrid").jqxGrid('deleterow', id); 2490 var commit = $("#yeastGrid").jqxGrid('deleterow', id);
2471 } 2491 }
2472 }); 2492 });
2473 }, 2493 },
2474 ready: function() { 2494 ready: function() {
2495 var datainformation = $('#yeastGrid').jqxGrid('getdatainformation');
2496 if (datainformation.rowscount) {
2497 $("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
2498 }
2475 calcFermentables(); 2499 calcFermentables();
2476 $('#jqxTabs').jqxTabs('next'); 2500 $('#jqxTabs').jqxTabs('next');
2477 }, 2501 },
2478 columns: [ 2502 columns: [
2479 { text: 'Gist', datafield: 'y_name' }, 2503 { text: 'Gist', datafield: 'y_name' },
2787 // Tab 2, Vergistbaar 2811 // Tab 2, Vergistbaar
2788 $("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); 2812 $("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
2789 $("#est_color2").jqxNumberInput( Show0dec ); 2813 $("#est_color2").jqxNumberInput( Show0dec );
2790 $("#est_og2").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); 2814 $("#est_og2").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
2791 $("#est_og2").jqxNumberInput( Show3dec ); 2815 $("#est_og2").jqxNumberInput( Show3dec );
2792 $("#ferm_lintner").jqxTooltip({ content: 'De enzymkracht van alle mouten in de maisch. Moet hoger dan 35 zijn.' });
2793 $("#ferm_lintner").jqxNumberInput( Show0dec );
2794 $("#perc_malts").jqxProgressBar({ 2816 $("#perc_malts").jqxProgressBar({
2795 width: 300, 2817 width: 300,
2796 height: 23, 2818 height: 23,
2797 theme: theme, 2819 theme: theme,
2798 showText: true, 2820 showText: true,
2821 max: 120,
2799 animationDuration: 0, 2822 animationDuration: 0,
2800 colorRanges: [ 2823 colorRanges: [
2801 { stop: 90, color: '#008C00' }, 2824 { stop: 90, color: '#008C00' },
2802 { stop: 95, color: '#EB7331' }, 2825 { stop: 100, color: '#EB7331' },
2803 { stop: 100, color: '#FF0000' } 2826 { stop: 120, color: '#FF0000' }
2804 ] 2827 ],
2828 renderText: function (text) {
2829 return (Math.round(parseInt(text) * 1.2)) + '%';
2830 }
2805 }); 2831 });
2806 $("#perc_sugars").jqxProgressBar({ 2832 $("#perc_sugars").jqxProgressBar({
2807 width: 300, 2833 width: 300,
2808 height: 23, 2834 height: 23,
2809 theme: theme, 2835 theme: theme,
2810 showText: true, 2836 showText: true,
2837 max: 50,
2811 animationDuration: 0, 2838 animationDuration: 0,
2812 colorRanges: [ 2839 colorRanges: [
2813 { stop: 20, color: '#008C00' }, 2840 { stop: 20, color: '#008C00' },
2814 { stop: 100, color: '#FF0000' } 2841 { stop: 50, color: '#FF0000' }
2815 ] 2842 ],
2843 renderText: function (text) {
2844 return (Math.round(parseInt(text) * 5) / 10) + '%';
2845 }
2816 }); 2846 });
2817 $("#perc_cara").jqxProgressBar({ 2847 $("#perc_cara").jqxProgressBar({
2818 width: 300, 2848 width: 300,
2819 height: 23, 2849 height: 23,
2820 theme: theme, 2850 theme: theme,
2821 showText: true, 2851 showText: true,
2852 max: 50,
2822 animationDuration: 0, 2853 animationDuration: 0,
2823 colorRanges: [ 2854 colorRanges: [
2824 { stop: 25, color: '#008C00' }, 2855 { stop: 25, color: '#008C00' },
2825 { stop: 100, color: '#FF0000' } 2856 { stop: 50, color: '#FF0000' }
2826 ] 2857 ],
2827 }); 2858 renderText: function (text) {
2859 return (Math.round(parseInt(text) * 5) / 10) + '%';
2860 }
2861 });
2862 $("#ferm_lintner").jqxProgressBar({
2863 width: 300,
2864 height: 23,
2865 theme: theme,
2866 showText: true,
2867 max: 200,
2868 animationDuration: 0,
2869 colorRanges: [
2870 { stop: 30, color: '#FF0000' },
2871 { stop: 40, color: '#EB7331' },
2872 { stop: 200, color: '#008C00' }
2873 ],
2874 renderText: function (text) {
2875 return (parseInt(text) * 2) + ' lintner';
2876 }
2877 });
2828 $("#popupFermentable").jqxWindow({ 2878 $("#popupFermentable").jqxWindow({
2829 width: 800, 2879 width: 800,
2830 height: 300, 2880 height: 300,
2831 position: { x: 230, y: 100 }, 2881 position: { x: 230, y: 100 },
2832 resizable: false, 2882 resizable: false,
2836 cancelButton: $("#FermentableReady"), 2886 cancelButton: $("#FermentableReady"),
2837 modalOpacity: 0.40 2887 modalOpacity: 0.40
2838 }); 2888 });
2839 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme }); 2889 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme });
2840 $("#FermentableReady").click(function () { 2890 $("#FermentableReady").click(function () {
2841 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
2842 // Recalc percentages 2891 // Recalc percentages
2843 calcFermentables(); 2892 calcFermentables();
2844 calcIBUs(); 2893 calcIBUs();
2845 calcMash(); 2894 calcMash();
2846 // Waters: yes there is impact. 2895 // Waters: yes there is impact.
3035 { stop: 20, color: '#004D00' }, 3084 { stop: 20, color: '#004D00' },
3036 { stop: 40, color: '#008C00' }, 3085 { stop: 40, color: '#008C00' },
3037 { stop: 60, color: '#00BF00' }, 3086 { stop: 60, color: '#00BF00' },
3038 { stop: 80, color: '#00FF00' }, 3087 { stop: 80, color: '#00FF00' },
3039 { stop: 100, color: '#80FF80' } 3088 { stop: 100, color: '#80FF80' }
3040 ] 3089 ],
3090 renderText: function (text) {
3091 var val = parseInt(text);
3092 if (val < 20)
3093 return 'Weinig';
3094 else if (val < 40)
3095 return 'Matig';
3096 else if (val < 60)
3097 return 'Redelijk';
3098 else if (val < 80)
3099 return 'Veel';
3100 else
3101 return 'Zeer veel';
3102 }
3041 }); 3103 });
3042 $("#hop_aroma").jqxProgressBar({ 3104 $("#hop_aroma").jqxProgressBar({
3043 width: 300, 3105 width: 300,
3044 height: 23, 3106 height: 23,
3045 theme: theme, 3107 theme: theme,
3049 { stop: 20, color: '#004D00' }, 3111 { stop: 20, color: '#004D00' },
3050 { stop: 40, color: '#008C00' }, 3112 { stop: 40, color: '#008C00' },
3051 { stop: 60, color: '#00BF00' }, 3113 { stop: 60, color: '#00BF00' },
3052 { stop: 80, color: '#00FF00' }, 3114 { stop: 80, color: '#00FF00' },
3053 { stop: 100, color: '#80FF80' } 3115 { stop: 100, color: '#80FF80' }
3054 ] 3116 ],
3117 renderText: function (text) {
3118 var val = parseInt(text);
3119 if (val < 20)
3120 return 'Weinig';
3121 else if (val < 40)
3122 return 'Matig';
3123 else if (val < 60)
3124 return 'Redelijk';
3125 else if (val < 80)
3126 return 'Veel';
3127 else
3128 return 'Zeer veel';
3129 }
3055 }); 3130 });
3056 $("#popupHop").jqxWindow({ 3131 $("#popupHop").jqxWindow({
3057 width: 800, 3132 width: 800,
3058 height: 300, 3133 height: 300,
3059 position: { x: 230, y: 100 }, 3134 position: { x: 230, y: 100 },
3064 cancelButton: $("#HopReady"), 3139 cancelButton: $("#HopReady"),
3065 modalOpacity: 0.40 3140 modalOpacity: 0.40
3066 }); 3141 });
3067 $("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme }); 3142 $("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme });
3068 $("#HopReady").click(function () { 3143 $("#HopReady").click(function () {
3069 $("#hopGrid").jqxGrid('sortby', 'h_amount', 'asc');
3070 calcIBUs(); 3144 calcIBUs();
3071 }); 3145 });
3072 $("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 }); 3146 $("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 });
3073 $("#wh_instock").jqxCheckBox({ theme: theme, height: 23 }); 3147 $("#wh_instock").jqxCheckBox({ theme: theme, height: 23 });
3074 $("#wh_instock").on('change', function (event) { 3148 $("#wh_instock").on('change', function (event) {
3203 autoOpen: false, 3277 autoOpen: false,
3204 cancelButton: $("#MiscReady"), 3278 cancelButton: $("#MiscReady"),
3205 modalOpacity: 0.40 3279 modalOpacity: 0.40
3206 }); 3280 });
3207 $("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme }); 3281 $("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme });
3208 $("#MiscReady").click(function () {
3209 $("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
3210 });
3211 $("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 }); 3282 $("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 });
3212 $("#wm_instock").jqxCheckBox({ theme: theme, height: 23 }); 3283 $("#wm_instock").jqxCheckBox({ theme: theme, height: 23 });
3213 $("#wm_instock").on('change', function (event) { 3284 $("#wm_instock").on('change', function (event) {
3214 miscinstock = event.args.checked; 3285 miscinstock = event.args.checked;
3215 misclist.dataBind(); 3286 misclist.dataBind();
3307 modalOpacity: 0.40 3378 modalOpacity: 0.40
3308 }); 3379 });
3309 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme }); 3380 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme });
3310 $("#YeastReady").click(function () { 3381 $("#YeastReady").click(function () {
3311 calcFermentables(); 3382 calcFermentables();
3312 $("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
3313 }); 3383 });
3314 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 }); 3384 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 });
3315 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 }); 3385 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 });
3316 $("#wy_product_id").jqxInput({ theme: theme, width: 320, height: 23 }); 3386 $("#wy_product_id").jqxInput({ theme: theme, width: 320, height: 23 });
3317 $("#wy_instock").jqxCheckBox({ theme: theme, height: 23 }); 3387 $("#wy_instock").jqxCheckBox({ theme: theme, height: 23 });

mercurial