www/js/prod_edit.js

changeset 347
e6e7ec9e33e0
parent 342
3ac81572bb28
child 348
5fc0f4b42224
equal deleted inserted replaced
346:01b393df529a 347:e6e7ec9e33e0
1006 } 1006 }
1007 } 1007 }
1008 } 1008 }
1009 1009
1010 function setRangeIndicator(ion, rangeCode) { 1010 function setRangeIndicator(ion, rangeCode) {
1011 if (rangeCode == "low") 1011 if (rangeCode == "laag")
1012 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='font-size: 10px; font-style: italic;'>"+rangeCode + "</span>"); 1012 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>"+rangeCode + "</span>");
1013 else if (rangeCode == "high") 1013 else if (rangeCode == "hoog")
1014 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='font-size: 10px; font-style: italic;'>"+rangeCode+"</span>"); 1014 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>"+rangeCode+"</span>");
1015 else 1015 else
1016 $("#wr_"+ion).html("<img src='images/dialog-ok-apply.png'>"); 1016 $("#wr_"+ion).html("<img src='images/dialog-ok-apply.png'>");
1017 } 1017 }
1018 1018
1019 function mix(v1, v2, c1, c2) { 1019 function mix(v1, v2, c1, c2) {
1483 } 1483 }
1484 1484
1485 // 2:1 Sulfate to Chroride IPA's, Pale Ales. 1485 // 2:1 Sulfate to Chroride IPA's, Pale Ales.
1486 // 1:1 Sulfate to Chloride Balanced 1486 // 1:1 Sulfate to Chloride Balanced
1487 // 1:2 Sulfate to Chloride Malty 1487 // 1:2 Sulfate to Chloride Malty
1488 // Note, values below are the other way, cl to so4!
1489 // So: 0.5 is IPA's, Pale Ales.
1490 // 1 Balanced
1491 // 2 Malty.
1488 $('#tgt_bu').val(Math.round(GetBUGU() * 100) / 100); 1492 $('#tgt_bu').val(Math.round(GetBUGU() * 100) / 100);
1489 $('#tgt_cl_so4').val(Math.round(GetOptClSO4ratio() * 10) / 10); // Show real value too 1493 // From brouwhulp.
1494 if (GetBUGU() < 0.32)
1495 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer zoet</span>");
1496 else if (GetBUGU() < 0.43)
1497 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zoet</span>");
1498 else if (GetBUGU() < 0.52)
1499 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>");
1500 else if (GetBUGU() < 0.63)
1501 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Bitter</span>");
1502 else
1503 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer bitter</span>");
1504 $('#tgt_cl_so4').val(Math.round(GetOptClSO4ratio() * 10) / 10);
1490 if (sulfate > 0) 1505 if (sulfate > 0)
1491 RA = chloride / sulfate; 1506 RA = chloride / sulfate;
1492 else 1507 else
1493 RA = 10; 1508 RA = 10;
1509 $('#got_cl_so4').val(Math.round(RA * 10) / 10);
1494 var piCLSO4_low = 0.8 * GetOptClSO4ratio(); 1510 var piCLSO4_low = 0.8 * GetOptClSO4ratio();
1495 var piCLSO4_high = 1.2 * GetOptClSO4ratio(); 1511 var piCLSO4_high = 1.2 * GetOptClSO4ratio();
1496 console.log("low: "+piCLSO4_low+" val: "+RA+" high: "+piCLSO4_high); 1512 var Res = 'normaal';
1513 if (RA < piCLSO4_low)
1514 Res = 'laag';
1515 else if (RA > piCLSO4_high)
1516 Res = 'hoog';
1517 setRangeIndicator('cl_so4', Res);
1518 // console.log("low: "+piCLSO4_low+" val: "+RA+" high: "+piCLSO4_high);
1497 1519
1498 $('#wb_calcium').val(Math.round(calcium * 10) / 10); 1520 $('#wb_calcium').val(Math.round(calcium * 10) / 10);
1499 $('#wb_magnesium').val(Math.round(magnesium * 10) / 10); 1521 $('#wb_magnesium').val(Math.round(magnesium * 10) / 10);
1500 $('#wb_sodium').val(Math.round(sodium * 10) / 10); 1522 $('#wb_sodium').val(Math.round(sodium * 10) / 10);
1501 $('#wb_sulfate').val(Math.round(sulfate * 10) / 10); 1523 $('#wb_sulfate').val(Math.round(sulfate * 10) / 10);
1502 $('#wb_chloride').val(Math.round(chloride * 10) / 10); 1524 $('#wb_chloride').val(Math.round(chloride * 10) / 10);
1503 $('#wb_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10); 1525 $('#wb_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10);
1504 1526
1505 if (calcium < 40) { 1527 if (calcium < 40) {
1506 setRangeIndicator("calcium", "low"); 1528 setRangeIndicator("calcium", "laag");
1507 } else if (calcium > 150) { 1529 } else if (calcium > 150) {
1508 setRangeIndicator("calcium", "high"); 1530 setRangeIndicator("calcium", "hoog");
1509 } else { 1531 } else {
1510 setRangeIndicator("calcium", "normal"); 1532 setRangeIndicator("calcium", "normaal");
1511 } 1533 }
1512 if (magnesium >= 0 && magnesium <= 30) { 1534 if (magnesium >= 0 && magnesium <= 30) {
1513 setRangeIndicator("magnesium", "normal"); 1535 setRangeIndicator("magnesium", "normaal");
1514 } else { 1536 } else {
1515 setRangeIndicator("magnesium", "high"); 1537 setRangeIndicator("magnesium", "hoog");
1516 } 1538 }
1517 if (sodium <= 150) { 1539 if (sodium <= 150) {
1518 setRangeIndicator("sodium", "normal"); 1540 setRangeIndicator("sodium", "normaal");
1519 } else { 1541 } else {
1520 setRangeIndicator("sodium", "high"); 1542 setRangeIndicator("sodium", "hoog");
1521 } 1543 }
1522 if (chloride <= 100) { 1544 // Both chloride and sulfate should be above 50 according to
1523 setRangeIndicator("chloride", "normal"); 1545 // John Palmer. So the Cl/SO4 ratio calculation will work.
1546 if (chloride <= 50) {
1547 setRangeIndicator("chloride", "laag");
1548 } else if (chloride <= 100) {
1549 setRangeIndicator("chloride", "normaal");
1524 } else { 1550 } else {
1525 setRangeIndicator("chloride", "high"); 1551 setRangeIndicator("chloride", "hoog");
1526 } 1552 }
1527 if (sulfate <= 350) { 1553 if (sulfate <= 50) {
1528 setRangeIndicator("sulfate", "normal"); 1554 setRangeIndicator("sulfate", "laag");
1555 } else if (sulfate <= 350) {
1556 setRangeIndicator("sulfate", "normaal");
1529 } else { 1557 } else {
1530 setRangeIndicator("sulfate", "high"); 1558 setRangeIndicator("sulfate", "hoog");
1531 } 1559 }
1532 if (ph < 5.2) { 1560 if (ph < 5.2) {
1533 setRangeIndicator("ph", "low"); 1561 setRangeIndicator("ph", "laag");
1534 } else if (ph > 5.6) { 1562 } else if (ph > 5.6) {
1535 setRangeIndicator("ph", "high"); 1563 setRangeIndicator("ph", "hoog");
1536 } else { 1564 } else {
1537 setRangeIndicator("ph", "normal"); 1565 setRangeIndicator("ph", "normaal");
1538 } 1566 }
1539 calcSparge(); 1567 calcSparge();
1540 } 1568 }
1541 1569
1542 function calcSparge() { 1570 function calcSparge() {
4934 }); 4962 });
4935 4963
4936 // Tab 8, Water 4964 // Tab 8, Water
4937 $("#tgt_bu").jqxNumberInput( Show2wat ); 4965 $("#tgt_bu").jqxNumberInput( Show2wat );
4938 $("#tgt_cl_so4").jqxNumberInput( Show1wat ); 4966 $("#tgt_cl_so4").jqxNumberInput( Show1wat );
4967 $("#got_cl_so4").jqxNumberInput( Show1wat );
4939 4968
4940 // Water source 1 4969 // Water source 1
4941 $("#w1_name").jqxDropDownList({ 4970 $("#w1_name").jqxDropDownList({
4942 placeHolder: "Kies hoofd water:", 4971 placeHolder: "Kies hoofd water:",
4943 theme: theme, 4972 theme: theme,
5041 $("#wb_magnesium").jqxNumberInput( Show1wat ); 5070 $("#wb_magnesium").jqxNumberInput( Show1wat );
5042 $("#wb_sodium").jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'}); 5071 $("#wb_sodium").jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
5043 $("#wb_sodium").jqxNumberInput( Show1wat ); 5072 $("#wb_sodium").jqxNumberInput( Show1wat );
5044 5073
5045 $("#wb_total_alkalinity").jqxNumberInput( Show1wat ); 5074 $("#wb_total_alkalinity").jqxNumberInput( Show1wat );
5046 $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is lager dan 100.'}); 5075 $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'});
5047 $("#wb_chloride").jqxNumberInput( Show1wat ); 5076 $("#wb_chloride").jqxNumberInput( Show1wat );
5048 $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is lager dan 350.'}); 5077 $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'});
5049 $("#wb_sulfate").jqxNumberInput( Show1wat ); 5078 $("#wb_sulfate").jqxNumberInput( Show1wat );
5050 5079
5051 $("#wb_ph").jqxNumberInput( Show1wat ); 5080 $("#wb_ph").jqxNumberInput( Show1wat );
5052 // Water target profile 5081 // Water target profile
5053 $("#pr_name").jqxDropDownList({ 5082 $("#pr_name").jqxDropDownList({

mercurial