diff -r 3f823bc205ca -r 11e6bd8d8107 www/js/prod_edit.js --- a/www/js/prod_edit.js Wed Apr 14 10:49:37 2021 +0200 +++ b/www/js/prod_edit.js Thu Apr 15 10:57:01 2021 +0200 @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2018-2020 + * Copyright (C) 2018-2021 * * Michiel Broek * @@ -115,7 +115,7 @@ $('#popupMash').jqxWindow({ width: 800, - height: 375, + height: 400, position: { x: 230, y: 100 }, resizable: false, theme: theme, @@ -1565,7 +1565,9 @@ { name: 'step_time', type: 'float' }, { name: 'step_wg_ratio', type: 'float' }, { name: 'ramp_time', type: 'float' }, - { name: 'end_temp', type: 'float' } + { name: 'end_temp', type: 'float' }, + { name: 'step_ph', type: 'float' }, + { name: 'step_sg', type: 'float' } ], addrow: function(rowid, rowdata, position, commit) { commit(true); }, deleterow: function(rowid, commit) { commit(true); } @@ -1614,6 +1616,8 @@ row['step_wg_ratio'] = 0; row['ramp_time'] = 1.0; row['end_temp'] = 62.0; + row['step_ph'] = 0.0; + row['step_sg'] = 0.0; $('#mashGrid').jqxGrid('addrow', null, row); calcMash(); }); @@ -1648,16 +1652,16 @@ }, columns: [ { text: 'Stap naam', datafield: 'step_name' }, - { text: 'Stap type', datafield: 'step_type', width: 175, + { text: 'Stap type', datafield: 'step_type', width: 150, cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { return '' + MashStepTypeData[value].nl + ''; } }, - { text: 'Start °C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'Eind °C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' }, - { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' }, - { text: 'Inf/dec L.', datafield: 'step_infuse_amount', width: 90, align: 'right', + { text: 'Start °C', datafield: 'step_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: 'Eind °C', datafield: 'end_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: 'Rust min.', datafield: 'step_time', width: 80, align: 'right', cellsalign: 'right' }, + { text: 'Stap min.', datafield: 'ramp_time', width: 80, align: 'right', cellsalign: 'right' }, + { text: 'Inf/dec L.', datafield: 'step_infuse_amount', width: 80, align: 'right', cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) { if (rowdata.step_type == 1) return ''; @@ -1675,7 +1679,7 @@ return '' + dataAdapter.formatNumber(value, 'f2') + ''; } }, - { text: 'L/Kg.', datafield: 'step_wg_ratio', width: 90, align: 'right', + { text: 'L/Kg.', datafield: 'step_wg_ratio', width: 80, align: 'right', cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) { var color = '#ffffff'; if (value < 2.0 || value > 6.0) @@ -1683,6 +1687,8 @@ return '' + dataAdapter.formatNumber(value, 'f2') + ''; } }, + { text: 'pH', datafield: 'step_ph', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f2' }, + { text: 'SG', datafield: 'step_sg', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, { text: '', columntype: 'button', width: 15, align: 'center', cellsrenderer: function(row) { if (row < 2) @@ -1741,6 +1747,8 @@ $('#wstep_pmpt_temp').show(); } } + $('#wstep_ph').val(mashData.step_ph); + $('#wstep_sg').val(mashData.step_sg); // show the popup window. $('#popupMash').jqxWindow('open'); } @@ -1779,10 +1787,10 @@ var row2 = $('#mashGrid').jqxGrid('getrowdata', r2); var obj1 = { step_name: row1.step_name, step_type: row1.step_type, step_volume: row1.step_volume, step_infuse_amount: row1.step_infuse_amount, step_infuse_temp: row1.step_infuse_temp, step_temp: row1.step_temp, step_time: row1.step_time, - ramp_time: row1.ramp_time, end_temp: row1.end_temp, step_wg_ratio: row1.step_wg_ratio }; + ramp_time: row1.ramp_time, end_temp: row1.end_temp, step_wg_ratio: row1.step_wg_ratio, step_ph: row1.step_ph, step_sg: row1.step_sg }; var obj2 = { step_name: row2.step_name, step_type: row2.step_type, step_volume: row2.step_volume, step_infuse_amount: row2.step_infuse_amount, step_infuse_temp: row2.step_infuse_temp, step_temp: row2.step_temp, step_time: row2.step_time, - ramp_time: row2.ramp_time, end_temp: row2.end_temp, step_wg_ratio: row2.step_wg_ratio }; + ramp_time: row2.ramp_time, end_temp: row2.end_temp, step_wg_ratio: row2.step_wg_ratio, step_ph: row2.step_ph, step_sg: row2.step_sg }; $("#mashGrid").jqxGrid('updaterow', r1, obj2); $("#mashGrid").jqxGrid('updaterow', r2, obj1); } @@ -5693,6 +5701,8 @@ row['step_infuse_temp'] = 99.0; } } + row['step_ph'] = 0.0; + row['step_sg'] = 0.0; //console.log(i + ' type: ' + row['step_type'] + ' start infusion: ' + parseFloat(row['step_infuse_amount']) + ' mash_infuse: ' + mash_infuse); infused += parseFloat(row['step_infuse_amount']); row['step_volume'] = infused; @@ -5800,6 +5810,26 @@ rowdata.step_time = parseFloat(event.args.value); calcMash(); }); + $('#wstep_ph').jqxNumberInput(Spin2pH); + $('#wstep_ph').on('change', function(event) { + var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); + rowdata.step_ph = parseFloat(event.args.value); + }); + $('#wstep_sg').jqxNumberInput(SGopts); + $('#wstep_sg').on('change', function(event) { + var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); + rowdata.step_sg = parseFloat(event.args.value); + }); + $('#wstep_brix').jqxNumberInput(Spin1dec); + $('#wstep_brix').on('change', function(event) { + var sg = brix_to_sg(parseFloat(event.args.value)); +console.log('brix: ' + parseFloat(event.args.value) + ' sg: ' + sg); + if (sg > 1.005) { + var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); + rowdata.step_sg = sg; + $('#wstep_sg').val(sg); + } + }); $('#wramp_time').on('change', function(event) { var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); rowdata.ramp_time = parseFloat(event.args.value); @@ -6052,7 +6082,7 @@ $('#brew_date_start,#brew_date_end').jqxDateTimeInput(DateTimeopts); $('#brew_date_start,#brew_date_end').on('close', function(event) { calcStage(); }); $('#est_mash_ph').jqxNumberInput(Show2wat); - $('#brew_mash_ph,#brew_preboil_ph,#brew_aboil_ph').jqxNumberInput(SpinpH); + $('#brew_mash_ph,#brew_preboil_ph,#brew_aboil_ph').jqxNumberInput(Spin2pH); $('#brew_mash_sg').on('valueChanged', function() { calcMashEfficiency(); }); $('#brew_preboil_sg').on('valueChanged', function(event) { dataRecord.brew_preboil_sg = event.args.value; @@ -6125,7 +6155,7 @@ $('#est_pre_vol,#est_a_vol').jqxNumberInput(Show1wat); $('#brew_preboil_efficiency,#brew_aboil_efficiency,#brew_sparge_temperature,#brew_sparge_volume,#brew_sparge_est').jqxNumberInput(Show1dec); $('#brew_cooling_to').jqxNumberInput(Spin1dec); - $('#brew_sparge_ph').jqxNumberInput(SpinpH); + $('#brew_sparge_ph').jqxNumberInput(Spin2pH); $('#brew_cooling_method').jqxDropDownList({ theme: theme, source: CoolingTypeAdapter,