# HG changeset patch # User Michiel Broek # Date 1659541050 -7200 # Node ID f6dcde592a7bc95171d1b1de896cc99ef241b4df # Parent ffb16dafbc937578581b283bd1a7e511afc7b86e Phase 5, ,ash tab is a vieuwer. diff -r ffb16dafbc93 -r f6dcde592a7b www/js/rec_edit.js --- a/www/js/rec_edit.js Wed Aug 03 17:24:05 2022 +0200 +++ b/www/js/rec_edit.js Wed Aug 03 17:37:30 2022 +0200 @@ -103,17 +103,6 @@ w100 = 90; w80 = 60; } - $('#miscGrid').jqxGrid({ editable: rw }); - $('#maddrowbutton').jqxDropDownList({ disabled: ro }); - $('#minstockbutton').jqxCheckBox({ disabled: ro }); - $('#mdeleterowbutton').jqxButton({ disabled: ro }); - $('#yeastGrid').jqxGrid({ editable: rw }); - $('#yaddrowbutton').jqxDropDownList({ disabled: ro }); - $('#yinstockbutton').jqxCheckBox({ disabled: ro }); - $('#ydeleterowbutton').jqxButton({ disabled: ro }); - $('#mashGrid').jqxGrid({ editable: rw }); - $('#saddrowbutton').jqxButton({ disabled: ro }); - $('#sdeleterowbutton').jqxButton({ disabled: ro }); $('#w1_name').jqxDropDownList({ disabled: ro }); $('#w2_name').jqxDropDownList({ disabled: ro }); $('#pr_name').jqxDropDownList({ disabled: ro }); @@ -307,22 +296,6 @@ } -function swapMash(r1, r2) { - - console.log('swap mash rows ' + r1 + ' ' + r2); - var row1 = $('#mashGrid').jqxGrid('getrowdata', r1); - 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 }; - 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 }; - $("#mashGrid").jqxGrid('updaterow', r1, obj2); - $("#mashGrid").jqxGrid('updaterow', r2, obj1); -} - - function infusionVol(step_infused, step_mashkg, infuse_temp, step_temp, last_temp) { var a = last_temp * (eq_tun_weight * eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt); var b = step_temp * (eq_tun_weight * eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt); @@ -1244,9 +1217,6 @@ { name: 'y_sg_hi', type: 'float' }, { name: 'y_avail', type: 'int' } ], -// addrow: function(rowid, rowdata, position, commit) { commit(true); }, - // deleterow: function(rowid, commit) { commit(true); }, - // updaterow: function(rowid, rowdata, commit) { commit(true); } }, yeastAdapter = new $.jqx.dataAdapter(yeastSource); @@ -1318,8 +1288,8 @@ { name: 'ramp_time', type: 'float' }, { name: 'end_temp', type: 'float' } ], - addrow: function(rowid, rowdata, position, commit) { commit(true); }, - deleterow: function(rowid, commit) { commit(true); } +// addrow: function(rowid, rowdata, position, commit) { commit(true); }, +// deleterow: function(rowid, commit) { commit(true); } }, mashAdapter = new $.jqx.dataAdapter(mashSource, { beforeLoadComplete: function(records) { @@ -1339,48 +1309,7 @@ height: 400, source: mashAdapter, theme: theme, - selectionmode: 'singlerow', - showtoolbar: true, - rendertoolbar: function(toolbar) { - //var me = this; - var container = $('
'); - toolbar.append(container); - container.append(''); - container.append(''); - $('#saddrowbutton').jqxButton({ template: 'primary', theme: theme, height: 27, width: 150 }); - $('#saddrowbutton').on('click', function() { - var row = {}, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; - row['step_name'] = 'Stap ' + (rowscount + 1); - if (rowscount > 0) { - row['step_type'] = 1; - row['step_infuse_amount'] = 0; - row['step_volume'] = mash_infuse; - } else { - row['step_type'] = 0; - row['step_infuse_amount'] = 15; - row['step_volume'] = 15; - } - row['step_infuse_temp'] = 0; - row['step_temp'] = 62.0; - row['step_time'] = 20.0; - row['step_wg_ratio'] = 0; - row['ramp_time'] = 1.0; - row['end_temp'] = 62.0; - $('#mashGrid').jqxGrid('addrow', null, datarow); - calcMash(); - }); - // delete selected yeast. - $('#sdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150 }); - $('#sdeleterowbutton').on('click', function() { - var id, rowscount, selectedrowindex = $('#mashGrid').jqxGrid('getselectedrowindex'); - rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; - if (selectedrowindex >= 0 && selectedrowindex < rowscount) { - id = $('#mashGrid').jqxGrid('getrowid', selectedrowindex); - $('#mashGrid').jqxGrid('deleterow', id); - calcMash(); - } - }); - }, + editable: false, ready: function() { calcFermentables(); calcInit(); @@ -1420,73 +1349,12 @@ color = '#ff4040'; return '' + dataAdapter.formatNumber(value, 'f2') + ''; } - }, - { text: '', columntype: 'button', width: 15, align: 'center', - cellsrenderer: function(row) { - if (row < 2) - return ' '; - return '▴'; - }, buttonclick: function(row) { - if (row >= 2) { - swapMash(row, row-1); - } - } - }, - { text: '', columntype: 'button', width: 15, align: 'center', - cellsrenderer: function(row) { - rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; - if (row < 1 || row > (rowscount -2)) - return ' '; - return '▾'; - }, buttonclick: function(row) { - rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; - if (row >= 1 && row <= (rowscount -2)) { - swapMash(row, row+1); - } - } - }, - { text: '', datafield: 'Edit', columntype: 'button', width: 80, align: 'center', - cellsrenderer: function() { - return 'Wijzig'; - }, buttonclick: function(row) { - mashRow = row; - mashData = $('#mashGrid').jqxGrid('getrowdata', mashRow); - if (mashRow == 0) - $("#wstep_type").jqxDropDownList('disableAt', 2); - else - $("#wstep_type").jqxDropDownList('enableAt', 2); - $('#wstep_name').val(mashData.step_name); - $('#wstep_type').val(mashData.step_type); - $('#wstep_infuse_amount').val(mashData.step_infuse_amount); - $('#wstep_infuse_temp').val(mashData.step_infuse_temp); - $('#wstep_temp').val(mashData.step_temp); - $('#wend_temp').val(mashData.end_temp); - $('#wstep_time').val(mashData.step_time); - $('#wramp_time').val(mashData.ramp_time); - $('#wstep_infuse_amount').hide(); // Hide all untile we need it. - $('#wstep_infuse_temp').hide(); - $('#wstep_pmpt_amount').hide(); - $('#wstep_pmpt_temp').hide(); - if (mashData.step_type == 0) { - if (mashRow == 0) { - $('#wstep_infuse_amount').show(); - $('#wstep_pmpt_amount').show(); - } else { - $('#wstep_infuse_temp').show(); - $('#wstep_pmpt_temp').show(); - } - } - // show the popup window. - $('#popupMash').jqxWindow('open'); - } } ] }); }; - - /* * Remove the top menu so that we MUST use the buttons to leave the editor. */ @@ -2407,206 +2275,6 @@ // Tab 6, Maischen $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#mash_select').jqxDropDownList({ - placeHolder: 'Kies schema:', - theme: theme, - source: mashlist, - displayMember: 'name', - width: 250, - height: 23, - dropDownWidth: 500, - dropDownHeight: 500, - dropDownHorizontalAlignment: 'right' - }); - $('#mash_select').on('select', function(event) { - if (event.args) { - var infused = 0, data, datarecord, i, row, rows, rowIDs, index = event.args.index; - // First delete all current steps - rowIDs = new Array(); - rows = $('#mashGrid').jqxGrid('getdisplayrows'); - for (i = 0; i < rows.length; i++) { - row = rows[i]; - rowIDs.push(row.uid); - } - $('#mashGrid').jqxGrid('deleterow', rowIDs); - // Then add the new steps - datarecord = mashlist.records[index]; - $('#mash_name').val(datarecord.name); - for (i = 0; i < datarecord.steps.length; i++) { - data = datarecord.steps[i]; - row = {}; - row['step_name'] = data.step_name; - row['step_type'] = parseInt(data.step_type); - row['step_temp'] = parseFloat(data.step_temp); - row['end_temp'] = parseFloat(data.end_temp); - row['step_time'] = parseFloat(data.step_time); - row['ramp_time'] = parseFloat(data.ramp_time); - row['step_infuse_temp'] = 0.0; - row['step_infuse_amount'] = 0.0; - if (mash_infuse == 0 && dataRecord.wg_amount > 0) - mash_infuse = dataRecord.wg_amount; - if (data.step_type == 0) { // Infusion - if (i == 0) { - row['step_infuse_amount'] = parseFloat(mash_infuse); - } else { - row['step_infuse_temp'] = 99.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; - if (mashkg > 0) - row['step_wg_ratio'] = Round(parseFloat(mash_infuse / mashkg), 2); - else - row['step_wg_ratio'] = 0; - $('#mashGrid').jqxGrid('addrow', null, row); - } - calcMash(); - } - }); - $('#popupMash').jqxWindow({ - width: 800, - height: 375, - position: { x: 230, y: 100 }, - resizable: false, - theme: theme, - isModal: true, - autoOpen: false, - cancelButton: $('#MashReady'), - modalOpacity: 0.40 - }); - $('#MashReady').jqxButton({ template: 'success', width: '90px', theme: theme }); - $('#MashReady').click(function() { - calcMash(); - }); - $('#wstep_name').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#wstep_name').on('change', function(event) { - var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); - rowdata.step_name = $('#wstep_name').val(); - }); - $('#wstep_type').jqxDropDownList({ - theme: theme, - source: MashStepTypeAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - height: 23, - autoDropDownHeight: true - }); - $('#wstep_type').on('select', function(event) { - if (event.args) { - var rowdata, rows, i, row, index = event.args.index; - rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); - if (rowdata.step_type != index) { - rowdata.step_type = index; - $('#wstep_infuse_amount').hide(); - $('#wstep_infuse_temp').hide(); - $('#wstep_pmpt_amount').hide(); - $('#wstep_pmpt_temp').hide(); - if (index == 0) { // Infusion - if (mashRow == 0) { - $('#wstep_infuse_amount').show(); - $('#wstep_pmpt_amount').show(); - } else { - $('#wstep_infuse_temp').show(); - $('#wstep_pmpt_temp').show(); - } - } - if (index == 1) { // Temperature - if (mashRow > 0) - rowdata.step_infuse_amount = 0; - rowdata.step_infuse_temp = 0; - } - if (index == 2) { // Decoction - var rowprev = $('#mashGrid').jqxGrid('getrowdata', mashRow-1); - rowdata.step_infuse_temp = 99; - rowdata.step_infuse_amount = decoctionVol(rowdata.step_volume, rowdata.step_temp, rowprev.end_temp); - console.log('decoction: ' + rowdata.step_infuse_amount + '/' + rowdata.step_infuse_temp); - } - $('#mashGrid').jqxGrid('updaterow', mashRow, rowdata); - mash_infuse = 0; - rows = $('#mashGrid').jqxGrid('getrows'); - for (i = 0; i < rows.length; i++) { - row = rows[i]; - if (row.step_type == 0) // Infusion - mash_infuse += parseFloat(row.step_infuse_amount); - } - calcMash(); - } - } - }); - $('#wstep_temp').jqxNumberInput(Spin1dec); - $('#wstep_temp').on('change', function(event) { - var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); - if (rowdata.step_type == 2) { // Decoction - var rowprev = $('#mashGrid').jqxGrid('getrowdata', mashRow-1); - var a = (eq_tun_weight * eq_tun_specific_heat + rowdata.step_volume * SpecificHeatWater) * - (parseFloat(event.args.value) - rowprev.end_temp); - var b = SpecificHeatWater * (99 - parseFloat(event.args.value)); - if (b > 0) { - rowdata.step_temp = parseFloat(event.args.value); - rowdata.step_infuse_amount = Round(a / b, 2); - } else - rowdata.step_infuse_amount = 0; - console.log('change temp ' + rowdata.step_temp + ' decoction: ' + rowdata.step_infuse_amount + '/' + rowdata.step_infuse_temp); - } else { - rowdata.step_temp = parseFloat(event.args.value); - } - }); - $('#wend_temp').jqxNumberInput(Spin1dec); - $('#wend_temp').on('change', function(event) { - var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); - rowdata.end_temp = parseFloat(event.args.value); - }); - $('#wstep_time').jqxNumberInput(PosInt); - $('#wstep_time').on('change', function(event) { - var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); - rowdata.step_time = parseFloat(event.args.value); - }); - $('#wramp_time').jqxNumberInput(PosInt); - $('#wramp_time').on('change', function(event) { - var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); - rowdata.ramp_time = parseFloat(event.args.value); - }); - $('#wstep_infuse_amount').jqxNumberInput(Spin1dec); - $('#wstep_infuse_amount').on('change', function(event) { - var i, rows, row, rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); - rowdata.step_infuse_amount = parseFloat(event.args.value); - if (mashRow == 0) { - rowdata.step_infuse_amount = parseFloat(event.args.value); - mash_infuse = 0; - rows = $('#mashGrid').jqxGrid('getrows'); - for (i = 0; i < rows.length; i++) { - row = rows[i]; - if (row.step_type == 0) // Infusion - mash_infuse += parseFloat(row.step_infuse_amount); - } - if (dataRecord.w2_amount == 0) { - dataRecord.w1_amount = mash_infuse; - $('#w1_amount').val(mash_infuse); - } else { - var w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; - var w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; - dataRecord.w1_amount = Round(w1_amount, 3); - dataRecord.w2_amount = Round(w2_amount, 3); - $('#w1_amount').val(dataRecord.w1_amount); - $('#w2_amount').val(dataRecord.w2_amount); - } - $('#wg_amount').val(mash_infuse); - console.log('new infuse amount: ' + mash_infuse); - calcWater(); - } - }); - $('#wstep_infuse_temp').jqxNumberInput(Spin1dec); - $('#wstep_infuse_temp').on('change', function(event) { - var prevdata = $('#mashGrid').jqxGrid('getrowdata', mashRow-1); - var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); - rowdata.step_infuse_temp = parseFloat(event.args.value); - var vol = infusionVol(prevdata.step_volume, mashkg, rowdata.step_infuse_temp, rowdata.step_temp, prevdata.end_temp); - console.log('new vol: ' + vol); - rowdata.step_infuse_amount = vol; - $('#wstep_infuse_amount').val(vol); - }); // Tab 7, Water $('#tgt_bu').jqxNumberInput(Show2wat); diff -r ffb16dafbc93 -r f6dcde592a7b www/rec_edit.php --- a/www/rec_edit.php Wed Aug 03 17:24:05 2022 +0200 +++ b/www/rec_edit.php Wed Aug 03 17:37:30 2022 +0200 @@ -178,9 +178,8 @@ - - - + + @@ -359,51 +358,6 @@ -
-
Wijzig maisch stap detail.
-
-
Maischchema:Kies ander schema:
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Stap naam:
Stap type:
Start temperatuur °C:
Eind temperatuur °C:
Stap tijd minuten:
Opwarm tijd minuten:
Infusie liters:
Infusie temperatuur:
- -
- - -