651 var r2d = Math.pow(10, (TpH - 10.38)); |
681 var r2d = Math.pow(10, (TpH - 10.38)); |
652 var f1d = 1 / (1 + r1d + r1d * r2d); |
682 var f1d = 1 / (1 + r1d + r1d * r2d); |
653 var f2d = f1d * r1d; |
683 var f2d = f1d * r1d; |
654 var f3d = f2d * r2d; |
684 var f3d = f2d * r2d; |
655 switch (BT) { |
685 switch (BT) { |
656 case 'NaHCO3': RA = -protonDeficit / (f1d - f3d); //mmol totaal |
686 case 0: RA = -protonDeficit / (f1d - f3d); // Sodiumbicarbonate, mmol totaal |
657 RA = RA * MMNaHCO3/1000; //gram |
687 RA = RA * MMNaHCO3/1000; //gram |
658 $("#wa_base").val(Math.round(RA * 100) / 100); |
688 $("#wa_base").val(Math.round(RA * 100) / 100); |
659 setWaterAgent(BT, Math.round(RA * 100) / 100); |
689 setWaterAgent('NaHCO3', Math.round(RA * 100) / 100); |
660 if (liters > 0) { |
690 if (liters > 0) { |
661 // Na |
691 // Na |
662 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + |
692 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + |
663 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3; |
693 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3; |
664 RA = 1000 * RA / liters; |
694 RA = 1000 * RA / liters; |
665 sodium = wg_sodium + RA; |
695 sodium = wg_sodium + RA; |
666 // HCO3 |
696 // HCO3 |
667 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3; |
697 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3; |
668 RA = 1000 * RA / liters; |
698 RA = 1000 * RA / liters; |
669 bicarbonate = wg_bicarbonate + RA; |
699 bicarbonate = wg_bicarbonate + RA; |
670 total_alkalinity = bicarbonate * 50 / 61; |
700 total_alkalinity = bicarbonate * 50 / 61; |
671 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
701 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
672 } |
702 } |
673 break; |
703 break; |
674 case 'Na2CO3': RA = -protonDeficit / (2 * f1d + f2d); //mmol totaal |
704 case 1: RA = -protonDeficit / (2 * f1d + f2d); // Sodiumcarbonate, mmol totaal |
675 RA = RA * MMNa2CO3/1000; //gram |
705 RA = RA * MMNa2CO3/1000; //gram |
676 $("#wa_base").val(Math.round(RA * 100) / 100); |
706 $("#wa_base").val(Math.round(RA * 100) / 100); |
677 setWaterAgent(BT, Math.round(RA * 100) / 100); |
707 setWaterAgent('Na2CO3', Math.round(RA * 100) / 100); |
678 if (liters > 0) { |
708 if (liters > 0) { |
679 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + |
709 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + |
680 parseFloat($("#wa_base").jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3; |
710 parseFloat($("#wa_base").jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3; |
681 RA = 1000 * RA / liters; |
711 RA = 1000 * RA / liters; |
682 sodium = wg_sodium + RA; |
712 sodium = wg_sodium + RA; |
683 // HCO3 |
713 // HCO3 |
684 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3; |
714 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3; |
685 RA = 1000 * RA / liters; |
715 RA = 1000 * RA / liters; |
686 bicarbonate = wg_bicarbonate + RA; |
716 bicarbonate = wg_bicarbonate + RA; |
687 total_alkalinity = bicarbonate * 50 / 61; |
717 total_alkalinity = bicarbonate * 50 / 61; |
688 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
718 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
689 } |
719 } |
690 break; |
720 break; |
691 case 'CaCO3': RA = -protonDeficit * (f1d - f3d); //mmol totaal |
721 case 2: RA = -protonDeficit * (f1d - f3d); // Calciumcarbonate, mmol totaal |
692 RA = RA * MMCaCO3/1000; //gram |
722 RA = RA * MMCaCO3/1000; //gram |
693 //but only 1/3 is effective, so add 3 times as much |
723 //but only 1/3 is effective, so add 3 times as much |
694 RA = 3 * RA; |
724 RA = 3 * RA; |
695 $("#wa_base").val(Math.round(RA * 100) / 100); |
725 $("#wa_base").val(Math.round(RA * 100) / 100); |
696 setWaterAgent(BT, Math.round(RA * 100) / 100); |
726 setWaterAgent('CaCO3', Math.round(RA * 100) / 100); |
697 if (liters > 0) { |
727 if (liters > 0) { |
698 //Bicarbonate |
728 //Bicarbonate |
699 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3; |
729 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3; |
700 RA = 1000 * RA / liters; |
730 RA = 1000 * RA / liters; |
701 bicarbonate = wg_bicarbonate + RA; |
731 bicarbonate = wg_bicarbonate + RA; |
702 total_alkalinity = bicarbonate * 50 / 61; |
732 total_alkalinity = bicarbonate * 50 / 61; |
703 //Ca precipitates out as Ca10(PO4)6(OH)2 |
733 //Ca precipitates out as Ca10(PO4)6(OH)2 |
704 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
734 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
705 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 + |
735 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 + |
706 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaCO3; |
736 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaCO3; |
707 RA = 1000 * RA / liters; |
737 RA = 1000 * RA / liters; |
708 calcium = wg_calcium + RA; |
738 calcium = wg_calcium + RA; |
709 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
739 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
710 } |
740 } |
711 break; |
741 break; |
712 case 'Ca(OH)2': RA = -protonDeficit / 19.3; // g |
742 case 3: RA = -protonDeficit / 19.3; // Calciumhydroxide |
713 $("#wa_base").val(Math.round(RA * 100) / 100); |
743 $("#wa_base").val(Math.round(RA * 100) / 100); |
714 setWaterAgent(BT, Math.round(RA * 100) / 100); |
744 setWaterAgent('Ca(OH)2', Math.round(RA * 100) / 100); |
715 if (liters > 0) { |
745 if (liters > 0) { |
716 // Bicarbonate |
746 // Bicarbonate |
717 RA = -protonDeficit / liters; |
747 RA = -protonDeficit / liters; |
718 total_alkalinity = wg_total_alkalinity + RA; |
748 total_alkalinity = wg_total_alkalinity + RA; |
719 bicarbonate = total_alkalinity * 61 / 50; |
749 bicarbonate = total_alkalinity * 61 / 50; |
720 // Calcium |
750 // Calcium |
721 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
751 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
722 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 + |
752 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 + |
723 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaOH2; |
753 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaOH2; |
724 RA = 1000 * RA / liters; |
754 RA = 1000 * RA / liters; |
725 calcium = wg_calcium + RA; |
755 calcium = wg_calcium + RA; |
726 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
756 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
727 } |
757 } |
728 break; |
758 break; |
729 } |
759 } |
730 } |
760 } |
731 ph = TpH; |
761 ph = TpH; |
732 $('#wb_ph').val(Math.round(ph * 10) / 10); |
762 $('#wb_ph').val(Math.round(ph * 10) / 10); |
733 $('#est_mash_ph').val(Math.round(ph * 10) / 10); |
763 $('#est_mash_ph').val(Math.round(ph * 10) / 10); |
1487 { name: 'st_color_max', type: 'float' }, |
1545 { name: 'st_color_max', type: 'float' }, |
1488 { name: 'st_carb_min', type: 'float' }, |
1546 { name: 'st_carb_min', type: 'float' }, |
1489 { name: 'st_carb_max', type: 'float' }, |
1547 { name: 'st_carb_max', type: 'float' }, |
1490 { name: 'st_abv_min', type: 'float' }, |
1548 { name: 'st_abv_min', type: 'float' }, |
1491 { name: 'st_abv_max', type: 'float' }, |
1549 { name: 'st_abv_max', type: 'float' }, |
1492 { name: 'type', type: 'string' }, |
1550 { name: 'type', type: 'int' }, |
1493 { name: 'batch_size', type: 'float' }, |
1551 { name: 'batch_size', type: 'float' }, |
1494 { name: 'boil_size', type: 'float' }, |
1552 { name: 'boil_size', type: 'float' }, |
1495 { name: 'boil_time', type: 'float' }, |
1553 { name: 'boil_time', type: 'float' }, |
1496 { name: 'efficiency', type: 'float' }, |
1554 { name: 'efficiency', type: 'float' }, |
1497 { name: 'est_og', type: 'float' }, |
1555 { name: 'est_og', type: 'float' }, |
1498 { name: 'est_fg', type: 'float' }, |
1556 { name: 'est_fg', type: 'float' }, |
1499 { name: 'est_abv', type: 'float' }, |
1557 { name: 'est_abv', type: 'float' }, |
1500 { name: 'est_color', type: 'float' }, |
1558 { name: 'est_color', type: 'float' }, |
1501 { name: 'color_method', type: 'string' }, |
1559 { name: 'color_method', type: 'int' }, |
1502 { name: 'est_ibu', type: 'float' }, |
1560 { name: 'est_ibu', type: 'float' }, |
1503 { name: 'ibu_method', type: 'string' }, |
1561 { name: 'ibu_method', type: 'int' }, |
1504 { name: 'est_carb', type: 'float' }, |
1562 { name: 'est_carb', type: 'float' }, |
1505 { name: 'sparge_temp', type: 'float' }, |
1563 { name: 'sparge_temp', type: 'float' }, |
1506 { name: 'sparge_ph', type: 'float' }, |
1564 { name: 'sparge_ph', type: 'float' }, |
1507 { name: 'sparge_volume', type: 'float' }, |
1565 { name: 'sparge_volume', type: 'float' }, |
1508 { name: 'sparge_source', type: 'string' }, |
1566 { name: 'sparge_source', type: 'int' }, |
1509 { name: 'sparge_acid_type', type: 'string' }, |
1567 { name: 'sparge_acid_type', type: 'int' }, |
1510 { name: 'sparge_acid_perc', type: 'float' }, |
1568 { name: 'sparge_acid_perc', type: 'float' }, |
1511 { name: 'sparge_acid_amount', type: 'float' }, |
1569 { name: 'sparge_acid_amount', type: 'float' }, |
1512 { name: 'mash_ph', type: 'float' }, |
1570 { name: 'mash_ph', type: 'float' }, |
1513 { name: 'mash_name', type: 'string' }, |
1571 { name: 'mash_name', type: 'string' }, |
1514 { name: 'calc_acid', type: 'bool' }, |
1572 { name: 'calc_acid', type: 'int' }, |
1515 { name: 'w1_name', type: 'string' }, |
1573 { name: 'w1_name', type: 'string' }, |
1516 { name: 'w1_amount', type: 'float' }, |
1574 { name: 'w1_amount', type: 'float' }, |
1517 { name: 'w1_calcium', type: 'float' }, |
1575 { name: 'w1_calcium', type: 'float' }, |
1518 { name: 'w1_sulfate', type: 'float' }, |
1576 { name: 'w1_sulfate', type: 'float' }, |
1519 { name: 'w1_chloride', type: 'float' }, |
1577 { name: 'w1_chloride', type: 'float' }, |
1934 } else { |
1989 } else { |
1935 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100); |
1990 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100); |
1936 } |
1991 } |
1937 calcFermentables(); |
1992 calcFermentables(); |
1938 calcSVG(); |
1993 calcSVG(); |
|
1994 calcFG(); |
1939 calcABV(); |
1995 calcABV(); |
1940 calcIBUs(); |
1996 calcIBUs(); |
1941 }); |
1997 }); |
1942 }, |
1998 }, |
1943 ready: function() { |
1999 ready: function() { |
1944 calcFermentables(); |
2000 calcFermentables(); |
1945 $('#jqxTabs').jqxTabs('next'); |
2001 $('#jqxTabs').jqxTabs('next'); |
1946 }, |
2002 }, |
1947 columns: [ |
2003 columns: [ |
1948 { text: 'Vergistbaar ingrediënt', editable: false, datafield: 'f_name', |
2004 { text: 'Vergistbaar ingrediënt', datafield: 'f_name', |
1949 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { |
2005 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { |
1950 var rowData = $("#fermentableGrid").jqxGrid('getrowdata', row); |
2006 var rowData = $("#fermentableGrid").jqxGrid('getrowdata', row); |
1951 return "<span style='margin: 3px; margin-top: 6px; float: "+ |
2007 return "<span style='margin: 3px; margin-top: 6px; float: "+ |
1952 columnproperties.cellsalign+"'>" +rowData.f_supplier+" / "+rowData.f_name+" ("+rowData.f_color+" EBC)</span>"; |
2008 columnproperties.cellsalign+"'>" +rowData.f_supplier+" / "+rowData.f_name+" ("+rowData.f_color+" EBC)</span>"; |
1953 } |
2009 } |
1954 }, |
2010 }, |
1955 { text: 'Type', editable: false, align: 'center', cellsalign: 'center', width: 100, datafield: 'f_type' }, |
2011 { text: 'Type', width: 100, datafield: 'f_type', |
1956 { text: 'Moment', width: 110, align: 'center', cellsalign: 'center', datafield: 'f_added', columntype: 'dropdownlist', |
2012 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1957 createeditor: function (row, column, editor) { |
2013 return "<div style='margin: 4px;'>" + FermentableTypeData[value].nl + "</div>"; |
1958 var srcAdded = [ "Mash", "Boil", "Fermentation", "Lagering", "Bottle" ]; |
2014 } |
1959 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcAdded }); |
2015 }, |
|
2016 { text: 'Moment', width: 110, datafield: 'f_added', |
|
2017 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
|
2018 return "<div style='margin: 4px;'>" + AddedData[value].nl + "</div>"; |
1960 } |
2019 } |
1961 }, |
2020 }, |
1962 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
2021 { text: 'Opbrengst', datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
1963 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3', |
2022 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
1964 columntype: 'numberinput', |
2023 { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
1965 validation: function (cell, value) { |
2024 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }, |
1966 // Maximum weight is the batch_size, just a simple check. |
2025 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
1967 var maxmout = parseFloat($("#batch_size").jqxNumberInput('decimal')); |
2026 return "Wijzig"; |
1968 if (value < 0 || value > maxmout) { |
2027 }, buttonclick: function (row) { |
1969 return { result: false, message: "Gewicht moet 0-"+maxmout+" zijn" }; |
2028 fermentableRow = row; |
1970 } |
2029 fermentableData = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
1971 return true; |
2030 $("#wf_name").val(fermentableData.f_name); |
1972 }, |
2031 $("#wf_amount").val(fermentableData.f_amount); |
1973 initeditor: function (row, cellvalue, editor) { |
2032 $("#wf_percentage").val(fermentableData.f_percentage); |
1974 editor.jqxNumberInput({ inputMode: 'simple', min: 0, decimalDigits: 3, spinButtons: false }); |
2033 $("#wf_adjust_to_total_100").val(fermentableData.f_adjust_to_total_100); |
1975 }, |
2034 $("#wf_added").val(fermentableData.f_added); |
1976 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { |
2035 // show the popup window. |
1977 if (to_100) { |
2036 $("#popupFermentable").jqxWindow('open'); |
1978 return oldvalue; // When using percentages, don't allow edited results. |
2037 } |
1979 } |
2038 } |
1980 } |
|
1981 }, |
|
1982 { text: 'Percentage', datafield: 'f_percentage', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'p1', |
|
1983 columntype: 'numberinput', |
|
1984 validation: function (cell, value) { |
|
1985 if (value < 0 || value > 100) { |
|
1986 return { result: false, message: "Percentage moet 0-100 zijn" }; |
|
1987 } |
|
1988 return true; |
|
1989 }, |
|
1990 initeditor: function (row, cellvalue, editor) { |
|
1991 editor.jqxNumberInput({ decimalDigits: 1, min: 0, max: 100, spinButtons: false }); |
|
1992 }, |
|
1993 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { |
|
1994 oldvalue = Math.round(oldvalue * 10) / 10.0; |
|
1995 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
|
1996 if ((oldvalue != newvalue) && (rowscount > 1)) { |
|
1997 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', row); |
|
1998 if (rowdata.f_adjust_to_total_100) { |
|
1999 return oldvalue; |
|
2000 } |
|
2001 var diff = newvalue - oldvalue; |
|
2002 var tw = 0; // total weight |
|
2003 for (i = 0; i < rowscount; i++) { |
|
2004 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
2005 tw += rowdata.f_amount; |
|
2006 } |
|
2007 if (to_100) { |
|
2008 // Adjust this row and the 100% row. |
|
2009 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', row); |
|
2010 rowdata.f_amount += tw * diff / 100; |
|
2011 for (i = 0; i < rowscount; i++) { |
|
2012 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
2013 if (rowdata.f_adjust_to_total_100) { |
|
2014 rowdata.f_percentage -= diff; |
|
2015 rowdata.f_amount -= tw * diff / 100; |
|
2016 } |
|
2017 } |
|
2018 } else { |
|
2019 // Adjust all the rows. |
|
2020 var nw = tw * diff / 100; |
|
2021 for (i = 0; i < rowscount; i++) { |
|
2022 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
2023 if (i == row) { |
|
2024 rowdata.f_amount += nw; |
|
2025 } else { |
|
2026 rowdata.f_amount -= nw / (rowscount - 1); |
|
2027 rowdata.f_percentage = Math.round((rowdata.f_amount / tw) * 1000) / 10.0; |
|
2028 } |
|
2029 } |
|
2030 } |
|
2031 } |
|
2032 } |
|
2033 }, |
|
2034 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 80, |
|
2035 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { |
|
2036 if (to_100) { |
|
2037 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
|
2038 for (i = 0; i < rowscount; i++) { |
|
2039 if (i != row) { |
|
2040 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
2041 rowdata.f_adjust_to_total_100 = false; |
|
2042 } |
|
2043 } |
|
2044 } |
|
2045 } |
|
2046 } |
|
2047 ] |
2039 ] |
2048 }); |
|
2049 $("#fermentableGrid").on('cellendedit', function (event) { |
|
2050 var args = event.args; |
|
2051 console.log("Event Type: cellendedit, Column: " + args.datafield + ", Row: " + (args.rowindex) + ", Value: " + args.value); |
|
2052 // Make sure the grid itself is updated. |
|
2053 $("#fermentableGrid").jqxGrid('setcellvalue', args.rowindex, args.datafield, args.value); |
|
2054 if ((args.datafield == 'f_amount') && (! to_100)) { |
|
2055 // If one of the amounts is changed, recalculate the percentages. |
|
2056 console.log("adjust percentages"); |
|
2057 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
|
2058 if (rowscount > 1) { |
|
2059 var tw = 0; |
|
2060 for (i = 0; i < rowscount; i++) { |
|
2061 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
2062 tw += rowdata.f_amount; |
|
2063 }; |
|
2064 for (i = 0; i < rowscount; i++) { |
|
2065 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
2066 var percentage = Math.round(rowdata.f_amount / tw * 1000) / 10.0; |
|
2067 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_percentage", percentage); |
|
2068 }; |
|
2069 } else { |
|
2070 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100); |
|
2071 } |
|
2072 }; |
|
2073 $('#fermentableGrid').jqxGrid('sortby', 'f_amount', 'desc'); // TODO: not reliable |
|
2074 calcFermentables(); |
|
2075 calcSVG(); |
|
2076 calcABV(); |
|
2077 calcIBUs(); // Depends on gravity, so recalculate. |
|
2078 }); |
2040 }); |
2079 }; |
2041 }; |
2080 |
2042 |
2081 // Inline hops editor |
2043 // Inline hops editor |
2082 var editHop = function (data) { |
2044 var editHop = function (data) { |
2083 var hopSource = { |
2045 var hopSource = { |
2084 localdata: data.hops, |
2046 localdata: data.hops, |
2085 datatype: "local", |
2047 datatype: "local", |
2086 cache: false, |
2048 cache: false, |
|
2049 async: false, |
2087 datafields: [ |
2050 datafields: [ |
2088 { name: 'h_name', type: 'string' }, |
2051 { name: 'h_name', type: 'string' }, |
2089 { name: 'h_origin', type: 'string' }, |
2052 { name: 'h_origin', type: 'string' }, |
2090 { name: 'h_amount', type: 'float' }, |
2053 { name: 'h_amount', type: 'float' }, |
2091 { name: 'h_cost', type: 'float' }, |
2054 { name: 'h_cost', type: 'float' }, |
2092 { name: 'h_type', type: 'string' }, |
2055 { name: 'h_type', type: 'int' }, |
2093 { name: 'h_form', type: 'string' }, |
2056 { name: 'h_form', type: 'int' }, |
2094 { name: 'h_useat', type: 'string' }, |
2057 { name: 'h_useat', type: 'int' }, |
2095 { name: 'h_time', type: 'float' }, |
2058 { name: 'h_time', type: 'float' }, |
2096 { name: 'h_alpha', type: 'float' }, |
2059 { name: 'h_alpha', type: 'float' }, |
2097 { name: 'h_beta', type: 'float' }, |
2060 { name: 'h_beta', type: 'float' }, |
2098 { name: 'h_hsi', type: 'float' }, |
2061 { name: 'h_hsi', type: 'float' }, |
2099 { name: 'h_humulene', type: 'float' }, |
2062 { name: 'h_humulene', type: 'float' }, |
2100 { name: 'h_caryophyllene', type: 'float' }, |
2063 { name: 'h_caryophyllene', type: 'float' }, |
2101 { name: 'h_cohumulone', type: 'float' }, |
2064 { name: 'h_cohumulone', type: 'float' }, |
2102 { name: 'h_myrcene', type: 'float' }, |
2065 { name: 'h_myrcene', type: 'float' }, |
2103 { name: 'h_total_oil', type: 'float' }, |
2066 { name: 'h_total_oil', type: 'float' }, |
2104 { name: 'h_weight', type: 'float' } |
2067 { name: 'h_inventory', type: 'float' }, |
|
2068 { name: 'h_avail', type: 'int' } |
2105 ], |
2069 ], |
2106 addrow: function (rowid, rowdata, position, commit) { |
2070 addrow: function (rowid, rowdata, position, commit) { |
2107 commit(true); |
2071 commit(true); |
2108 }, |
2072 }, |
2109 deleterow: function (rowid, commit) { |
2073 deleterow: function (rowid, commit) { |
2110 commit(true); |
2074 commit(true); |
2111 } |
2075 } |
2112 }; |
2076 }; |
2113 var hopAdapter = new $.jqx.dataAdapter(hopSource, { |
2077 var hopAdapter = new $.jqx.dataAdapter(hopSource); |
2114 beforeLoadComplete: function (records) { |
|
2115 var data = new Array(); |
|
2116 for (var i = 0; i < records.length; i++) { |
|
2117 var row = records[i]; |
|
2118 row.h_weight = row.h_amount * 1000; |
|
2119 data.push(row); |
|
2120 } |
|
2121 return data; |
|
2122 }, |
|
2123 loadError: function(jqXHR, status, error) { |
|
2124 $('#err').text(status + ' ' + error); |
|
2125 }, |
|
2126 }); |
|
2127 $("#hopGrid").jqxGrid({ |
2078 $("#hopGrid").jqxGrid({ |
2128 width: 1050, |
2079 width: 1240, |
2129 height: 400, |
2080 height: 510, |
2130 source: hopAdapter, |
2081 source: hopAdapter, |
2131 theme: theme, |
2082 theme: theme, |
2132 selectionmode: 'singlerow', |
2083 selectionmode: 'singlerow', |
2133 editmode: 'selectedcell', |
|
2134 editable: true, |
|
2135 localization: getLocalization(), |
2084 localization: getLocalization(), |
2136 showtoolbar: true, |
2085 showtoolbar: true, |
2137 rendertoolbar: function (toolbar) { |
2086 rendertoolbar: function (toolbar) { |
2138 var me = this; |
2087 var me = this; |
2139 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
2088 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
2140 toolbar.append(container); |
2089 toolbar.append(container); |
2141 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); |
2090 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); |
2142 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
2091 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
2143 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>'); |
2092 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>'); |
2144 container.append('<input style="float: left; margin-left: 280px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />'); |
2093 container.append('<input style="float: left; margin-left: 400px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />'); |
2145 // add hop from dropdownlist. |
2094 // add hop from dropdownlist. |
2146 $("#haddrowbutton").jqxDropDownList({ |
2095 $("#haddrowbutton").jqxDropDownList({ |
2147 placeHolder: "Kies hop:", |
2096 placeHolder: "Kies hop:", |
2148 theme: theme, |
2097 theme: theme, |
|
2098 template: "primary", |
2149 source: hoplist, |
2099 source: hoplist, |
2150 displayMember: "name", |
2100 displayMember: "name", |
2151 width: 150, |
2101 width: 150, |
2152 height: 27, |
2102 height: 27, |
2153 dropDownWidth: 500, |
2103 dropDownWidth: 500, |
2188 hopinstock = event.args.checked; |
2138 hopinstock = event.args.checked; |
2189 hoplist.dataBind(); |
2139 hoplist.dataBind(); |
2190 }); |
2140 }); |
2191 |
2141 |
2192 // delete selected hop. |
2142 // delete selected hop. |
2193 $("#hdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
2143 $("#hdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 }); |
2194 $("#hdeleterowbutton").on('click', function () { |
2144 $("#hdeleterowbutton").on('click', function () { |
2195 var selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex'); |
2145 var selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex'); |
2196 var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount; |
2146 var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount; |
2197 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
2147 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
2198 var id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex); |
2148 var id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex); |
2199 var commit = $("#hopGrid").jqxGrid('deleterow', id); |
2149 var commit = $("#hopGrid").jqxGrid('deleterow', id); |
2200 } |
2150 } |
|
2151 calcIBUs(); |
2201 }); |
2152 }); |
2202 }, |
2153 }, |
2203 ready: function() { |
2154 ready: function() { |
|
2155 calcIBUs(); |
2204 $('#jqxTabs').jqxTabs('next'); |
2156 $('#jqxTabs').jqxTabs('next'); |
2205 }, |
2157 }, |
2206 columns: [ |
2158 columns: [ |
2207 { text: 'Hop', editable: false, datafield: 'h_name', |
2159 { text: 'Hop', datafield: 'h_name', |
2208 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { |
2160 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { |
2209 var rowData = $("#hopGrid").jqxGrid('getrowdata', row); |
2161 var rowData = $("#hopGrid").jqxGrid('getrowdata', row); |
2210 return "<span style='margin: 3px; margin-top: 6px; float: "+ |
2162 return "<span style='margin: 3px; margin-top: 6px; float: "+ |
2211 columnproperties.cellsalign+"'>" +rowData.h_origin+" / "+rowData.h_name+"</span>"; |
2163 columnproperties.cellsalign+"'>" +rowData.h_origin+" / "+rowData.h_name+"</span>"; |
2212 }, |
2164 }, |
2213 }, |
2165 }, |
2214 { text: 'Type', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_type' }, |
2166 { text: 'Type', width: 90, datafield: 'h_type', |
2215 { text: 'Vorm', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_form' }, |
2167 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2216 { text: 'Alpha', editable: false, datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
2168 return "<div style='margin: 4px;'>" + HopTypeData[value].nl + "</div>"; |
2217 { text: 'Amount', hidden: true, datafield: 'h_amount' }, |
2169 } |
2218 { text: 'Gewicht gr', datafield: 'h_weight', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
2170 }, |
2219 columntype: 'numberinput', |
2171 { text: 'Vorm', width: 90, datafield: 'h_form', |
2220 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2172 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2221 return "<div style='margin: 4px;' class='jqx-right-align'>" + dataAdapter.formatNumber(value, "f1") + " gr</div>"; |
2173 return "<div style='margin: 4px;'>" + HopFormData[value].nl + "</div>"; |
2222 }, |
2174 } |
2223 initeditor: function (row, cellvalue, editor, celltext, pressedChar) { |
2175 }, |
2224 editor.jqxNumberInput({ |
2176 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
2225 inputMode: 'simple', decimalDigits: 1, min: 0, max: parseFloat(dataRecord.batch_size * 200), |
2177 { text: 'Gebruik', width: 110, datafield: 'h_useat', |
2226 spinButtons: false |
2178 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2227 }); |
2179 return "<div style='margin: 4px;'>" + HopUseData[value].nl + "</div>"; |
2228 }, |
2180 } |
2229 validation: function (cell, value) { |
2181 }, |
2230 var maxhops = parseFloat(dataRecord.batch_size) * 200; |
2182 { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right', |
2231 if (value < 0 || value > maxhops ) { |
2183 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2232 return { result: false, message: "Gewicht moet tussen 0 en "+maxhops+" gram zijn" }; |
2184 if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool |
2233 } |
2185 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" min.</div>"; |
2234 return true; |
2186 if (rowdata.h_useat == 5) // Dry hop |
2235 } |
2187 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value/1440, "f0")+" dagen</div>"; |
2236 }, |
2188 else |
2237 { text: 'Gebruik', width: 110, align: 'center', cellsalign: 'center', datafield: 'h_useat', columntype: 'dropdownlist', |
2189 return "<div style='margin: 4px;'></div>"; |
2238 createeditor: function (row, column, editor) { |
2190 } |
2239 var srcUse = [ "Boil", "Dry Hop", "Mash", "First Wort", "Aroma" ]; |
2191 }, |
2240 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcUse }); |
2192 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right', |
2241 }, |
|
2242 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { |
|
2243 if ((newvalue == "Mash") || (newvalue == "First Wort")) { |
|
2244 $("#hopGrid").jqxGrid('setcellvalue', row, "h_time", parseFloat(dataRecord.boil_time)); |
|
2245 } else if (newvalue == "Aroma") { |
|
2246 $("#hopGrid").jqxGrid('setcellvalue', row, "h_time", 0); |
|
2247 } |
|
2248 } |
|
2249 }, |
|
2250 { text: 'Tijd', datafield: 'h_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', |
|
2251 columntype: 'numberinput', |
|
2252 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
|
2253 if ((rowdata.h_useat == "Boil") || (rowdata.h_useat == "Dry Hop") || (rowdata.h_useat == "Dry hop")) |
|
2254 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+"</div>"; |
|
2255 else |
|
2256 return "<div style='margin: 4px;' class='jqx-right-align'> </div>"; |
|
2257 }, |
|
2258 initeditor: function (row, cellvalue, editor, celltext, pressedChar) { |
|
2259 editor.jqxNumberInput({ decimalDigits: 0, digits: 3, min: 0, max: parseFloat(dataRecord.boil_time) }); |
|
2260 }, |
|
2261 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { |
|
2262 var use = $("#hopGrid").jqxGrid('getcellvalue', row, "h_useat"); |
|
2263 if ((use == "Mash") || (use == "First Wort") || (use == "First wort") || (use == "Aroma")) |
|
2264 return oldvalue; |
|
2265 }, |
|
2266 validation: function (cell, value) { |
|
2267 var high = parseFloat(dataRecord.boil_time); |
|
2268 if (value < 0 || value > high ) { |
|
2269 return { result: false, message: "De tijd moet 0-"+high+" zijn" }; |
|
2270 } |
|
2271 return true; |
|
2272 } |
|
2273 }, |
|
2274 { text: 'IBU', editable: false, datafield: 'ibu', width: 80, align: 'right', |
|
2275 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2193 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2276 var ibu = toIBU(rowdata.h_useat, |
2194 var ibu = toIBU(rowdata.h_useat, |
2277 rowdata.h_form, |
2195 rowdata.h_form, |
2278 preboil_sg, |
2196 preboil_sg, |
2279 parseFloat($("#batch_size").jqxNumberInput('decimal')), |
2197 parseFloat($("#batch_size").jqxNumberInput('decimal')), |
2280 parseFloat(rowdata.h_amount), |
2198 parseFloat(rowdata.h_amount), |
2281 parseFloat(rowdata.h_time), |
2199 parseFloat(rowdata.h_time), |
2282 parseFloat(rowdata.h_alpha), |
2200 parseFloat(rowdata.h_alpha), |
2283 $("#ibu_method").val() |
2201 $("#ibu_method").val() |
2284 ); |
2202 ); |
2285 calcIBUs(); |
|
2286 return "<div style='margin: 4px;' class='jqx-right-align'>" + dataAdapter.formatNumber(ibu, "f1") + "</div>"; |
2203 return "<div style='margin: 4px;' class='jqx-right-align'>" + dataAdapter.formatNumber(ibu, "f1") + "</div>"; |
2287 } |
2204 } |
2288 } |
2205 }, |
|
2206 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', cellsalign: 'right', |
|
2207 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
|
2208 if (value < 1) |
|
2209 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value * 1000, "f1")+" gr</div>"; |
|
2210 else |
|
2211 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f1")+" kg</div>"; |
|
2212 } |
|
2213 }, |
|
2214 { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right', cellsalign: 'right', |
|
2215 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
|
2216 if (value < 1) |
|
2217 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value * 1000, "f1")+" gr</div>"; |
|
2218 else |
|
2219 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f1")+" kg</div>"; |
|
2220 } |
|
2221 }, |
|
2222 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
|
2223 return "Wijzig"; |
|
2224 }, buttonclick: function (row) { |
|
2225 hopRow = row; |
|
2226 hopData = $("#hopGrid").jqxGrid('getrowdata', hopRow); |
|
2227 $("#wh_name").val(hopData.h_name); |
|
2228 $("#wh_amount").val(hopData.h_amount * 1000); |
|
2229 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, |
|
2230 parseFloat($("#batch_size").jqxNumberInput('decimal')), |
|
2231 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), |
|
2232 parseFloat(hopData.h_alpha), $("#ibu_method").val() |
|
2233 ); |
|
2234 $("#wh_ibu").val(ibu); |
|
2235 if (hopData.h_useat == 5) // Dry hop |
|
2236 $("#wh_time").val(hopData.h_time / 1440); |
|
2237 else |
|
2238 $("#wh_time").val(hopData.h_time); |
|
2239 $("#wh_useat").val(hopData.h_useat); |
|
2240 // show the popup window. |
|
2241 $("#popupHop").jqxWindow('open'); |
|
2242 } |
|
2243 } |
2289 ] |
2244 ] |
2290 }); |
|
2291 $("#hopGrid").on('cellendedit', function (event) { |
|
2292 var args = event.args; |
|
2293 console.log("Event Type: cellendedit, Column: " + args.datafield + ", Row: " + (args.rowindex) + ", Value: " + args.value); |
|
2294 $("#hopGrid").jqxGrid('setcellvalue', args.rowindex, args.datafield, args.value); |
|
2295 if (args.datafield == 'h_weight') |
|
2296 $("#hopGrid").jqxGrid('setcellvalue', args.rowindex, 'h_amount', args.value / 1000); |
|
2297 //$('#hopGrid').jqxGrid('sortby', 'f_amount', 'desc'); |
|
2298 }); |
2245 }); |
2299 }; |
2246 }; |
2300 |
2247 |
2301 // Inline miscs editor |
2248 // Inline miscs editor |
2302 var editMisc = function (data) { |
2249 var editMisc = function (data) { |
2303 var miscSource = { |
2250 var miscSource = { |
2304 localdata: data.miscs, |
2251 localdata: data.miscs, |
2305 datatype: "local", |
2252 datatype: "local", |
2306 cache: false, |
2253 cache: false, |
|
2254 async: false, |
2307 datafields: [ |
2255 datafields: [ |
2308 { name: 'm_name', type: 'string' }, |
2256 { name: 'm_name', type: 'string' }, |
2309 { name: 'm_amount', type: 'float' }, |
2257 { name: 'm_amount', type: 'float' }, |
2310 { name: 'm_cost', type: 'float' }, |
2258 { name: 'm_cost', type: 'float' }, |
2311 { name: 'm_type', type: 'string' }, |
2259 { name: 'm_type', type: 'int' }, |
2312 { name: 'm_use_use', type: 'string' }, |
2260 { name: 'm_use_use', type: 'int' }, |
2313 { name: 'm_time', type: 'float' }, |
2261 { name: 'm_time', type: 'float' }, |
2314 { name: 'm_amount_is_weight', type: 'bool' }, |
2262 { name: 'm_amount_is_weight', type: 'int' }, |
2315 { name: 'm_weight', type: 'float' } |
2263 { name: 'm_inventory', type: 'float' }, |
|
2264 { name: 'm_avail', type: 'int' } |
2316 ], |
2265 ], |
2317 addrow: function (rowid, rowdata, position, commit) { |
2266 addrow: function (rowid, rowdata, position, commit) { |
2318 commit(true); |
2267 commit(true); |
2319 }, |
2268 }, |
2320 deleterow: function (rowid, commit) { |
2269 deleterow: function (rowid, commit) { |
2420 row["m_amount"] = 0; |
2367 row["m_amount"] = 0; |
2421 row["m_cost"] = datarecord.cost; |
2368 row["m_cost"] = datarecord.cost; |
2422 row["m_type"] = datarecord.type; |
2369 row["m_type"] = datarecord.type; |
2423 row["m_use_use"] = datarecord.use_use; |
2370 row["m_use_use"] = datarecord.use_use; |
2424 row["m_time"] = 0; |
2371 row["m_time"] = 0; |
2425 row["m_weight"] = 0; |
|
2426 row["m_amount_is_weight"] = datarecord.amount_is_weight; |
2372 row["m_amount_is_weight"] = datarecord.amount_is_weight; |
|
2373 row["m_inventory"] = datarecord.inventory; |
2427 var commit = $("#miscGrid").jqxGrid('addrow', null, row); |
2374 var commit = $("#miscGrid").jqxGrid('addrow', null, row); |
2428 } |
2375 } |
2429 }); |
2376 }); |
2430 $("#minstockbutton").jqxCheckBox({ theme: theme, height: 27 }); |
2377 $("#minstockbutton").jqxCheckBox({ theme: theme, height: 27 }); |
2431 $("#minstockbutton").on('change', function (event) { |
2378 $("#minstockbutton").on('change', function (event) { |
2432 miscinstock = event.args.checked; |
2379 miscinstock = event.args.checked; |
2433 misclist.dataBind(); |
2380 misclist.dataBind(); |
2434 }); |
2381 }); |
2435 // delete selected misc. |
2382 // delete selected misc. |
2436 $("#mdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
2383 $("#mdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 }); |
2437 $("#mdeleterowbutton").on('click', function () { |
2384 $("#mdeleterowbutton").on('click', function () { |
2438 var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex'); |
2385 var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex'); |
2439 var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; |
2386 var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; |
2440 var type = $("#miscGrid").jqxGrid('getcellvalue', selectedrowindex, "m_type"); |
2387 var type = $("#miscGrid").jqxGrid('getcellvalue', selectedrowindex, "m_type"); |
2441 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != "Water agent") { |
2388 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent |
2442 var id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex); |
2389 var id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex); |
2443 var commit = $("#miscGrid").jqxGrid('deleterow', id); |
2390 var commit = $("#miscGrid").jqxGrid('deleterow', id); |
2444 } |
2391 } |
2445 }); |
2392 }); |
2446 }, |
2393 }, |
2447 ready: function() { |
2394 ready: function() { |
2448 $('#jqxTabs').jqxTabs('next'); |
2395 $('#jqxTabs').jqxTabs('next'); |
2449 }, |
2396 }, |
2450 columns: [ |
2397 columns: [ |
2451 { text: 'Ingredient', editable: false, datafield: 'm_name' }, |
2398 { text: 'Ingredient', datafield: 'm_name' }, |
2452 { text: 'Type', editable: false, width: 120, align: 'center', cellsalign: 'center', datafield: 'm_type' }, |
2399 { text: 'Type', width: 140, datafield: 'm_type', |
2453 { text: 'Gebruik', width: 110, align: 'center', cellsalign: 'center', datafield: 'm_use_use', columntype: 'dropdownlist', |
2400 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2454 createeditor: function (row, column, editor) { |
2401 return "<div style='margin: 4px;'>" + MiscTypeData[value].nl + "</div>"; |
2455 var srcUseUse = [ "Mash", "Boil", "Primary", "Secondary", "Bottling" ]; |
2402 } |
2456 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcUseUse }); |
2403 }, |
2457 }, |
2404 { text: 'Gebruik', width: 140, datafield: 'm_use_use', |
2458 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { |
2405 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2459 var type = $("#miscGrid").jqxGrid('getcellvalue', row, "m_type"); |
2406 return "<div style='margin: 4px;'>" + MiscUseData[value].nl + "</div>"; |
2460 if (type == "Water agent") |
|
2461 return oldvalue; |
|
2462 } |
2407 } |
|
2408 }, |
|
2409 { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right', |
|
2410 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
|
2411 if (rowdata.m_use_use == 2) { // Boil |
|
2412 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" min.</div>"; |
|
2413 } else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) { // Primary or Secondary |
|
2414 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value/1440, "f0")+" dagen</div>"; |
|
2415 } else { |
|
2416 var tijd = 0; |
|
2417 return "<div style='margin: 4px;'> </div>"; |
|
2418 } |
|
2419 }, |
2463 }, |
2420 }, |
2464 { datafield: 'm_amount_is_weight', hidden: true }, // We need to declare this column |
2421 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right', |
2465 { datafield: 'm_amount', hidden: true }, // We need to declare this column |
2422 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2466 { text: 'Hoeveelheid', datafield: 'm_weight', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f2', |
2423 var vstr = rowdata.m_amount_is_weight ? "gr":"ml"; |
2467 columntype: 'numberinput', |
2424 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value * 1000,"f2")+" "+vstr+"</div>"; |
2468 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2425 } |
2469 var vstr = rowdata.m_amount_is_weight ? "gr":"ml"; |
2426 }, |
2470 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value,"f2")+" "+vstr+"</div>"; |
2427 { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right', |
2471 }, |
2428 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2472 validation: function (cell, value) { |
2429 var vstr = rowdata.m_amount_is_weight ? "gr":"ml"; |
2473 var high = parseFloat(dataRecord.boil_size) * 1000; |
2430 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value * 1000,"f2")+" "+vstr+"</div>"; |
2474 if (value < 0 || value > high) { |
2431 } |
2475 return { result: false, message: "Hoeveelheid moet tussen 0 en "+high+" zijn" }; |
2432 }, |
2476 } |
2433 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
2477 return true; |
2434 return "Wijzig"; |
2478 }, |
2435 }, buttonclick: function (row) { |
2479 initeditor: function (row, cellvalue, editor) { |
2436 miscRow = row; |
2480 editor.jqxNumberInput({ |
2437 miscData = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
2481 inputMode: 'simple', min: 0, max: parseFloat(dataRecord.boil_size) * 1000, |
2438 if (miscData.m_amount_is_weight) |
2482 decimalDigits: 2, spinButtons: false |
2439 $("#wm_pmpt_amount").html("Gewicht gram:"); |
2483 }); |
2440 else |
2484 }, |
2441 $("#wm_pmpt_amount").html("Volume ml:"); |
2485 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { |
2442 $("#wm_name").val(miscData.m_name); |
2486 var type = $("#miscGrid").jqxGrid('getcellvalue', row, "m_type"); |
2443 $("#wm_amount").val(miscData.m_amount * 1000); |
2487 if (type == "Water agent") |
2444 if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary |
2488 return oldvalue; |
2445 $("#wm_time").val(miscData.m_time / 1440); |
2489 } |
2446 else |
2490 }, |
2447 $("#wm_time").val(miscData.m_time); |
2491 { text: 'Tijd', datafield: 'm_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', |
2448 $("#wm_use_use").val(miscData.m_use_use); |
2492 columntype: 'numberinput', |
2449 // show the popup window. |
2493 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2450 if (miscData.m_type != 4) |
2494 if (rowdata.m_use_use == 'Boil') { |
2451 $("#popupMisc").jqxWindow('open'); |
2495 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" m</div>"; |
2452 } |
2496 } else if (rowdata.m_use_use == 'Secondary') { |
2453 } |
2497 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" d</div>"; |
|
2498 } else { |
|
2499 var tijd = 0; |
|
2500 return "<div style='margin: 4px;' class='jqx-right-align'> </div>"; |
|
2501 } |
|
2502 }, |
|
2503 initeditor: function (row, cellvalue, editor, celltext, pressedChar) { |
|
2504 editor.jqxNumberInput({ decimalDigits: 0, digits: 3, min: 0, max: parseFloat(dataRecord.boil_time) }); |
|
2505 }, |
|
2506 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { |
|
2507 var use = $("#miscGrid").jqxGrid('getcellvalue', row, "m_use_use"); |
|
2508 if ((use != "Boil") && (use != "Secondary")) |
|
2509 return oldvalue; |
|
2510 }, |
|
2511 validation: function (cell, value) { |
|
2512 var high = parseFloat(dataRecord.boil_time); |
|
2513 if (value < 0 || value > high ) { |
|
2514 return { result: false, message: "De tijd moet 0-"+high+" zijn" }; |
|
2515 } |
|
2516 return true; |
|
2517 } |
|
2518 } |
|
2519 ] |
2454 ] |
2520 }); |
|
2521 $("#miscGrid").on('cellendedit', function (event) { |
|
2522 var args = event.args; |
|
2523 console.log("Event Type: cellendedit, Column: " + args.datafield + ", Row: " + (args.rowindex) + ", Value: " + args.value); |
|
2524 $("#miscGrid").jqxGrid('setcellvalue', args.rowindex, args.datafield, args.value); |
|
2525 if (args.datafield == 'm_weight') { |
|
2526 $("#miscGrid").jqxGrid('setcellvalue', args.rowindex, 'm_amount', parseFloat(args.value) / 1000); |
|
2527 } |
|
2528 }); |
2455 }); |
2529 }; |
2456 }; |
2530 |
2457 |
2531 // Inline yeasts editor |
2458 // Inline yeasts editor |
2532 var editYeast = function (data) { |
2459 var editYeast = function (data) { |
2533 var yeastSource = { |
2460 var yeastSource = { |
2534 localdata: data.yeasts, |
2461 localdata: data.yeasts, |
2535 datatype: "local", |
2462 datatype: "local", |
2536 cache: false, |
2463 cache: false, |
|
2464 async: false, |
2537 datafields: [ |
2465 datafields: [ |
2538 { name: 'y_name', type: 'string' }, |
2466 { name: 'y_name', type: 'string' }, |
2539 { name: 'y_laboratory', type: 'string' }, |
2467 { name: 'y_laboratory', type: 'string' }, |
2540 { name: 'y_product_id', type: 'string' }, |
2468 { name: 'y_product_id', type: 'string' }, |
2541 { name: 'y_amount', type: 'float' }, |
2469 { name: 'y_amount', type: 'float' }, |
2542 { name: 'y_cost', type: 'float' }, |
2470 { name: 'y_cost', type: 'float' }, |
2543 { name: 'y_type', type: 'string' }, |
2471 { name: 'y_type', type: 'int' }, |
2544 { name: 'y_form', type: 'string' }, |
2472 { name: 'y_form', type: 'int' }, |
2545 { name: 'y_time', type: 'float' }, |
2473 { name: 'y_flocculation', type: 'int' }, |
2546 { name: 'y_min_temperature', type: 'float' }, |
2474 { name: 'y_min_temperature', type: 'float' }, |
2547 { name: 'y_max_temperature', type: 'float' }, |
2475 { name: 'y_max_temperature', type: 'float' }, |
2548 { name: 'y_attenuation', type: 'float' }, |
2476 { name: 'y_attenuation', type: 'float' }, |
2549 { name: 'y_amount_is_weight', type: 'bool' }, |
2477 { name: 'y_use', type: 'int' }, |
2550 { name: 'y_use', type: 'string' }, |
2478 { name: 'y_cells', type: 'float' }, |
2551 { name: 'y_weight', type: 'float' } |
2479 { name: 'y_inventory', type: 'float' }, |
|
2480 { name: 'y_avail', type: 'int' } |
2552 ], |
2481 ], |
2553 addrow: function (rowid, rowdata, position, commit) { |
2482 addrow: function (rowid, rowdata, position, commit) { |
2554 commit(true); |
2483 commit(true); |
2555 }, |
2484 }, |
2556 deleterow: function (rowid, commit) { |
2485 deleterow: function (rowid, commit) { |
2557 commit(true); |
2486 commit(true); |
2558 } |
2487 } |
2559 }; |
2488 }; |
2560 var yeastAdapter = new $.jqx.dataAdapter(yeastSource, { |
2489 var yeastAdapter = new $.jqx.dataAdapter(yeastSource); |
2561 beforeLoadComplete: function (records) { |
|
2562 var data = new Array(); |
|
2563 for (var i = 0; i < records.length; i++) { |
|
2564 var row = records[i]; |
|
2565 if (row.y_form == 'Liquid') |
|
2566 row.y_weight = Math.round(row.y_amount * 17); |
|
2567 else |
|
2568 row.y_weight = row.y_amount * 1000; |
|
2569 data.push(row); |
|
2570 } |
|
2571 return data; |
|
2572 }, |
|
2573 loadError: function(jqXHR, status, error) { |
|
2574 $('#err').text(status + ' ' + error); |
|
2575 }, |
|
2576 }); |
|
2577 $("#yeastGrid").jqxGrid({ |
2490 $("#yeastGrid").jqxGrid({ |
2578 width: 1050, |
2491 width: 1240, |
2579 height: 300, |
2492 height: 400, |
2580 source: yeastAdapter, |
2493 source: yeastAdapter, |
2581 theme: theme, |
2494 theme: theme, |
2582 selectionmode: 'singlerow', |
2495 selectionmode: 'singlerow', |
2583 editmode: 'selectedcell', |
|
2584 editable: true, |
|
2585 localization: getLocalization(), |
2496 localization: getLocalization(), |
2586 showtoolbar: true, |
2497 showtoolbar: true, |
2587 rendertoolbar: function (toolbar) { |
2498 rendertoolbar: function (toolbar) { |
2588 var me = this; |
2499 var me = this; |
2589 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
2500 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
2590 toolbar.append(container); |
2501 toolbar.append(container); |
2591 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>'); |
2502 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>'); |
2592 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
2503 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
2593 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>'); |
2504 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>'); |
2594 container.append('<input style="float: left; margin-left: 230px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />'); |
2505 container.append('<input style="float: left; margin-left: 400px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />'); |
2595 // add yeast from dropdownlist. |
2506 // add yeast from dropdownlist. |
2596 $("#yaddrowbutton").jqxDropDownList({ |
2507 $("#yaddrowbutton").jqxDropDownList({ |
2597 placeHolder: "Kies gist:", |
2508 placeHolder: "Kies gist:", |
2598 theme: theme, |
2509 theme: theme, |
2599 source: yeastlist, |
2510 source: yeastlist, |
|
2511 template: "primary", |
2600 displayMember: "name", |
2512 displayMember: "name", |
2601 width: 150, |
2513 width: 150, |
2602 height: 27, |
2514 height: 27, |
2603 dropDownWidth: 500, |
2515 dropDownWidth: 500, |
2604 dropDownHeight: 500, |
2516 dropDownHeight: 500, |
2652 ready: function() { |
2560 ready: function() { |
2653 calcSVG(); |
2561 calcSVG(); |
2654 $('#jqxTabs').jqxTabs('next'); |
2562 $('#jqxTabs').jqxTabs('next'); |
2655 }, |
2563 }, |
2656 columns: [ |
2564 columns: [ |
2657 { text: 'Gist', editable: false, datafield: 'y_name' }, |
2565 { text: 'Gist', datafield: 'y_name' }, |
2658 { text: 'Laboratorium', editable: false, width: 150, datafield: 'y_laboratory' }, |
2566 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' }, |
2659 { text: 'Code', editable: false, width: 90, datafield: 'y_product_id' }, |
2567 { text: 'Code', width: 90, datafield: 'y_product_id' }, |
2660 { text: 'Soort', editable: false, width: 80, align: 'center', cellsalign: 'center', datafield: 'y_form' }, |
2568 { text: 'Soort', width: 100, datafield: 'y_form', |
2661 { text: 'Min.', editable: false, width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' }, |
2569 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2662 { text: 'Max.', editable: false, width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' }, |
2570 return "<div style='margin: 4px;'>" + YeastFormData[value].nl + "</div>"; |
2663 { text: 'Attn.', editable: false, width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' }, |
2571 } |
2664 { text: 'Voor', width: 100, align: 'center', cellsalign: 'center', datafield: 'y_use', columntype: 'dropdownlist', |
2572 }, |
2665 createeditor: function (row, column, editor) { |
2573 { text: 'Min. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' }, |
2666 var srcYUse = [ "Primary", "Secondary", "Bottle" ]; |
2574 { text: 'Max. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' }, |
2667 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcYUse }); |
2575 { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' }, |
|
2576 { text: 'Voor', width: 120, datafield: 'y_use', |
|
2577 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
|
2578 return "<div style='margin: 4px;'>" + YeastUseData[value].nl + "</div>"; |
2668 } |
2579 } |
2669 }, |
2580 }, |
2670 { datafield: 'y_amount', width: 90 }, |
2581 { text: 'Hoeveel', datafield: 'y_amount', width: 100, align: 'right', |
2671 { text: 'Hoeveel', datafield: 'y_weight', width: 110, align: 'right', cellsalign: 'right', |
2582 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2672 cellsformat: 'f1', columntype: 'numberinput', |
2583 if (rowdata.y_form == 0) { // Liquid |
2673 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2584 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" pk</div>"; |
2674 if (rowdata.y_form == 'Liquid') { |
2585 } else if (rowdata.y_form == 1) { // Dry |
2675 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" pk</div>"; |
2586 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value*1000, "f1")+" gr</div>"; |
2676 } else if (rowdata.y_form == 'Dry') { |
2587 } else { |
2677 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f1")+" gr</div>"; |
2588 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value*1000, "f0")+" ml</div>"; |
2678 } else { |
2589 } |
2679 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" ml</div>"; |
2590 } |
2680 } |
2591 }, |
2681 }, |
2592 { text: 'Voorraad', datafield: 'y_inventory', width: 100, align: 'right', |
2682 initeditor: function (row, cellvalue, editor, celltext, pressedChar) { |
2593 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2683 var form = $("#yeastGrid").jqxGrid('getcellvalue', args.rowindex, 'y_form'); |
2594 if (rowdata.y_form == 0) { // Liquid |
2684 if (form == 'Dry') { |
2595 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" pk</div>"; |
2685 editor.jqxNumberInput({ decimalDigits: 1, min: 0, spinButtons: false }); |
2596 } else if (rowdata.y_form == 1) { // Dry |
2686 } else { |
2597 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value*1000, "f1")+" gr</div>"; |
2687 editor.jqxNumberInput({ decimalDigits: 0, min: 0, spinButtons: false }); |
2598 } else { |
2688 } |
2599 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value*1000, "f0")+" ml</div>"; |
2689 }, |
2600 } |
2690 validation: function (cell, value) { |
2601 } |
2691 if (value < 0 || value > 100000000000 ) { |
2602 }, |
2692 return { result: false, message: "Hoeveelheid moet 0-~ zijn" }; |
2603 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
2693 } |
2604 return "Wijzig"; |
2694 return true; |
2605 }, buttonclick: function (row) { |
2695 } |
2606 yeastRow = row; |
2696 } |
2607 yeastData = $("#yeastGrid").jqxGrid('getrowdata', yeastRow); |
|
2608 if (yeastData.y_form == 0) { |
|
2609 $("#wy_pmpt_amount").html("Pak(ken):"); |
|
2610 $("#wy_amount").val(yeastData.y_amount); |
|
2611 $("#wy_amount").jqxNumberInput({ decimalDigits: 0, spinButtonsStep: 1 }); |
|
2612 } else if (yeastData.y_form == 1) { |
|
2613 $("#wy_pmpt_amount").html("Gewicht gram:"); |
|
2614 $("#wy_amount").val(yeastData.y_amount * 1000); |
|
2615 $("#wy_amount").jqxNumberInput({ decimalDigits: 1, spinButtonsStep: 0.5 }); |
|
2616 } else { |
|
2617 $("#wy_pmpt_amount").html("Volume ml:"); |
|
2618 $("#wy_amount").val(yeastData.y_amount * 1000); |
|
2619 $("#wy_amount").jqxNumberInput({ decimalDigits: 0, spinButtonsStep: 1 }); |
|
2620 } |
|
2621 $("#wy_name").val(yeastData.y_name); |
|
2622 $("#wy_laboratory").val(yeastData.y_laboratory); |
|
2623 $("#wy_product_id").val(yeastData.y_product_id); |
|
2624 $("#wy_use").val(yeastData.y_use); |
|
2625 // show the popup window. |
|
2626 $("#popupYeast").jqxWindow('open'); |
|
2627 } |
|
2628 } |
2697 ] |
2629 ] |
2698 }); |
|
2699 $("#yeastGrid").on('cellendedit', function (event) { |
|
2700 var args = event.args; |
|
2701 console.log("Event Type: cellendedit, Column: " + args.datafield + ", Row: " + (args.rowindex) + ", Value: " + args.value); |
|
2702 $("#yeastGrid").jqxGrid('setcellvalue', args.rowindex, args.datafield, args.value); |
|
2703 if (args.datafield == 'y_weight') { |
|
2704 var form = $("#yeastGrid").jqxGrid('getcellvalue', args.rowindex, 'y_form'); |
|
2705 if (form == 'Liquid') |
|
2706 $("#yeastGrid").jqxGrid('setcellvalue', args.rowindex, 'y_amount', parseFloat(args.value * 0.0588)); |
|
2707 else |
|
2708 $("#yeastGrid").jqxGrid('setcellvalue', args.rowindex, 'y_amount', parseFloat(args.value / 1000)); |
|
2709 } |
|
2710 }); |
2630 }); |
2711 }; |
2631 }; |
2712 |
2632 |
2713 // inline mash editor |
2633 // inline mash editor |
2714 var editMash = function (data) { |
2634 var editMash = function (data) { |
2747 beforeLoadComplete: function (records) { |
2668 beforeLoadComplete: function (records) { |
2748 mash_infuse = 0; |
2669 mash_infuse = 0; |
2749 var data = new Array(); |
2670 var data = new Array(); |
2750 for (var i = 0; i < records.length; i++) { |
2671 for (var i = 0; i < records.length; i++) { |
2751 var row = records[i]; |
2672 var row = records[i]; |
2752 if (row.step_type == 'Infusion') |
2673 if (row.step_type == 0) // Infusion |
2753 mash_infuse += parseFloat(row.step_infuse_amount); |
2674 mash_infuse += parseFloat(row.step_infuse_amount); |
2754 } |
2675 } |
2755 }, |
2676 }, |
2756 }); |
2677 }); |
2757 $("#mashGrid").jqxGrid({ |
2678 $("#mashGrid").jqxGrid({ |
2758 width: 960, |
2679 width: 1240, |
2759 height: 400, |
2680 height: 400, |
2760 source: mashAdapter, |
2681 source: mashAdapter, |
2761 theme: theme, |
2682 theme: theme, |
2762 selectionmode: 'singlerow', |
2683 selectionmode: 'singlerow', |
2763 editmode: 'selectedcell', |
|
2764 editable: true, |
|
2765 localization: getLocalization(), |
2684 localization: getLocalization(), |
2766 showtoolbar: true, |
2685 showtoolbar: true, |
2767 rendertoolbar: function (toolbar) { |
2686 rendertoolbar: function (toolbar) { |
2768 var me = this; |
2687 var me = this; |
2769 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
2688 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
2770 toolbar.append(container); |
2689 toolbar.append(container); |
2771 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); |
2690 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); |
2772 container.append('<input style="float: left; margin-left: 230px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); |
2691 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); |
2773 $("#saddrowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
2692 $("#saddrowbutton").jqxButton({ template: "primary", theme: theme, height: 27, width: 150 }); |
2774 $("#saddrowbutton").on('click', function () { |
2693 $("#saddrowbutton").on('click', function () { |
2775 var datarow = generaterow(); |
2694 var datarow = generaterow(); |
2776 var commit = $("#mashGrid").jqxGrid('addrow', null, datarow); |
2695 var commit = $("#mashGrid").jqxGrid('addrow', null, datarow); |
2777 }); |
2696 }); |
2778 // delete selected yeast. |
2697 // delete selected step. |
2779 $("#sdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
2698 $("#sdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 }); |
2780 $("#sdeleterowbutton").on('click', function () { |
2699 $("#sdeleterowbutton").on('click', function () { |
2781 var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex'); |
2700 var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex'); |
2782 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; |
2701 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; |
2783 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
2702 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
2784 var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex); |
2703 var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex); |
2785 var commit = $("#mashGrid").jqxGrid('deleterow', id); |
2704 var commit = $("#mashGrid").jqxGrid('deleterow', id); |
2786 } |
2705 } |
2787 }); |
2706 }); |
2788 }, |
2707 }, |
2789 ready: function() { |
2708 ready: function() { |
2790 var fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, parseFloat(parseFloat($("#est_og").jqxNumberInput('decimal')))); |
2709 calcFG(); |
2791 dataRecord.est_fg = fg; |
|
2792 $('#est_fg').val(fg); |
|
2793 $('#est_fg2').val(fg); |
|
2794 calcInit(); |
2710 calcInit(); |
2795 $('#jqxLoader').jqxLoader('close'); |
2711 $('#jqxLoader').jqxLoader('close'); |
2796 $('#jqxTabs').jqxTabs('first'); |
2712 $('#jqxTabs').jqxTabs('first'); |
2797 }, |
2713 }, |
2798 columns: [ |
2714 columns: [ |
2799 { text: 'Stap naam', datafield: 'step_name' }, |
2715 { text: 'Stap naam', datafield: 'step_name' }, |
2800 { text: 'Stap type', datafield: 'step_type', width: 110, columntype: 'dropdownlist', |
2716 { text: 'Stap type', datafield: 'step_type', width: 175, |
2801 createeditor: function (row, cellvalue, editor, celltext, cellwidth, cellheight) { |
2717 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2802 var dataSource = [ "Infusion", "Temperature", "Decoction" ]; |
2718 return "<div style='margin: 4px;'>" + MashStepTypeData[value].nl + "</div>"; |
2803 editor.jqxDropDownList({ source: dataSource, dropDownHeight: 105 }); |
|
2804 } |
2719 } |
2805 }, |
2720 }, |
2806 { text: 'Temperatuur', datafield: 'step_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
2721 { text: 'Start °C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
2807 validation: function (cell, value) { |
2722 { text: 'Eind °C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
2808 if (value < 35 || value > 80) { |
2723 { text: 'Tijd', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' }, |
2809 return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; |
2724 { text: 'Stap', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' }, |
2810 } |
2725 { text: 'Infuse', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right' }, |
2811 return true; |
2726 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
2812 } |
2727 return "Wijzig"; |
2813 }, |
2728 }, buttonclick: function (row) { |
2814 { text: 'Eind', datafield: 'end_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
2729 mashRow = row; |
2815 validation: function (cell, value) { |
2730 mashData = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
2816 if (value < 35 || value > 80) { |
2731 $("#wstep_name").val(mashData.step_name); |
2817 return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; |
2732 $("#wstep_type").val(mashData.step_type); |
2818 } |
2733 $("#wstep_infuse_amount").val(mashData.step_infuse_amount); |
2819 return true; |
2734 $("#wstep_temp").val(mashData.step_temp); |
2820 } |
2735 $("#wend_temp").val(mashData.end_temp); |
2821 }, |
2736 $("#wstep_time").val(mashData.step_time); |
2822 { text: 'Tijd', datafield: 'step_time', width: 70, align: 'right', cellsalign: 'right', |
2737 $("#wramp_time").val(mashData.ramp_time); |
2823 validation: function (cell, value) { |
2738 if (mashData.step_type == 0) { |
2824 if (value < 1 || value > 360) { |
2739 $("#wstep_infuse_amount").show(); |
2825 return { result: false, message: "De tijd moet tussen 1 en 360 zijn." }; |
2740 $("#wstep_pmpt").show(); |
2826 } |
2741 } else { |
2827 return true; |
2742 $("#wstep_infuse_amount").hide(); |
2828 } |
2743 $("#wstep_pmpt").hide(); |
2829 }, |
2744 } |
2830 { text: 'Stap', datafield: 'ramp_time', width: 70, align: 'right', cellsalign: 'right', |
2745 // show the popup window. |
2831 validation: function (cell, value) { |
2746 $("#popupMash").jqxWindow('open'); |
2832 if (value < 1 || value > 60) { |
2747 } |
2833 return { result: false, message: "De tijd moet tussen 1 en 60 zijn." }; |
2748 } |
2834 } |
|
2835 return true; |
|
2836 } |
|
2837 }, |
|
2838 { text: 'Infuse', datafield: 'step_infuse_amount', width: 70, align: 'right', cellsalign: 'right', |
|
2839 validation: function (cell, value) { |
|
2840 if (value < 0 || value > 60) { |
|
2841 return { result: false, message: "De waarde moet tussen 0 en 60 zijn." }; |
|
2842 } |
|
2843 return true; |
|
2844 } |
|
2845 } |
|
2846 ] |
2749 ] |
2847 }); |
2750 }); |
2848 $("#mashGrid").on('cellendedit', function (event) { |
|
2849 $('#mashGrid').jqxGrid('sortby', 'step_temp', 'asc'); |
|
2850 }); |
|
2851 }; |
2751 }; |
2852 |
2752 |
2853 // initialize the input fields. |
2753 // initialize the input fields. |
2854 var srcType = [ "All Grain", "Partial Mash", "Extract" ]; |
2754 // var srcType = [ "All Grain", "Partial Mash", "Extract" ]; |
2855 var srcColor = [ "Morey", "Mosher", "Daniels" ]; |
2755 var srcColor = [ "Morey", "Mosher", "Daniels" ]; |
2856 var srcIBU = [ "Tinseth", "Rager", "Daniels" ]; // Only these are supported at this time. |
2756 var srcIBU = [ "Tinseth", "Rager", "Daniels" ]; // Only these are supported at this time. |
2857 var srcBase = [ "NaHCO3", "Na2CO3", "CaCO3", "Ca(OH)2" ]; |
2757 var srcBase = [ "NaHCO3", "Na2CO3", "CaCO3", "Ca(OH)2" ]; |
2858 var srcAcid = [ "Melkzuur", "Zoutzuur", "Fosforzuur", "Zwavelzuur" ]; |
2758 var srcAcid = [ "Melkzuur", "Zoutzuur", "Fosforzuur", "Zwavelzuur" ]; |
2859 var srcSource = [ "Bron 1", "Bron 2", "Gemengd" ]; |
2759 var srcSource = [ "Bron 1", "Bron 2", "Gemengd" ]; |
2916 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); |
2826 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); |
2917 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); |
2827 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); |
2918 $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
2828 $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
2919 |
2829 |
2920 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); |
2830 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); |
2921 $("#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 }); |
2831 $("#est_og").jqxNumberInput( SGopts ); |
2922 $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); |
2832 $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); |
2923 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
2833 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
2924 $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); |
2834 $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); |
2925 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
2835 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
|
2836 |
2926 $("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); |
2837 $("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); |
2927 $("#est_fg").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 3, readOnly: true }); |
2838 $("#est_fg").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); |
2928 $("#est_fg2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 70, height: 23, decimalDigits: 3, readOnly: true }); |
|
2929 $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); |
2839 $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); |
2930 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
2840 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
2931 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); |
2841 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); |
2932 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
2842 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
|
2843 |
2933 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
2844 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
2934 $("#est_abv").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
2845 $("#est_abv").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
2935 $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); |
2846 $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); |
2936 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
2847 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
2937 $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); |
2848 $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); |
2938 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
2849 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
|
2850 |
2939 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
2851 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
2940 $("#est_color").jqxNumberInput({ inputMode: 'simple', theme: theme, symbol: ' EBC', symbolPosition: 'right', width: 100, height: 23, decimalDigits: 0, readOnly: true }); |
2852 $("#est_color").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); |
2941 $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); |
2853 $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); |
2942 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
2854 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
2943 $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); |
2855 $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); |
2944 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
2856 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
2945 $("#color_method").jqxDropDownList({ theme: theme, source: srcColor, width: 125, height: 23, dropDownHeight: 95 }); |
2857 $("#color_method").jqxDropDownList({ |
|
2858 theme: theme, |
|
2859 source: ColorMethodAdapter, |
|
2860 valueMember: 'id', |
|
2861 displayMember: 'nl', |
|
2862 width: 180, |
|
2863 height: 23, |
|
2864 autoDropDownHeight: true |
|
2865 }); |
|
2866 |
2946 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
2867 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
2947 $("#est_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, symbol: ' IBU', symbolPosition: 'right', width: 100, height: 23, decimalDigits: 0, readOnly: true }); |
2868 $("#est_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); |
2948 $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); |
2869 $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); |
2949 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
2870 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
2950 $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); |
2871 $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); |
2951 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
2872 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
2952 $("#ibu_method").jqxDropDownList({ theme: theme, source: srcIBU, width: 125, height: 23, dropDownHeight: 95, dropDownVerticalAlignment: 'top' }); |
2873 $("#ibu_method").jqxDropDownList({ |
|
2874 theme: theme, |
|
2875 source: IBUmethodAdapter, |
|
2876 valueMember: 'id', |
|
2877 displayMember: 'nl', |
|
2878 width: 180, |
|
2879 height: 23, |
|
2880 autoDropDownHeight: true, |
|
2881 dropDownVerticalAlignment: 'top' |
|
2882 }); |
|
2883 |
2953 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); |
2884 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); |
2954 $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
2885 $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
2955 $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); |
2886 $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); |
2956 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
2887 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
2957 $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); |
2888 $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); |
2993 $("#eq_efficiency").jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' }); |
2924 $("#eq_efficiency").jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' }); |
2994 $("#eq_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); |
2925 $("#eq_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); |
2995 |
2926 |
2996 // Tab 3, Fermentables |
2927 // Tab 3, Fermentables |
2997 $("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
2928 $("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
2998 $("#est_color2").jqxNumberInput({ inputMode: 'simple', theme: theme, symbol: ' EBC', symbolPosition: 'right', width: 100, height: 23, decimalDigits: 0, readOnly: true }); |
2929 $("#est_color2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); |
|
2930 $("#est_og2").jqxTooltip({ content: 'Het geschatte begin SG van dit product.' }); |
|
2931 $("#est_og2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); |
2999 $("#perc_malts").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
2932 $("#perc_malts").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
3000 $("#est_og2").jqxTooltip({ content: 'Het geschatte begin SG van dit product.' }); |
|
3001 $("#est_og2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 3, readOnly: true }); |
|
3002 $("#perc_sugars").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
2933 $("#perc_sugars").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
3003 $("#perc_cara").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
2934 $("#perc_cara").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
|
2935 $("#popupFermentable").jqxWindow({ |
|
2936 width: 800, |
|
2937 height: 300, |
|
2938 position: { x: 230, y: 100 }, |
|
2939 resizable: false, |
|
2940 theme: theme, |
|
2941 isModal: true, |
|
2942 autoOpen: false, |
|
2943 cancelButton: $("#FermentableReady"), |
|
2944 modalOpacity: 0.40 |
|
2945 }); |
|
2946 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
|
2947 $("#FermentableReady").click(function () { |
|
2948 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc'); |
|
2949 // Recalc percentages |
|
2950 calcFermentables(); |
|
2951 calcSVG(); |
|
2952 calcFG(); |
|
2953 calcABV(); |
|
2954 calcIBUs(); |
|
2955 // Waters: yes there is impact. |
|
2956 }); |
|
2957 $("#wf_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
2958 $("#wf_instock").jqxCheckBox({ theme: theme, height: 23 }); |
|
2959 $("#wf_instock").on('change', function (event) { |
|
2960 fermentableinstock = event.args.checked; |
|
2961 fermentablelist.dataBind(); |
|
2962 }); |
|
2963 $("#wf_select").jqxDropDownList({ |
|
2964 placeHolder: "Kies mout:", |
|
2965 theme: theme, |
|
2966 source: fermentablelist, |
|
2967 displayMember: "name", |
|
2968 width: 150, |
|
2969 height: 23, |
|
2970 dropDownWidth: 500, |
|
2971 dropDownHeight: 500, |
|
2972 renderer: function (index, label, value) { |
|
2973 var datarecord = fermentablelist.records[index]; |
|
2974 return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)"; |
|
2975 } |
|
2976 }); |
|
2977 $("#wf_select").on('select', function (event) { |
|
2978 if (event.args) { |
|
2979 var index = event.args.index; |
|
2980 var datarecord = fermentablelist.records[index]; |
|
2981 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
|
2982 $("#wf_name").val(datarecord.name); |
|
2983 rowdata.f_name = datarecord.name; |
|
2984 rowdata.f_origin = datarecord.origin; |
|
2985 rowdata.f_supplier = datarecord.supplier; |
|
2986 rowdata.f_type = datarecord.type; |
|
2987 rowdata.f_cost = datarecord.cost; |
|
2988 rowdata.f_yield = datarecord.yield; |
|
2989 rowdata.f_color = datarecord.color; |
|
2990 rowdata.f_coarse_fine_diff = datarecord.coarse_fine_diff; |
|
2991 rowdata.f_moisture = datarecord.moisture; |
|
2992 rowdata.f_diastatic_power = datarecord.diastatic_power; |
|
2993 rowdata.f_protein = datarecord.protein; |
|
2994 rowdata.f_max_in_batch = datarecord.max_in_batch; |
|
2995 rowdata.f_graintype = datarecord.graintype; |
|
2996 rowdata.f_dissolved_protein = datarecord.dissolved_protein; |
|
2997 rowdata.f_recommend_mash = datarecord.recommend_mash; |
|
2998 rowdata.f_add_after_boil = datarecord.add_after_boil; |
|
2999 rowdata.f_di_ph = datarecord.di_ph; |
|
3000 rowdata.f_acid_to_ph_57 = datarecord.acid_to_ph_57; |
|
3001 rowdata.f_inventory = datarecord.inventory; |
|
3002 } |
|
3003 }); |
|
3004 $("#wf_amount").jqxNumberInput( Spin3dec5 ); |
|
3005 $('#wf_amount').on('change', function (event) { |
|
3006 console.log("amount changed: "+event.args.value); |
|
3007 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value); |
|
3008 if (! to_100) { |
|
3009 // Recalculate percentages |
|
3010 console.log("adjust percentages"); |
|
3011 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
|
3012 if (rowscount > 1) { |
|
3013 var tw = 0; |
|
3014 for (i = 0; i < rowscount; i++) { |
|
3015 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
3016 tw += rowdata.f_amount; |
|
3017 }; |
|
3018 for (i = 0; i < rowscount; i++) { |
|
3019 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
3020 var percentage = Math.round(rowdata.f_amount / tw * 1000) / 10.0; |
|
3021 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_percentage", percentage); |
|
3022 // if (i == fermentableRow) // Will crash the script. |
|
3023 // $("#wf_percentage").val(percentage); |
|
3024 }; |
|
3025 } else { |
|
3026 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100); |
|
3027 } |
|
3028 calcFermentables(); |
|
3029 }; |
|
3030 }); |
|
3031 $("#wf_percentage").jqxNumberInput( Perc1dec1 ); |
|
3032 $("#wf_percentage").on('change', function (event) { |
|
3033 var oldvalue = Math.round(fermentableData.f_percentage * 10) / 10.0; |
|
3034 var newvalue = event.args.value; |
|
3035 console.log("percentage changed: "+newvalue+" old: "+oldvalue); |
|
3036 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
|
3037 if ((oldvalue != newvalue) && (rowscount > 1)) { |
|
3038 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
|
3039 if (rowdata.f_adjust_to_total_100) { |
|
3040 $("#wf_percentage").val(oldvalue); |
|
3041 } else { |
|
3042 var diff = newvalue - oldvalue; |
|
3043 var tw = 0; // total weight |
|
3044 for (i = 0; i < rowscount; i++) { |
|
3045 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
3046 tw += rowdata.f_amount; |
|
3047 } |
|
3048 if (to_100) { |
|
3049 // Adjust this row and the 100% row. |
|
3050 var damount = tw * diff / 100; |
|
3051 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
|
3052 var namount = rowdata.f_amount + damount; |
|
3053 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', namount); |
|
3054 $("#wf_amount").val(namount); |
|
3055 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_percentage', rowdata.f_percentage + diff); |
|
3056 for (i = 0; i < rowscount; i++) { |
|
3057 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
3058 if (rowdata.f_adjust_to_total_100) { |
|
3059 namount = rowdata.f_amount - damount; |
|
3060 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff); |
|
3061 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount); |
|
3062 } |
|
3063 } |
|
3064 calcFermentables(); |
|
3065 } else { |
|
3066 // Adjust all the rows. |
|
3067 var nw = tw * diff / 100; |
|
3068 for (i = 0; i < rowscount; i++) { |
|
3069 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
3070 if (i == fermentableRow) { |
|
3071 var namount = rowdata.f_amount + nw; |
|
3072 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount); |
|
3073 // $("#wf_amount").val(namount); // Will crash the script. |
|
3074 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', newvalue); |
|
3075 } else { |
|
3076 var namount = rowdata.f_amount - (nw / (rowscount - 1)); |
|
3077 var newperc = Math.round((namount / tw) * 1000) / 10.0; |
|
3078 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount); |
|
3079 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', newperc); |
|
3080 } |
|
3081 } |
|
3082 calcFermentables(); |
|
3083 } |
|
3084 } |
|
3085 } |
|
3086 }); |
|
3087 $("#wf_adjust_to_total_100").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
|
3088 $("#wf_adjust_to_total_100").on('checked', function (event) { |
|
3089 if (fermentableData.f_adjust_to_total_100 == 0) { |
|
3090 if (to_100) { |
|
3091 // Reset other flag first. |
|
3092 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
|
3093 for (var i = 0; i < rowscount; i++) { |
|
3094 if (i != fermentableRow) { |
|
3095 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_adjust_to_total_100', 0); |
|
3096 } |
|
3097 } |
|
3098 } |
|
3099 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 1); |
|
3100 calcFermentables(); |
|
3101 } |
|
3102 }); |
|
3103 $("#wf_adjust_to_total_100").on('unchecked', function (event) { |
|
3104 if (fermentableData.f_adjust_to_total_100 != 0) { |
|
3105 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 0); |
|
3106 calcFermentables(); |
|
3107 } |
|
3108 }); |
|
3109 $("#wf_added").jqxDropDownList({ |
|
3110 theme: theme, |
|
3111 source: AddedAdapter, |
|
3112 valueMember: 'id', |
|
3113 displayMember: 'nl', |
|
3114 width: 180, |
|
3115 height: 23, |
|
3116 autoDropDownHeight: true, |
|
3117 dropDownVerticalAlignment: 'top' |
|
3118 }); |
3004 |
3119 |
3005 // Tab 4, Hops |
3120 // Tab 4, Hops |
3006 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
3121 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
3007 $("#est_ibu2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
3122 $("#est_ibu2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
3008 $("#hop_flavour").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
3123 $("#hop_flavour").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
3009 $("#hop_aroma").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
3124 $("#hop_aroma").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
|
3125 $("#popupHop").jqxWindow({ |
|
3126 width: 800, |
|
3127 height: 300, |
|
3128 position: { x: 230, y: 100 }, |
|
3129 resizable: false, |
|
3130 theme: theme, |
|
3131 isModal: true, |
|
3132 autoOpen: false, |
|
3133 cancelButton: $("#HopReady"), |
|
3134 modalOpacity: 0.40 |
|
3135 }); |
|
3136 $("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
|
3137 $("#HopReady").click(function () { |
|
3138 $("#hopGrid").jqxGrid('sortby', 'h_amount', 'asc'); |
|
3139 calcIBUs(); |
|
3140 }); |
|
3141 $("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
3142 $("#wh_instock").jqxCheckBox({ theme: theme, height: 23 }); |
|
3143 $("#wh_instock").on('change', function (event) { |
|
3144 hopinstock = event.args.checked; |
|
3145 hoplist.dataBind(); |
|
3146 }); |
|
3147 $("#wh_select").jqxDropDownList({ |
|
3148 placeHolder: "Kies hop:", |
|
3149 theme: theme, |
|
3150 source: hoplist, |
|
3151 displayMember: "name", |
|
3152 width: 150, |
|
3153 height: 23, |
|
3154 dropDownWidth: 500, |
|
3155 dropDownHeight: 500, |
|
3156 renderer: function (index, label, value) { |
|
3157 var datarecord = hoplist.records[index]; |
|
3158 return datarecord.origin+ " / " + datarecord.name + " (" + datarecord.alpha + " % α)"; |
|
3159 } |
|
3160 }); |
|
3161 $("#wh_select").on('select', function (event) { |
|
3162 if (event.args) { |
|
3163 var index = event.args.index; |
|
3164 var datarecord = hoplist.records[index]; |
|
3165 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); |
|
3166 $("#wh_name").val(datarecord.name); |
|
3167 rowdata.h_name = datarecord.name; |
|
3168 rowdata.h_origin = datarecord.origin; |
|
3169 rowdata.h_cost = datarecord.cost; |
|
3170 rowdata.h_type = datarecord.type; |
|
3171 rowdata.h_form = datarecord.form; |
|
3172 rowdata.h_alpha = datarecord.alpha; |
|
3173 rowdata.h_beta = datarecord.beta; |
|
3174 rowdata.h_hsi = datarecord.hsi; |
|
3175 rowdata.h_humulene = datarecord.humulene; |
|
3176 rowdata.h_caryophyllene = datarecord.caryophyllene; |
|
3177 rowdata.h_cohumulone = datarecord.cohumulone; |
|
3178 rowdata.h_myrcene = datarecord.myrcene; |
|
3179 rowdata.h_total_oil = datarecord.total_oil; |
|
3180 rowdata.h_inventory = datarecord.inventory; |
|
3181 } |
|
3182 }); |
|
3183 $("#wh_amount").jqxNumberInput( Spin1dec1 ); |
|
3184 $('#wh_amount').on('change', function (event) { |
|
3185 console.log("amount changed: "+event.args.value); |
|
3186 var amount = parseFloat(event.args.value) / 1000; |
|
3187 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); |
|
3188 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, |
|
3189 parseFloat($("#batch_size").jqxNumberInput('decimal')), |
|
3190 amount, parseFloat(rowdata.h_time), |
|
3191 parseFloat(rowdata.h_alpha), $("#ibu_method").val() |
|
3192 ); |
|
3193 rowdata.h_amount = amount; |
|
3194 calcIBUs(); |
|
3195 }); |
|
3196 $("#wh_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); |
|
3197 $("#wh_time").jqxNumberInput( PosInt ); |
|
3198 $("#wh_time").on('change', function (event) { |
|
3199 console.log("time changed: "+event.args.value); |
|
3200 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); |
|
3201 var newtime = parseFloat(event.args.value); |
|
3202 // Check limits and correct |
|
3203 if (rowdata.h_useat == 2) { // Boil |
|
3204 if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) { |
|
3205 newtime = parseFloat($("#boil_time").jqxNumberInput('decimal')); |
|
3206 $("#wh_time").val(newtime); |
|
3207 } |
|
3208 rowdata.h_time = newtime; |
|
3209 } else if (rowdata.h_useat == 4) { // Whirlpool |
|
3210 if (newtime > 120) { |
|
3211 newtime = 120; |
|
3212 $("#wh_time").val(newtime); |
|
3213 } |
|
3214 rowdata.h_time = newtime; |
|
3215 } else if (rowdata.h_useat == 5) { // Dry hop |
|
3216 if (newtime > 21) { |
|
3217 newtime = 21; |
|
3218 $("#wh_time").val(newtime); |
|
3219 } |
|
3220 rowdata.h_time = newtime * 1440; |
|
3221 } |
|
3222 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')), |
|
3223 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), $("#ibu_method").val()); |
|
3224 $("#wh_ibu").val(ibu); |
|
3225 calcIBUs(); |
|
3226 }); |
|
3227 $("#wh_useat").jqxDropDownList({ |
|
3228 theme: theme, |
|
3229 source: HopUseAdapter, |
|
3230 valueMember: 'id', |
|
3231 displayMember: 'nl', |
|
3232 width: 180, |
|
3233 height: 23, |
|
3234 autoDropDownHeight: true, |
|
3235 dropDownVerticalAlignment: 'top' |
|
3236 }); |
|
3237 $("#wh_useat").on('select', function (event) { |
|
3238 if (event.args) { |
|
3239 var index = event.args.index; |
|
3240 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); |
|
3241 rowdata.h_useat = index; |
|
3242 if ((index == 0) || (index == 1)) { // Mashhop or First wort hop |
|
3243 rowdata.h_time = parseFloat(dataRecord.boil_time); |
|
3244 $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
|
3245 $("#wh_time").val(rowdata.h_time); |
|
3246 } else if (index == 3) { // Aroma |
|
3247 rowdata.h_time = 0; |
|
3248 $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
|
3249 $("#wh_time").val(0); |
|
3250 } else { // Boil, Whirlpool or Dry hop |
|
3251 $("#wh_time").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
|
3252 } |
|
3253 if (index == 5) // Dry hop |
|
3254 $("#wh_pmpt_time").html("Tijd in dagen"); |
|
3255 else |
|
3256 $("#wh_pmpt_time").html("Tijd in minuten"); |
|
3257 } |
|
3258 }); |
3010 |
3259 |
3011 // Tab 5, Miscs |
3260 // Tab 5, Miscs |
|
3261 $("#popupMisc").jqxWindow({ |
|
3262 width: 800, |
|
3263 height: 275, |
|
3264 position: { x: 230, y: 100 }, |
|
3265 resizable: false, |
|
3266 theme: theme, |
|
3267 isModal: true, |
|
3268 autoOpen: false, |
|
3269 cancelButton: $("#MiscReady"), |
|
3270 modalOpacity: 0.40 |
|
3271 }); |
|
3272 $("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
|
3273 $("#MiscReady").click(function () { |
|
3274 $("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc'); |
|
3275 }); |
|
3276 $("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
3277 $("#wm_instock").jqxCheckBox({ theme: theme, height: 23 }); |
|
3278 $("#wm_instock").on('change', function (event) { |
|
3279 miscinstock = event.args.checked; |
|
3280 misclist.dataBind(); |
|
3281 }); |
|
3282 $("#wm_select").jqxDropDownList({ |
|
3283 placeHolder: "Kies ingrediënt:", |
|
3284 theme: theme, |
|
3285 source: misclist, |
|
3286 displayMember: "name", |
|
3287 width: 150, |
|
3288 height: 23, |
|
3289 dropDownWidth: 500, |
|
3290 dropDownHeight: 500 |
|
3291 }); |
|
3292 $("#wm_select").on('select', function (event) { |
|
3293 if (event.args) { |
|
3294 var index = event.args.index; |
|
3295 var datarecord = misclist.records[index]; |
|
3296 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
|
3297 $("#wm_name").val(datarecord.name); |
|
3298 rowdata.m_name = datarecord.name; |
|
3299 rowdata.m_cost = datarecord.cost; |
|
3300 rowdata.m_type = datarecord.type; |
|
3301 rowdata.m_use_use = datarecord.use_use; |
|
3302 rowdata.m_amount_is_weight = datarecord.amount_is_weight; |
|
3303 rowdata.m_inventory = datarecord.inventory; |
|
3304 } |
|
3305 }); |
|
3306 $("#wm_amount").jqxNumberInput( Spin1dec1 ); |
|
3307 $('#wm_amount').on('change', function (event) { |
|
3308 console.log("amount changed: "+event.args.value); |
|
3309 var amount = parseFloat(event.args.value) / 1000; |
|
3310 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
|
3311 rowdata.m_amount = amount; |
|
3312 }); |
|
3313 $("#wm_time").jqxNumberInput( PosInt ); |
|
3314 $("#wm_time").on('change', function (event) { |
|
3315 console.log("time changed: "+event.args.value); |
|
3316 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
|
3317 var newtime = parseFloat(event.args.value); |
|
3318 |
|
3319 if (rowdata.m_use_use == 2) { // Boil |
|
3320 if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) { |
|
3321 newtime = parseFloat($("#boil_time").jqxNumberInput('decimal')); |
|
3322 $("#wm_time").val(newtime); |
|
3323 } |
|
3324 rowdata.m_time = newtime; |
|
3325 } else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) { // Primary or Secondary |
|
3326 if (newtime > 21) { |
|
3327 newtime = 21; |
|
3328 $("#wm_time").val(newtime); |
|
3329 } |
|
3330 rowdata.m_time = newtime * 1440; |
|
3331 } |
|
3332 }); |
|
3333 $("#wm_use_use").jqxDropDownList({ |
|
3334 theme: theme, |
|
3335 source: MiscUseAdapter, |
|
3336 valueMember: 'id', |
|
3337 displayMember: 'nl', |
|
3338 width: 180, |
|
3339 height: 23, |
|
3340 autoDropDownHeight: true, |
|
3341 dropDownVerticalAlignment: 'top' |
|
3342 }); |
|
3343 $("#wm_use_use").on('select', function (event) { |
|
3344 if (event.args) { |
|
3345 var index = event.args.index; |
|
3346 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
|
3347 rowdata.m_use_use = index; |
|
3348 if ((index == 2) || (index == 3) || (index == 4)) { // Boil, Primary or Secondary |
|
3349 $("#wm_time").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
|
3350 } else { |
|
3351 rowdata.m_time = 0; |
|
3352 $("#wm_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
|
3353 $("#wm_time").val(0); |
|
3354 } |
|
3355 } |
|
3356 }); |
3012 |
3357 |
3013 // Tab 6, Yeasts |
3358 // Tab 6, Yeasts |
|
3359 $("#est_fg2").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); |
|
3360 $("#est_fg2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); |
|
3361 $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
|
3362 $("#est_abv2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
|
3363 $("#popupYeast").jqxWindow({ |
|
3364 width: 800, |
|
3365 height: 300, |
|
3366 position: { x: 230, y: 100 }, |
|
3367 resizable: false, |
|
3368 theme: theme, |
|
3369 isModal: true, |
|
3370 autoOpen: false, |
|
3371 cancelButton: $("#YeastReady"), |
|
3372 modalOpacity: 0.40 |
|
3373 }); |
|
3374 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
|
3375 $("#YeastReady").click(function () { |
|
3376 calcSVG(); |
|
3377 calcFG(); |
|
3378 calcABV(); |
|
3379 $("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc'); |
|
3380 }); |
|
3381 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
3382 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
3383 $("#wy_product_id").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
3384 $("#wy_instock").jqxCheckBox({ theme: theme, height: 23 }); |
|
3385 $("#wy_instock").on('change', function (event) { |
|
3386 yeastinstock = event.args.checked; |
|
3387 yeastlist.dataBind(); |
|
3388 }); |
|
3389 $("#wy_select").jqxDropDownList({ |
|
3390 placeHolder: "Kies gist:", |
|
3391 theme: theme, |
|
3392 source: yeastlist, |
|
3393 displayMember: "name", |
|
3394 width: 150, |
|
3395 height: 23, |
|
3396 dropDownWidth: 500, |
|
3397 dropDownHeight: 500, |
|
3398 renderer: function (index, label, value) { |
|
3399 var datarecord = yeastlist.records[index]; |
|
3400 return datarecord.laboratory+" "+datarecord.product_id+" "+datarecord.name; |
|
3401 } |
|
3402 }); |
|
3403 $("#wy_select").on('select', function (event) { |
|
3404 if (event.args) { |
|
3405 var index = event.args.index; |
|
3406 var datarecord = yeastlist.records[index]; |
|
3407 var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow); |
|
3408 $("#wy_name").val(datarecord.name); |
|
3409 $("#wy_laboratory").val(datarecord.laboratory); |
|
3410 $("#wy_product_id").val(datarecord.product_id); |
|
3411 rowdata.y_name = datarecord.name; |
|
3412 rowdata.y_cost = datarecord.cost; |
|
3413 rowdata.y_type = datarecord.type; |
|
3414 rowdata.y_form = datarecord.form; |
|
3415 rowdata.y_laboratory = datarecord.laboratory; |
|
3416 rowdata.y_product_id = datarecord.product_id; |
|
3417 rowdata.y_min_temperature = datarecord.min_temperature; |
|
3418 rowdata.y_max_temperature = datarecord.max_temperature; |
|
3419 rowdata.y_flocculation = datarecord.flocculation; |
|
3420 rowdata.y_attenuation = datarecord.attenuation; |
|
3421 rowdata.y_cells = datarecord.cells; |
|
3422 rowdata.y_inventory = datarecord.inventory; |
|
3423 if (rowdata.y_form == 0) { |
|
3424 $("#wy_pmpt_amount").html("Pak(ken):"); |
|
3425 } else if (rowdata.y_form == 1) { |
|
3426 $("#wy_pmpt_amount").html("Gewicht gram:"); |
|
3427 } else { |
|
3428 $("#wy_pmpt_amount").html("Volume ml:"); |
|
3429 } |
|
3430 calcSVG(); |
|
3431 calcFG(); |
|
3432 calcABV(); |
|
3433 } |
|
3434 }); |
|
3435 $("#wy_amount").jqxNumberInput( Spin1dec5 ); |
|
3436 $('#wy_amount').on('change', function (event) { |
|
3437 console.log("amount changed: "+event.args.value); |
|
3438 var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow); |
|
3439 if (rowdata.y_form == 0) // Liquid |
|
3440 var amount = parseFloat(event.args.value); |
|
3441 else |
|
3442 var amount = parseFloat(event.args.value) / 1000; |
|
3443 rowdata.y_amount = amount; |
|
3444 calcSVG(); |
|
3445 calcFG(); |
|
3446 calcABV(); |
|
3447 }); |
|
3448 $("#wy_use").jqxDropDownList({ |
|
3449 theme: theme, |
|
3450 source: YeastUseAdapter, |
|
3451 valueMember: 'id', |
|
3452 displayMember: 'nl', |
|
3453 width: 180, |
|
3454 height: 23, |
|
3455 autoDropDownHeight: true, |
|
3456 dropDownVerticalAlignment: 'top' |
|
3457 }); |
|
3458 $("#wy_use").on('select', function (event) { |
|
3459 if (event.args) { |
|
3460 var index = event.args.index; |
|
3461 var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow); |
|
3462 rowdata.y_use = index; |
|
3463 calcSVG(); |
|
3464 calcFG(); |
|
3465 calcABV(); |
|
3466 } |
|
3467 }); |
3014 |
3468 |
3015 // Tab 7, Mashing |
3469 // Tab 7, Mashing |
3016 $("#mash_name").jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' }); |
3470 $("#mash_name").jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' }); |
3017 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
3471 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
3472 $("#mash_select").jqxDropDownList({ |
|
3473 placeHolder: "Kies schema:", |
|
3474 theme: theme, |
|
3475 source: mashlist, |
|
3476 displayMember: "name", |
|
3477 width: 250, |
|
3478 height: 23, |
|
3479 dropDownWidth: 500, |
|
3480 dropDownHeight: 500, |
|
3481 dropDownHorizontalAlignment: 'right' |
|
3482 }); |
|
3483 $("#mash_select").on('select', function (event) { |
|
3484 if (event.args) { |
|
3485 var index = event.args.index; |
|
3486 // First delete all current steps |
|
3487 var rowIDs = new Array(); |
|
3488 var rows = $("#mashGrid").jqxGrid('getdisplayrows'); |
|
3489 for (var i = 0; i < rows.length; i++) { |
|
3490 var row = rows[i]; |
|
3491 rowIDs.push(row.uid); |
|
3492 } |
|
3493 $("#mashGrid").jqxGrid('deleterow', rowIDs); |
|
3494 // Then add the new steps |
|
3495 $("#mash_name").val(datarecord.name); |
|
3496 for (var i = 0; i < datarecord.steps.length; i++) { |
|
3497 var data = datarecord.steps[i]; |
|
3498 var row = {}; |
|
3499 row["step_name"] = data.step_name; |
|
3500 row["step_type"] = data.step_type; |
|
3501 // For now, but this must be smarter. |
|
3502 if (mash_infuse == 0 && dataRecord.w1_amount > 0) |
|
3503 mash_infuse = dataRecord.w1_amount; |
|
3504 if (i == 0) |
|
3505 row["step_infuse_amount"] = mash_infuse; |
|
3506 else |
|
3507 row["step_infuse_amount"] = 0; |
|
3508 row["step_temp"] = data.step_temp; |
|
3509 row["end_temp"] = data.end_temp; |
|
3510 row["step_time"] = data.step_time; |
|
3511 row["ramp_time"] = data.ramp_time; |
|
3512 var commit = $("#mashGrid").jqxGrid('addrow', null, row); |
|
3513 } |
|
3514 } |
|
3515 }); |
|
3516 $("#popupMash").jqxWindow({ |
|
3517 width: 800, |
|
3518 height: 350, |
|
3519 position: { x: 230, y: 100 }, |
|
3520 resizable: false, |
|
3521 theme: theme, |
|
3522 isModal: true, |
|
3523 autoOpen: false, |
|
3524 cancelButton: $("#MashReady"), |
|
3525 modalOpacity: 0.40 |
|
3526 }); |
|
3527 $("#MashReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
|
3528 $("#MashReady").click(function () { |
|
3529 $("#mashGrid").jqxGrid('sortby', 'step_temp', 'asc'); |
|
3530 }); |
|
3531 $("#wstep_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
3532 $("#wstep_type").jqxDropDownList({ |
|
3533 theme: theme, |
|
3534 source: MashStepTypeAdapter, |
|
3535 valueMember: 'id', |
|
3536 displayMember: 'nl', |
|
3537 width: 180, |
|
3538 height: 23, |
|
3539 autoDropDownHeight: true |
|
3540 }); |
|
3541 $("#wstep_type").on('select', function (event) { |
|
3542 if (event.args) { |
|
3543 var index = event.args.index; |
|
3544 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3545 rowdata.step_type = index; |
|
3546 if (index == 0) { |
|
3547 $("#wstep_infuse_amount").show(); |
|
3548 $("#wstep_pmpt").show(); |
|
3549 } else { |
|
3550 rowdata.step_infuse_amount = 0; |
|
3551 $("#wstep_infuse_amount").hide(); |
|
3552 $("#wstep_pmpt").hide(); |
|
3553 } |
|
3554 mash_infuse = 0; |
|
3555 var rows = $('#mashGrid').jqxGrid('getrows'); |
|
3556 for (var i = 0; i < rows.length; i++) { |
|
3557 var row = rows[i]; |
|
3558 if (row.step_type == 0) // Infusion |
|
3559 mash_infuse += parseFloat(row.step_infuse_amount); |
|
3560 } |
|
3561 } |
|
3562 }); |
|
3563 $("#wstep_temp").jqxNumberInput( Spin1dec5 ); |
|
3564 $('#wstep_temp').on('change', function (event) { |
|
3565 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3566 rowdata.step_temp = parseFloat(event.args.value); |
|
3567 }); |
|
3568 $("#wend_temp").jqxNumberInput( Spin1dec5 ); |
|
3569 $('#wend_temp').on('change', function (event) { |
|
3570 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3571 rowdata.end_temp = parseFloat(event.args.value); |
|
3572 }); |
|
3573 $("#wstep_time").jqxNumberInput( PosInt ); |
|
3574 $('#wstep_time').on('change', function (event) { |
|
3575 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3576 rowdata.step_time = parseFloat(event.args.value); |
|
3577 }); |
|
3578 $("#wramp_time").jqxNumberInput( PosInt ); |
|
3579 $('#wramp_time').on('change', function (event) { |
|
3580 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3581 rowdata.ramp_time = parseFloat(event.args.value); |
|
3582 }); |
|
3583 $("#wstep_infuse_amount").jqxNumberInput( Spin1dec5 ); |
|
3584 $('#wstep_infuse_amount').on('change', function (event) { |
|
3585 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3586 rowdata.step_infuse_amount = parseFloat(event.args.value); |
|
3587 mash_infuse = 0; |
|
3588 var rows = $('#mashGrid').jqxGrid('getrows'); |
|
3589 for (var i = 0; i < rows.length; i++) { |
|
3590 var row = rows[i]; |
|
3591 if (row.step_type == 0) // Infusion |
|
3592 mash_infuse += parseFloat(row.step_infuse_amount); |
|
3593 } |
|
3594 }); |
3018 |
3595 |
3019 // Tab 8, Water |
3596 // Tab 8, Water |
3020 $("#tgt_bu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 2, readOnly: true }); |
3597 $("#tgt_bu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 2, readOnly: true }); |
3021 $("#tgt_cl_so4").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3598 $("#tgt_cl_so4").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
3599 |
|
3600 // Water source 1 |
3022 $("#w1_name").jqxDropDownList({ |
3601 $("#w1_name").jqxDropDownList({ |
3023 placeHolder: "Kies hoofd water:", |
3602 placeHolder: "Kies hoofd water:", |
3024 theme: theme, |
3603 theme: theme, |
3025 source: waterlist, |
3604 source: waterlist, |
3026 displayMember: "name", |
3605 displayMember: "name", |
3157 $("#pr_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3737 $("#pr_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3158 $("#pr_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3738 $("#pr_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3159 $("#pr_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3739 $("#pr_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3160 $("#pr_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3740 $("#pr_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3161 |
3741 |
|
3742 // Water agents |
3162 $("#wa_cacl2").jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.' }); |
3743 $("#wa_cacl2").jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.' }); |
3163 $("#wa_cacl2").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' }); |
3744 $("#wa_cacl2").jqxNumberInput( Spin1dec1 ); |
|
3745 $("#wa_caso4").jqxTooltip({ content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.' }); |
|
3746 $("#wa_caso4").jqxNumberInput( Spin1dec1 ); |
|
3747 $("#wa_mgso4").jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!' }); |
|
3748 $("#wa_mgso4").jqxNumberInput( Spin1dec1 ); |
|
3749 $("#wa_nacl").jqxTooltip({ content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.' }); |
|
3750 $("#wa_nacl").jqxNumberInput( Spin1dec1 ); |
3164 $("#mash_ph").jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'}); |
3751 $("#mash_ph").jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'}); |
3165 $("#mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 8, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3752 $("#mash_ph").jqxNumberInput( SpinpH ); |
3166 $("#sparge_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
|
3167 $("#wa_caso4").jqxTooltip({ content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.' }); |
|
3168 $("#wa_caso4").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' }); |
|
3169 $("#calc_acid").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
3753 $("#calc_acid").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
3170 $("#sparge_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 70, max: 98, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
3754 $("#wa_base_name").jqxDropDownList({ |
3171 $("#wa_mgso4").jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!' }); |
3755 theme: theme, |
3172 $("#wa_mgso4").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' }); |
3756 source: BaseTypeAdapter, |
3173 $("#wa_base_name").jqxDropDownList({ theme: theme, source: srcBase, width: 100, height: 23, dropDownHeight: 128 }); |
3757 valueMember: 'id', |
3174 $("#wa_base").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05, symbol: ' gr', symbolPosition: 'right' }); |
3758 displayMember: 'nl', |
3175 $("#sparge_source").jqxDropDownList({ theme: theme, source: srcSource, width: 100, height: 23, dropDownHeight: 95 }); |
3759 width: 170, |
3176 $("#wa_nacl").jqxTooltip({ content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.' }); |
3760 height: 23, |
3177 $("#wa_nacl").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' }); |
3761 autoDropDownHeight: true |
3178 $("#wa_acid_name").jqxDropDownList({ theme: theme, source: srcAcid, width: 100, height: 23, dropDownHeight: 128 }) |
3762 }); |
3179 $("#wa_acid").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05, symbol: ' ml', symbolPosition: 'right' }); |
3763 $("#wa_base").jqxNumberInput( Spin2dec5 ); |
3180 $("#wa_acid_perc").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 80, height: 23, min: 0, max: 100, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); |
3764 $("#wa_base").jqxNumberInput({ symbol: ' gr', symbolPosition: 'right' }); |
3181 $("#sparge_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4.5, max: 6.5, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3765 $("#wa_acid_name").jqxDropDownList({ |
3182 $("#sparge_acid_type").jqxDropDownList({ theme: theme, source: srcAcid, width: 100, height: 23, dropDownHeight: 128 }); |
3766 theme: theme, |
3183 $("#sparge_acid_perc").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, spinButtons: true, decimalDigits: 0, symbol: '%', symbolPosition: 'right' }); |
3767 source: AcidTypeAdapter, |
3184 $("#sparge_acid_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 2, readOnly: true, symbol: ' ml', symbolPosition: 'right' }); |
3768 valueMember: 'id', |
|
3769 displayMember: 'nl', |
|
3770 width: 170, |
|
3771 height: 23, |
|
3772 autoDropDownHeight: true |
|
3773 }) |
|
3774 $("#wa_acid").jqxNumberInput( Spin2dec5 ); |
|
3775 $("#wa_acid").jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' }); |
|
3776 $("#wa_acid_perc").jqxNumberInput( Perc0 ); |
|
3777 $("#wa_acid_perc").jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' }); |
|
3778 // Sparge water |
|
3779 $("#sparge_temp").jqxNumberInput( Spin1dec5 ); |
|
3780 $("#sparge_volume").jqxNumberInput( Spin1dec5 ); |
|
3781 $("#sparge_ph").jqxNumberInput( SpinpH ); |
|
3782 $("#sparge_source").jqxDropDownList({ |
|
3783 theme: theme, |
|
3784 source: SpargeSourceAdapter, |
|
3785 valueMember: 'id', |
|
3786 displayMember: 'nl', |
|
3787 width: 110, |
|
3788 height: 23, |
|
3789 autoDropDownHeight: true |
|
3790 }); |
|
3791 $("#sparge_acid_amount").jqxNumberInput( Spin2dec1 ); |
|
3792 $("#sparge_acid_amount").jqxNumberInput({ spinButtons: false, readOnly: true, symbol: ' ml', symbolPosition: 'right' }); |
|
3793 $("#sparge_acid_type").jqxDropDownList({ |
|
3794 theme: theme, |
|
3795 source: AcidTypeAdapter, |
|
3796 valueMember: 'id', |
|
3797 displayMember: 'nl', |
|
3798 width: 110, |
|
3799 height: 23, |
|
3800 autoDropDownHeight: true |
|
3801 }); |
|
3802 $("#sparge_acid_perc").jqxNumberInput( Perc0 ); |
|
3803 $("#sparge_acid_perc").jqxNumberInput({ symbol: '%', symbolPosition: 'right' }); |
3185 |
3804 |
3186 // Tab 9, Brewday |
3805 // Tab 9, Brewday |
3187 $("#brew_date_start").jqxDateTimeInput({ theme: theme, width: 230, height: 23, formatString: 'yyyy-MM-dd HH:mm:ss', showTimeButton: true }); |
3806 $("#brew_date_start").jqxDateTimeInput({ theme: theme, width: 230, height: 23, formatString: 'yyyy-MM-dd HH:mm:ss', showTimeButton: true }); |
3188 $("#brew_date_end").jqxDateTimeInput({ theme: theme, width: 230, height: 23, formatString: 'yyyy-MM-dd HH:mm:ss', showTimeButton: true }); |
3807 $("#brew_date_end").jqxDateTimeInput({ theme: theme, width: 230, height: 23, formatString: 'yyyy-MM-dd HH:mm:ss', showTimeButton: true }); |
3189 $("#brew_mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3808 $("#brew_mash_ph").jqxNumberInput( SpinpH ); |
3190 $("#est_mash_ph").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); |
3809 $("#est_mash_ph").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); |
3191 $("#brew_preboil_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3810 $("#brew_preboil_ph").jqxNumberInput( SpinpH ); |
3192 // est_preboil_ph |
3811 // est_preboil_ph |
3193 $("#brew_aboil_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3812 $("#brew_aboil_ph").jqxNumberInput( SpinpH ); |
3194 // est_aboil_ph |
3813 // est_aboil_ph |
3195 $("#brew_mash_sg").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 1.000, max: 1.200, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); |
3814 $("#brew_mash_sg").jqxNumberInput( SGopts ); |
3196 $("#brew_mash_sg").on('valueChanged', function () { calcMashEfficiency(); }); |
3815 $("#brew_mash_sg").on('valueChanged', function () { calcMashEfficiency(); }); |
3197 $("#est_mash_sg").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 3 }); |
3816 $("#est_mash_sg").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 3 }); |
3198 $("#brew_preboil_sg").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); |
3817 $("#brew_preboil_sg").jqxNumberInput( SGopts ); |
3199 $("#brew_aboil_sg").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); |
3818 $("#brew_aboil_sg").jqxNumberInput( SGopts ); |
3200 $("#est_og3").jqxTooltip({ content: 'Het geschatte begin SG van dit product.' }); |
3819 $("#est_og3").jqxTooltip({ content: 'Het geschatte begin SG van dit product.' }); |
3201 $("#est_og3").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 70, height: 23, decimalDigits: 3, readOnly: true }); |
3820 $("#est_og3").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 70, height: 23, decimalDigits: 3, readOnly: true }); |
3202 $("#brew_mash_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); |
3821 $("#brew_mash_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); |
3203 $("#brew_preboil_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3822 $("#brew_preboil_volume").jqxNumberInput( Spin1dec5 ); |
3204 $("#brew_aboil_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3823 $("#brew_aboil_volume").jqxNumberInput( Spin1dec5 ); |
3205 $("#brew_preboil_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); |
3824 $("#brew_preboil_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); |
3206 $("#brew_aboil_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); |
3825 $("#brew_aboil_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); |
3207 $("#brew_sparge_temperature").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3826 $("#brew_sparge_temperature").jqxNumberInput( Spin1dec5 ); |
3208 $("#brew_sparge_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3827 $("#brew_sparge_volume").jqxNumberInput( Spin1dec5 ); |
3209 $("#brew_whirlpool9").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 120, decimalDigits: 0, spinButtons: true }); |
3828 $("#brew_whirlpool9").jqxNumberInput( PosInt ); |
3210 $("#brew_cooling_to").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3829 $("#brew_whirlpool9").jqxNumberInput({ max: 120 }); |
3211 $("#brew_sparge_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 14, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3830 $("#brew_cooling_to").jqxNumberInput( Spin1dec5 ); |
3212 $("#brew_whirlpool7").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 120, decimalDigits: 0, spinButtons: true }); |
3831 $("#brew_sparge_ph").jqxNumberInput( SpinpH ); |
3213 $("#brew_cooling_method").jqxDropDownList({ theme: theme, source: srcCooling, width: 170, height: 23, dropDownHeight: 153 }); |
3832 $("#brew_whirlpool7").jqxNumberInput( PosInt ); |
3214 $("#brew_whirlpool6").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 120, decimalDigits: 0, spinButtons: true }); |
3833 $("#brew_whirlpool7").jqxNumberInput({ max: 120 }); |
3215 $("#brew_cooling_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 1440, decimalDigits: 0, spinButtons: true }); |
3834 $("#brew_cooling_method").jqxDropDownList({ |
3216 $("#brew_whirlpool2").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 120, decimalDigits: 0, spinButtons: true }); |
3835 theme: theme, |
3217 $("#brew_aeration_type").jqxDropDownList({ theme: theme, source: srcAeration, width: 100, height: 23, dropDownHeight: 95 }); |
3836 source: CoolingTypeAdapter, |
3218 $("#brew_aeration_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 1440, decimalDigits: 0, spinButtons: true }); |
3837 valueMember: 'id', |
3219 $("#brew_aeration_speed").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 1440, decimalDigits: 0, spinButtons: true }); |
3838 displayMember: 'nl', |
3220 $("#brew_fermenter_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3839 width: 180, |
3221 $("#brew_fermenter_extrawater").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3840 height: 23, |
3222 $("#brew_fermenter_sg").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 3 }); |
3841 autoDropDownHeight: true |
3223 $("#brew_fermenter_extrasugar").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
3842 }); |
3224 $("#brew_fermenter_ibu").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 }); |
3843 $("#brew_whirlpool6").jqxNumberInput( PosInt ); |
3225 $("#brew_fermenter_color").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 }); |
3844 $("#brew_whirlpool6").jqxNumberInput({ max: 120 }); |
|
3845 $("#brew_cooling_time").jqxNumberInput( PosInt ); |
|
3846 $("#brew_cooling_time").jqxNumberInput({ max: 1440 }); |
|
3847 $("#brew_whirlpool2").jqxNumberInput( PosInt ); |
|
3848 $("#brew_whirlpool2").jqxNumberInput({ max: 120 }); |
|
3849 $("#brew_aeration_type").jqxDropDownList({ |
|
3850 theme: theme, |
|
3851 source: AerationTypeAdapter, |
|
3852 valueMember: 'id', |
|
3853 displayMember: 'nl', |
|
3854 width: 180, |
|
3855 height: 23, |
|
3856 autoDropDownHeight: true |
|
3857 }); |
|
3858 $("#brew_aeration_time").jqxNumberInput( PosInt ); |
|
3859 $("#brew_aeration_time").jqxNumberInput({ max: 1440 }); |
|
3860 $("#brew_aeration_speed").jqxNumberInput( PosInt ); |
|
3861 $("#brew_aeration_speed").jqxNumberInput({ max: 1440 }); |
|
3862 $("#brew_fermenter_volume").jqxNumberInput( Spin1dec5 ); |
|
3863 $("#brew_fermenter_extrawater").jqxNumberInput( Spin1dec1 ); |
|
3864 $("#brew_fermenter_sg").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 3 }); |
|
3865 $("#brew_fermenter_extrasugar").jqxNumberInput( Spin1dec1 ); |
|
3866 $("#brew_fermenter_ibu").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 0 }); |
|
3867 $("#brew_fermenter_color").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 0 }); |
3226 $("#BLog").jqxButton({ template: "info", width: '150px', theme: theme }); |
3868 $("#BLog").jqxButton({ template: "info", width: '150px', theme: theme }); |
3227 $("#BLog").click(function () { |
3869 $("#BLog").click(function () { |
3228 // Open log in a new tab. |
3870 // Open log in a new tab. |
3229 var url="log_brew.php?code=" + dataRecord.code; |
3871 var url="log_brew.php?code=" + dataRecord.code; |
3230 window.open(url); |
3872 window.open(url); |