# HG changeset patch # User Michiel Broek # Date 1543608313 -3600 # Node ID 9e378e37f20f6e6403cdc0bd5cf367a30a051bf0 # Parent ac993ef43b1315df3f59ac9fac3330c5b60ff5cc Inventory editor chages: Added colors to the buttons. Add top_up_kettle to the batch size calculation. diff -r ac993ef43b13 -r 9e378e37f20f www/js/inv_equipments.js --- a/www/js/inv_equipments.js Fri Nov 30 17:40:39 2018 +0100 +++ b/www/js/inv_equipments.js Fri Nov 30 21:05:13 2018 +0100 @@ -33,8 +33,8 @@ okButton: $('#delOk'), cancelButton: $('#delCancel'), initContent: function () { - $('#delOk').jqxButton({ width: '65px', theme: theme }); - $('#delCancel').jqxButton({ width: '65px', theme: theme }); + $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme }); + $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme }); $('#delCancel').focus(); } }); @@ -49,9 +49,10 @@ var boil_size = parseFloat($("#boil_size").jqxNumberInput('decimal')); var evap_rate = parseFloat($("#evap_rate").jqxNumberInput('decimal')); var boil_time = parseFloat($("#boil_time").jqxNumberInput('decimal')); + var top_up = parseFloat($("#top_up_kettle").jqxNumberInput('decimal')); if (calc) { // If checked, calculate the batch size. - var batch = boil_size - (evap_rate * boil_time / 60); + var batch = boil_size - (evap_rate * boil_time / 60) + top_up; $("#batch_size").val(batch); } } @@ -168,7 +169,7 @@ $("#batch_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.5 }); $("#tun_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); $("#tun_weight").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); - $("#tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 3 }); + $("#tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 3 }); $("#tun_material").jqxDropDownList({ theme: theme, source: srcMaterial, selectedIndex: 0, width: 110, height: 23, dropDownHeight: 130 }); $("#tun_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); $("#top_up_water").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); @@ -224,7 +225,7 @@ $("#trub_chiller_loss").val('0.5'); $("#evap_rate").val('1.8'); $("#boil_time").val('90'); - $("#calc_boil_volume").val('0'); + $("#calc_boil_volume").val(true); $("#top_up_kettle").val('0'); $("#hop_utilization").val('100'); $("#notes").val(''); @@ -244,6 +245,7 @@ $('#boil_size').on('change', function (event) { calcBatchVolume(); }); $('#evap_rate').on('change', function (event) { calcBatchVolume(); }); $('#boil_time').on('change', function (event) { calcBatchVolume(); }); + $('#top_up_kettle').on('change', function (event) { calcBatchVolume(); }); $("#calc_boil_volume").on('change', function (event) { calcBatchVolume(); }); $('#tun_material').on('change', function (event) { switch ($('#tun_material').val()) { @@ -307,7 +309,7 @@ $("#popupWindow").on('open', function () { $("#name").jqxInput('selectAll'); }); - $("#Delete").jqxButton({ theme: theme }); + $("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme }); $("#Delete").click(function () { if (editrow >= 0) { // Open a popup to confirm this action. @@ -319,71 +321,46 @@ } $("#popupWindow").jqxWindow('hide'); }); - $("#Cancel").jqxButton({ theme: theme }); - $("#Save").jqxButton({ theme: theme }); + $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme }); + $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); // update the edited row when the user clicks the 'Save' button. $("#Save").click(function () { + var rowID = -1; if (editrow >= 0) { var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); - var row = { - record: rowID, - name: $("#name").val(), - boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')), - batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), - tun_volume: parseFloat($("#tun_volume").jqxNumberInput('decimal')), - tun_weight: parseFloat($("#tun_weight").jqxNumberInput('decimal')), - tun_specific_heat: parseFloat($("#tun_specific_heat").jqxNumberInput('decimal')), - tun_material: $("#tun_material").val(), - tun_height: parseFloat($("#tun_height").jqxNumberInput('decimal')), - top_up_water: parseFloat($("#top_up_water").jqxNumberInput('decimal')), - trub_chiller_loss: parseFloat($("#trub_chiller_loss").jqxNumberInput('decimal')), - evap_rate: parseFloat($("#evap_rate").jqxNumberInput('decimal')), - boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), - calc_boil_volume: $("#calc_boil_volume").val(), - top_up_kettle: parseFloat($("#top_up_kettle").jqxNumberInput('decimal')), - hop_utilization: parseFloat($("#hop_utilization").jqxNumberInput('decimal')), - notes: $("#notes").val(), - lauter_volume: parseFloat($("#lauter_volume").jqxNumberInput('decimal')), - lauter_height: parseFloat($("#lauter_height").jqxNumberInput('decimal')), - lauter_deadspace: parseFloat($("#lauter_deadspace").jqxNumberInput('decimal')), - kettle_volume: parseFloat($("#kettle_volume").jqxNumberInput('decimal')), - kettle_height: parseFloat($("#kettle_height").jqxNumberInput('decimal')), - mash_volume: parseFloat($("#mash_volume").jqxNumberInput('decimal')), - efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')) - }; + } + var row = { + record: rowID, + name: $("#name").val(), + boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')), + batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), + tun_volume: parseFloat($("#tun_volume").jqxNumberInput('decimal')), + tun_weight: parseFloat($("#tun_weight").jqxNumberInput('decimal')), + tun_specific_heat: parseFloat($("#tun_specific_heat").jqxNumberInput('decimal')), + tun_material: $("#tun_material").val(), + tun_height: parseFloat($("#tun_height").jqxNumberInput('decimal')), + top_up_water: parseFloat($("#top_up_water").jqxNumberInput('decimal')), + trub_chiller_loss: parseFloat($("#trub_chiller_loss").jqxNumberInput('decimal')), + evap_rate: parseFloat($("#evap_rate").jqxNumberInput('decimal')), + boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), + calc_boil_volume: $("#calc_boil_volume").val(), + top_up_kettle: parseFloat($("#top_up_kettle").jqxNumberInput('decimal')), + hop_utilization: parseFloat($("#hop_utilization").jqxNumberInput('decimal')), + notes: $("#notes").val(), + lauter_volume: parseFloat($("#lauter_volume").jqxNumberInput('decimal')), + lauter_height: parseFloat($("#lauter_height").jqxNumberInput('decimal')), + lauter_deadspace: parseFloat($("#lauter_deadspace").jqxNumberInput('decimal')), + kettle_volume: parseFloat($("#kettle_volume").jqxNumberInput('decimal')), + kettle_height: parseFloat($("#kettle_height").jqxNumberInput('decimal')), + mash_volume: parseFloat($("#mash_volume").jqxNumberInput('decimal')), + efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')) + }; + if (editrow >= 0) { $('#jqxgrid').jqxGrid('updaterow', rowID, row); - $("#popupWindow").jqxWindow('hide'); } else { - // Insert a record - var newrow = { - record: -1, - name: $("#name").val(), - boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')), - batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), - tun_volume: parseFloat($("#tun_volume").jqxNumberInput('decimal')), - tun_weight: parseFloat($("#tun_weight").jqxNumberInput('decimal')), - tun_specific_heat: parseFloat($("#tun_specific_heat").jqxNumberInput('decimal')), - tun_material: $("#tun_material").val(), - tun_height: parseFloat($("#tun_height").jqxNumberInput('decimal')), - top_up_water: parseFloat($("#top_up_water").jqxNumberInput('decimal')), - trub_chiller_loss: parseFloat($("#trub_chiller_loss").jqxNumberInput('decimal')), - evap_rate: parseFloat($("#evap_rate").jqxNumberInput('decimal')), - boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), - calc_boil_volume: $("#calc_boil_volume").val(), - top_up_kettle: parseFloat($("#top_up_kettle").jqxNumberInput('decimal')), - hop_utilization: parseFloat($("#hop_utilization").jqxNumberInput('decimal')), - notes: $("#notes").val(), - lauter_volume: parseFloat($("#lauter_volume").jqxNumberInput('decimal')), - lauter_height: parseFloat($("#lauter_height").jqxNumberInput('decimal')), - lauter_deadspace: parseFloat($("#lauter_deadspace").jqxNumberInput('decimal')), - kettle_volume: parseFloat($("#kettle_volume").jqxNumberInput('decimal')), - kettle_height: parseFloat($("#kettle_height").jqxNumberInput('decimal')), - mash_volume: parseFloat($("#mash_volume").jqxNumberInput('decimal')), - efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')) - }; - $('#jqxgrid').jqxGrid('addrow', null, newrow); - $("#popupWindow").jqxWindow('hide'); + $('#jqxgrid').jqxGrid('addrow', null, row); } + $("#popupWindow").jqxWindow('hide'); }); createDelElements(); });