# HG changeset patch # User Michiel Broek # Date 1548940194 -3600 # Node ID d3cdcfac81cb45809ceea7e94138ceb7a6519c08 # Parent 0de4455bd2a12a716ac9f4a28cccc73e3cf78273 In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly. diff -r 0de4455bd2a1 -r d3cdcfac81cb www/js/rec_edit.js --- a/www/js/rec_edit.js Wed Jan 30 23:08:05 2019 +0100 +++ b/www/js/rec_edit.js Thu Jan 31 14:09:54 2019 +0100 @@ -1740,12 +1740,14 @@ return "
" + HopUseData[value].nl + "
"; } }, - { text: 'Tijd', datafield: 'h_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', + { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right', cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { - if ((rowdata.h_useat == 2) || (rowdata.h_useat == 5)) // Boil or Dry hop - return "
"+dataAdapter.formatNumber(value, "f0")+"
"; + if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool + return "
"+dataAdapter.formatNumber(value, "f0")+" min.
"; + if (rowdata.h_useat == 5) // Dry hop + return "
"+dataAdapter.formatNumber(value/1440, "f0")+" dagen
"; else - return "
"; + return "
"; } }, { text: 'IBU', datafield: 'ibu', width: 80, align: 'right', @@ -1759,7 +1761,6 @@ parseFloat(rowdata.h_alpha), $("#ibu_method").val() ); - // calcIBUs(); return "
" + dataAdapter.formatNumber(ibu, "f1") + "
"; } }, @@ -1792,7 +1793,10 @@ parseFloat(hopData.h_alpha), $("#ibu_method").val() ); $("#wh_ibu").val(ibu); - $("#wh_time").val(hopData.h_time); + if (hopData.h_useat == 5) // Dry hop + $("#wh_time").val(hopData.h_time / 1440); + else + $("#wh_time").val(hopData.h_time); $("#wh_useat").val(hopData.h_useat); // show the popup window. $("#popupHop").jqxWindow('open'); @@ -2626,7 +2630,6 @@ $("#wf_adjust_to_total_100").jqxCheckBox({ theme: theme, width: 120, height: 23 }); $("#wf_adjust_to_total_100").on('checked', function (event) { if (fermentableData.f_adjust_to_total_100 == 0) { - // console.log("wf_adjust_to_total_100: checked row: "+fermentableRow+" old: "+fermentableData.f_adjust_to_total_100); if (to_100) { // Reset other flag first. var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; @@ -2642,7 +2645,6 @@ }); $("#wf_adjust_to_total_100").on('unchecked', function (event) { if (fermentableData.f_adjust_to_total_100 != 0) { - // console.log("wf_adjust_to_total_100: unchecked row: "+fermentableRow+" old: "+fermentableData.f_adjust_to_total_100); $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 0); calcFermentables(); } @@ -2676,7 +2678,7 @@ }); $("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme }); $("#HopReady").click(function () { - $("#hopGrid").jqxGrid('sortby', 'f_amount', 'asc'); + $("#hopGrid").jqxGrid('sortby', 'h_amount', 'asc'); calcIBUs(); }); $("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 }); @@ -2706,7 +2708,19 @@ var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); $("#wh_name").val(datarecord.name); rowdata.h_name = datarecord.name; - + rowdata.h_origin = datarecord.origin; + rowdata.h_cost = datarecord.cost; + rowdata.h_type = datarecord.type; + rowdata.h_form = datarecord.form; + rowdata.h_alpha = datarecord.alpha; + rowdata.h_beta = datarecord.beta; + rowdata.h_hsi = datarecord.hsi; + rowdata.h_humulene = datarecord.humulene; + rowdata.h_caryophyllene = datarecord.caryophyllene; + rowdata.h_cohumulone = datarecord.cohumulone; + rowdata.h_myrcene = datarecord.myrcene; + rowdata.h_total_oil = datarecord.total_oil; + rowdata.h_inventory = datarecord.inventory; } }); $("#wh_amount").jqxNumberInput( Spin1dec1 ); @@ -2724,8 +2738,37 @@ // $("#hopGrid").jqxGrid('setcellvalue', hopRow, 'h_amount', amount); calcIBUs(); }); - $("#wh_ibu").jqxNumberInput( Spin1dec1 ); + $("#wh_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); $("#wh_time").jqxNumberInput( PosInt ); + $("#wh_time").on('change', function (event) { + console.log("time changed: "+event.args.value); + var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); + var newtime = parseFloat(event.args.value); + // Check limits and correct + if (rowdata.h_useat == 2) { // Boil + if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) { + newtime = parseFloat($("#boil_time").jqxNumberInput('decimal')); + $("#wh_time").val(newtime); + } + rowdata.h_time = newtime; + } else if (rowdata.h_useat == 4) { // Whirlpool + if (newtime > 120) { + newtime = 120; + $("#wh_time").val(newtime); + } + rowdata.h_time = newtime; + } else if (rowdata.h_useat == 5) { // Dry hop + if (newtime > 21) { + newtime = 21; + $("#wh_time").val(newtime); + } + rowdata.h_time = newtime * 1440; + } + var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')), + parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), $("#ibu_method").val()); + $("#wh_ibu").val(ibu); + calcIBUs(); + }); $("#wh_useat").jqxDropDownList({ theme: theme, source: HopUseAdapter, @@ -2741,10 +2784,21 @@ var index = event.args.index; var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); rowdata.h_useat = index; - if ((index == 0) || (index == 1)) + if ((index == 0) || (index == 1)) { // Mashhop or First wort hop rowdata.h_time = parseFloat(dataRecord.boil_time); - else if (index == 3) + $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); + $("#wh_time").val(rowdata.h_time); + } else if (index == 3) { // Aroma rowdata.h_time = 0; + $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); + $("#wh_time").val(0); + } else { // Boil, Whirlpool or Dry hop + $("#wh_time").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); + } + if (index == 5) // Dry hop + $("#wh_pmpt_time").html("Tijd in dagen"); + else + $("#wh_pmpt_time").html("Tijd in minuten"); } }); diff -r 0de4455bd2a1 -r d3cdcfac81cb www/rec_edit.php --- a/www/rec_edit.php Wed Jan 30 23:08:05 2019 +0100 +++ b/www/rec_edit.php Thu Jan 31 14:09:54 2019 +0100 @@ -392,7 +392,7 @@ - Hoeveelheid kg: + Hoeveelheid gram:
@@ -400,7 +400,7 @@
- Tijdsduur: +
Tijdsduur: