Wed, 03 Aug 2022 17:17:00 +0200
Phase 3, hops and misc ingredients as a viewer.
www/js/global.js | file | annotate | diff | comparison | revisions | |
www/js/rec_edit.js | file | annotate | diff | comparison | revisions | |
www/rec_edit.php | file | annotate | diff | comparison | revisions |
--- a/www/js/global.js Wed Aug 03 16:01:30 2022 +0200 +++ b/www/js/global.js Wed Aug 03 17:17:00 2022 +0200 @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2014-2021 + * Copyright (C) 2014-2022 * * Michiel Broek <mbroek at mbse dot eu> * @@ -135,7 +135,9 @@ { id: 1, en: 'Plug', nl: 'Plugs' }, { id: 2, en: 'Leaf', nl: 'Bloemen' }, { id: 3, en: 'Leaf wet', nl: 'Hop nat' }, - { id: 4, en: 'Cryo', nl: 'Cryo' } + { id: 4, en: 'Cryo', nl: 'Cryo' }, + { id: 5, en: 'CO2 extract', nl: 'CO2 extract' }, + { id: 6, en: 'Iso extract', nl: 'Iso extract' } ], HopFormSource = { localdata: HopFormData, @@ -150,7 +152,8 @@ { id: 2, en: 'Boil', nl: 'Koken' }, { id: 3, en: 'Aroma', nl: 'Vlamuit' }, { id: 4, en: 'Whirlpool', nl: 'Whirlpool' }, - { id: 5, en: 'Dry hop', nl: 'Koudhop' } + { id: 5, en: 'Dry hop', nl: 'Koudhop' }, + { id: 6, en: 'Bottling', nl: 'Bottelen' } ], HopUseSource = { localdata: HopUseData, @@ -285,7 +288,8 @@ { id: 2, en: 'Boil', nl: 'Koken' }, { id: 3, en: 'Primary', nl: 'Hoofdvergisting' }, { id: 4, en: 'Secondary', nl: 'Nagisting/lagering' }, - { id: 5, en: 'Bottling', nl: 'Bottelen' } + { id: 5, en: 'Bottling', nl: 'Bottelen' }, + { id: 6, en: 'Sparge', nl: 'Spoelen' } ], MiscUseSource = { localdata: MiscUseData,
--- a/www/js/rec_edit.js Wed Aug 03 16:01:30 2022 +0200 +++ b/www/js/rec_edit.js Wed Aug 03 17:17:00 2022 +0200 @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2018-2021 + * Copyright (C) 2018-2022 * * Michiel Broek <mbroek at mbse dot eu> * @@ -103,10 +103,6 @@ w100 = 90; w80 = 60; } - $('#hopGrid').jqxGrid({ editable: rw }); - $('#haddrowbutton').jqxDropDownList({ disabled: ro }); - $('#hinstockbutton').jqxCheckBox({ disabled: ro }); - $('#hdeleterowbutton').jqxButton({ disabled: ro }); $('#miscGrid').jqxGrid({ editable: rw }); $('#maddrowbutton').jqxDropDownList({ disabled: ro }); $('#minstockbutton').jqxCheckBox({ disabled: ro }); @@ -430,7 +426,7 @@ $('#hop_aroma').jqxProgressBar('val', hop_aroma); } - +/* function adjustHops(factor) { var i, row, amount, rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount; @@ -443,7 +439,7 @@ $('#hopGrid').jqxGrid('setcellvalue', i, 'h_amount', amount); } } - +*/ function adjustMiscs(factor) { @@ -913,9 +909,6 @@ { name: 'f_inventory', type: 'float' }, { name: 'f_avail', type: 'int' } ], - addrow: function(rowid, rowdata, position, commit) { commit(true); }, - deleterow: function(rowid, commit) { commit(true); }, - updaterow: function(rowid, rowdata, commit) { commit(true); } }, fermentableAdapter = new $.jqx.dataAdapter(fermentableSource); @@ -988,9 +981,6 @@ { name: 'h_inventory', type: 'float' }, { name: 'h_avail', type: 'int' } ], - addrow: function(rowid, rowdata, position, commit) { commit(true); }, - deleterow: function(rowid, commit) { commit(true); }, - updaterow: function(rowid, rowdata, commit) { commit(true); } }, hopAdapter = new $.jqx.dataAdapter(hopSource); @@ -999,88 +989,17 @@ height: 560, source: hopAdapter, theme: theme, - selectionmode: 'singlerow', - showtoolbar: true, - rendertoolbar: function(toolbar) { - var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); - toolbar.append(container); - container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); - container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); - container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>'); - container.append('<input style="float: left; margin-left: 400px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />'); - // add hop from dropdownlist. - $('#haddrowbutton').jqxDropDownList({ - placeHolder: 'Kies hop:', - theme: theme, - template: 'primary', - source: hoplist, - displayMember: 'name', - width: 150, - height: 27, - dropDownWidth: 500, - dropDownHeight: 500, - renderer: function(index, label, value) { - var datarecord = hoplist.records[index]; - return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + '% α)'; - } - }); - $('#haddrowbutton').on('select', function(event) { - if (event.args) { - var datarecord, row = {}, index = event.args.index; - datarecord = hoplist.records[index]; - row['h_name'] = datarecord.name; - row['h_origin'] = datarecord.origin; - row['h_amount'] = 0; - row['h_cost'] = datarecord.cost; - row['h_type'] = datarecord.type; - row['h_form'] = datarecord.form; - row['h_useat'] = 2; // Boil - row['h_time'] = 0; - row['h_alpha'] = datarecord.alpha; - row['h_beta'] = datarecord.beta; - row['h_hsi'] = datarecord.hsi; - row['h_humulene'] = datarecord.humulene; - row['h_caryophyllene'] = datarecord.caryophyllene; - row['h_cohumulone'] = datarecord.cohumulone; - row['h_myrcene'] = datarecord.myrcene; - row['h_total_oil'] = datarecord.total_oil; - row['h_inventory'] = datarecord.inventory; - $('#hopGrid').jqxGrid('addrow', null, row); - } - $('#haddrowbutton').jqxDropDownList('clearSelection'); - }); - - $('#hinstockbutton').jqxCheckBox({ theme: theme, height: 27 }); - $('#hinstockbutton').on('change', function(event) { - hopinstock = event.args.checked; - hoplist.dataBind(); - }); - - // delete selected hop. - $('#hdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150 }); - $('#hdeleterowbutton').on('click', function() { - var rowscount, id, selectedrowindex = $('#hopGrid').jqxGrid('getselectedrowindex'); - rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount; - if (selectedrowindex >= 0 && selectedrowindex < rowscount) { - id = $('#hopGrid').jqxGrid('getrowid', selectedrowindex); - $('#hopGrid').jqxGrid('deleterow', id); - } - calcIBUs(); - }); - }, + editable: false, ready: function() { $('#jqxTabs').jqxTabs('next'); }, columns: [ - { text: 'Hop', datafield: 'h_name', - cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { - return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.h_origin + ' / ' + rowdata.h_name + '</span>'; - } - }, + { text: 'Hop', datafield: 'h_name' }, + { text: 'Origin', width: 180, datafield: 'h_origin' }, { text: 'Type', width: 90, datafield: 'h_type', cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>'; } }, - { text: 'Vorm', width: 90, datafield: 'h_form', + { text: 'Vorm', width: 110, datafield: 'h_form', cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>'; } @@ -1103,9 +1022,9 @@ }, { text: 'IBU', datafield: 'ibu', width: 80, align: 'right', cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { - var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat(dataRecord.batch_size) /*parseFloat($('#batch_size').jqxNumberInput('decimal'))*/, + var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat(dataRecord.batch_size), parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), - parseFloat(rowdata.h_alpha), $('#ibu_method').val(), 0, parseFloat(rowdata.h_time), 0); + parseFloat(rowdata.h_alpha), dataRecord.ibu_method, 0, parseFloat(rowdata.h_time), 0); return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, 'f1') + '</span>'; } }, @@ -1116,41 +1035,6 @@ amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; } - }, - { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right', - cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { - var amount, color = '#ffffff'; - if (value < rowdata.h_amount) - color = '#ff4040'; - amount = dataAdapter.formatNumber(value, 'f1') + ' kg'; - if (value < 1) - amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; - return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; - } - }, - { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', - cellsrenderer: function() { - return 'Wijzig'; - }, buttonclick: function(row) { - hopRow = row; - hopData = $('#hopGrid').jqxGrid('getrowdata', hopRow); - $('#wh_name').val(hopData.h_name); - $('#wh_amount').val(hopData.h_amount * 1000); - var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, - parseFloat($('#batch_size').jqxNumberInput('decimal')), - parseFloat(hopData.h_amount), parseFloat(hopData.h_time), - parseFloat(hopData.h_alpha), $('#ibu_method').val(), - 0, parseFloat(hopData.h_time), 0 - ); - $('#wh_ibu').val(ibu); - 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'); - } } ] }); @@ -1171,9 +1055,9 @@ { name: 'm_inventory', type: 'float' }, { name: 'm_avail', type: 'int' } ], - addrow: function(rowid, rowdata, position, commit) { commit(true); }, - deleterow: function(rowid, commit) { commit(true); }, - updaterow: function(rowid, rowdata, commit) { commit(true); } +// addrow: function(rowid, rowdata, position, commit) { commit(true); }, +// deleterow: function(rowid, commit) { commit(true); }, +// updaterow: function(rowid, rowdata, commit) { commit(true); } }, miscAdapter = new $.jqx.dataAdapter(miscSource, { beforeLoadComplete: function(records) { @@ -1182,7 +1066,57 @@ row = records[i]; data.push(row); // Initial set water agent values. - switch (row.m_name) { + if (row.m_use_use == 1) { // Mash + switch (row.m_name) { + case 'CaCl2': + $('#wa_cacl2').val(row.m_amount * 1000); + break; + case 'CaSO4': + $('#wa_caso4').val(row.m_amount * 1000); + break; + case 'MgSO4': + $('#wa_mgso4').val(row.m_amount * 1000); + break; + case 'NaCl': + $('#wa_nacl').val(row.m_amount * 1000); + break; + case 'MgCl2': + $('#wa_mgcl2').val(row.m_amount * 1000); + break; + case 'NaHCO3': + $('#wa_nahco3').val(row.m_amount * 1000); + break; + case 'CaCO3': + $('#wa_caco3').val(row.m_amount * 1000); + break; + case 'Melkzuur': + $('#wa_acid_name').val(0); + $('#wa_acid').val(row.m_amount * 1000); + $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc); + last_acid = 'Melkzuur'; + break; + case 'Zoutzuur': + $('#wa_acid_name').val(1); + $('#wa_acid').val(row.m_amount * 1000); + $('#wa_acid_perc').val(AcidTypeData[1].AcidPrc); + last_acid = 'Zoutzuur'; + break; + case 'Fosforzuur': + $('#wa_acid_name').val(2); + $('#wa_acid').val(row.m_amount * 1000); + $('#wa_acid_perc').val(AcidTypeData[2].AcidPrc); + last_acid = 'Fosforzuur'; + break; + case 'Zwavelzuur': + $('#wa_acid_name').val(3); + $('#wa_acid').val(row.m_amount * 1000); + $('#wa_acid_perc').val(AcidTypeData[3].AcidPrc); + last_acid = 'Zwavelzuur'; + break; + } + } + if (row.m_use_use == 6) { // Sparge + /*switch (row.m_name) { case 'CaCl2': $('#wa_cacl2').val(row.m_amount * 1000); break; @@ -1228,6 +1162,7 @@ $('#wa_acid_perc').val(AcidTypeData[3].AcidPrc); last_acid = 'Zwavelzuur'; break; + } */ } } return data; @@ -1239,60 +1174,7 @@ height: 575, source: miscAdapter, theme: theme, - selectionmode: 'singlerow', - showtoolbar: true, - rendertoolbar: function(toolbar) { - //var me = this; - var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); - toolbar.append(container); - container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>'); - container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); - container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>'); - container.append('<input style="float: left; margin-left: 400px;" id="mdeleterowbutton" type="button" value="Verwijder ingrediënt" />'); - // add misc from dropdownlist. - $('#maddrowbutton').jqxDropDownList({ - placeHolder: 'Kies ingrediënt:', - theme: theme, - template: 'primary', - source: misclist, - displayMember: 'name', - width: 150, - height: 27, - dropDownWidth: 500, - dropDownHeight: 500 - }); - $('#maddrowbutton').on('select', function(event) { - if (event.args) { - var datarecord, row = {}, index = event.args.index; - datarecord = misclist.records[index]; - row['m_name'] = datarecord.name; - row['m_amount'] = 0; - row['m_cost'] = datarecord.cost; - row['m_type'] = datarecord.type; - row['m_use_use'] = datarecord.use_use; - row['m_time'] = 0; - row['m_amount_is_weight'] = datarecord.amount_is_weight; - row['m_inventory'] = datarecord.inventory; - $('#miscGrid').jqxGrid('addrow', null, row); - } - }); - $('#minstockbutton').jqxCheckBox({ theme: theme, height: 27 }); - $('#minstockbutton').on('change', function(event) { - miscinstock = event.args.checked; - misclist.dataBind(); - }); - // delete selected misc. - $('#mdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150 }); - $('#mdeleterowbutton').on('click', function() { - var rowscount, type, id, selectedrowindex = $('#miscGrid').jqxGrid('getselectedrowindex'); - rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount; - type = $('#miscGrid').jqxGrid('getcellvalue', selectedrowindex, 'm_type'); - if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent - id = $('#miscGrid').jqxGrid('getrowid', selectedrowindex); - $('#miscGrid').jqxGrid('deleterow', id); - } - }); - }, + editable: false, ready: function() { $('#jqxTabs').jqxTabs('next'); }, @@ -1308,11 +1190,11 @@ return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscUseData[value].nl + '</span>'; } }, - { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right', + { text: 'Tijd', datafield: 'm_time', width: 140, align: 'right', cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { var duration = ''; if (rowdata.m_use_use == 2) // Boil - duration = dataAdapter.formatNumber(value, 'f0') + ' min.'; + duration = dataAdapter.formatNumber(value, 'f0') + ' minuten'; else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen'; return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; @@ -1324,39 +1206,6 @@ return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>'; } - }, - { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right', - cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { - var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml', - color = (value < rowdata.m_amount) ? '#ff4040':'#ffffff', - amount = dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr; - return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; - }, - }, - { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', - cellsrenderer: function() { - return 'Wijzig'; - }, buttonclick: function(row) { - miscRow = row; - miscData = $('#miscGrid').jqxGrid('getrowdata', miscRow); - if (miscData.m_type == 4) { - alert('Brouwzouten wijzigen in de water tab.'); - } else { - if (miscData.m_amount_is_weight) - $('#wm_pmpt_amount').html('Gewicht gram:'); - else - $('#wm_pmpt_amount').html('Volume ml:'); - $('#wm_name').val(miscData.m_name); - $('#wm_amount').val(miscData.m_amount * 1000); - if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary - $('#wm_time').val(miscData.m_time / 1440); - else - $('#wm_time').val(miscData.m_time); - $('#wm_use_use').val(miscData.m_use_use); - // show the popup window. - $('#popupMisc').jqxWindow('open'); - } - } } ] }); @@ -2191,39 +2040,6 @@ $('#sparge_acid_amount').val(Acid); } - /* - * Change OG of recipe but keep the water volumes. - */ - function calcFermentablesFromOG(OG) { - - console.log('calcFermentablesFromOG(' + OG + ')'); - var amount, row, d, i, sug, tot = 0, totmass = 0, rowscount, efficiency = parseFloat($('#efficiency').jqxNumberInput('decimal')); - sug = sg_to_plato(OG) * parseFloat($('#batch_size').jqxNumberInput('decimal')) * OG / 100; //total amount of sugars in kg - rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; - - for (i = 0; i < rowscount; i++) { - row = $('#fermentableGrid').jqxGrid('getrowdata', i); - if (row.f_added < 4) { - d = row.f_percentage / 100 * (row.f_yield / 100) * (1 - row.f_moisture / 100); - if (row.f_added == 0) // Mash - d = efficiency / 100 * d; - tot += d; - } - } - if (tot) - totmass = Math.round((sug / tot) * 1000) / 1000; - - if (totmass) { - for (i = 0; i < rowscount; i++) { - row = $('#fermentableGrid').jqxGrid('getrowdata', i); - if (row.f_added < 4) { - amount = Math.round(row.f_percentage * 10 * totmass) / 1000; - $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', amount); - } - } - } - }; - function calcInit() { console.log('calc.init()'); @@ -2695,259 +2511,8 @@ return 'Zeer veel'; } }); - $('#popupHop').jqxWindow({ - width: 800, - height: 300, - position: { x: 230, y: 100 }, - resizable: false, - theme: theme, - isModal: true, - autoOpen: false, - cancelButton: $('#HopReady'), - modalOpacity: 0.40 - }); - $('#HopReady').jqxButton({ template: 'success', width: '90px', theme: theme }); - $('#HopReady').click(function() { - var row, rowID = $('#hopGrid').jqxGrid('getrowid', hopRow); - console.log('HopReady row:' + hopRow + ' ID:' + rowID); - row = { - h_name: $('#wh_name').val(), - h_origin: hopData.h_origin, - h_amount: parseFloat($('#wh_amount').jqxNumberInput('decimal')) / 1000, - h_cost: hopData.h_cost, - h_type: hopData.h_type, - h_form: hopData.h_form, - h_useat: $('#wh_useat').val(), - h_time: hopData.h_time, - h_alpha: hopData.h_alpha, - h_beta: hopData.h_beta, - h_hsi: hopData.h_hsi, - h_humulene: hopData.h_humulene, - h_caryophyllene: hopData.h_caryophyllene, - h_cohumulone: hopData.h_cohumulone, - h_myrcene: hopData.h_myrcene, - h_total_oil: hopData.h_total_oil, - h_inventory: hopData.h_inventory, - h_avail: hopData.h_avail - }; - $('#hopGrid').jqxGrid('updaterow', rowID, row); - calcIBUs(); - }); - $('#wh_name').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#wh_instock').jqxCheckBox({ theme: theme, height: 23 }); - $('#wh_instock').on('change', function(event) { - hopinstock = event.args.checked; - hoplist.dataBind(); - }); - $('#wh_select').jqxDropDownList({ - placeHolder: 'Kies hop:', - theme: theme, - source: hoplist, - displayMember: 'name', - width: 150, - height: 23, - dropDownWidth: 500, - dropDownHeight: 500, - renderer: function(index, label, value) { - var datarecord = hoplist.records[index]; - return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + ' % α)'; - } - }); - $('#wh_select').on('select', function(event) { - if (event.args) { - var datarecord, index = event.args.index; - datarecord = hoplist.records[index]; - $('#wh_name').val(datarecord.name); - hopData.h_name = datarecord.name; - hopData.h_origin = datarecord.origin; - hopData.h_cost = datarecord.cost; - hopData.h_type = datarecord.type; - hopData.h_form = datarecord.form; - hopData.h_alpha = datarecord.alpha; - hopData.h_beta = datarecord.beta; - hopData.h_hsi = datarecord.hsi; - hopData.h_humulene = datarecord.humulene; - hopData.h_caryophyllene = datarecord.caryophyllene; - hopData.h_cohumulone = datarecord.cohumulone; - hopData.h_myrcene = datarecord.myrcene; - hopData.h_total_oil = datarecord.total_oil; - hopData.h_inventory = datarecord.inventory; - } - }); - $('#wh_amount').jqxNumberInput(Spin1dec); - $('#wh_amount').on('change', function(event) { - var ibu, amount = parseFloat(event.args.value) / 1000; - ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), - amount, parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(), 0, parseFloat(hopData.h_time), 0); - hopData.h_amount = amount; - console.log('amount changed: ' + event.args.value + ' time:' + hopData.h_time + ' alpha:' + hopData.h_alpha + ' IBU:' + ibu); - $('#wh_ibu').val(ibu); - }); - $('#wh_ibu').jqxNumberInput(Show1dec); - $('#wh_time').jqxNumberInput(PosInt); - $('#wh_time').on('change', function(event) { - var ibu, newtime = parseFloat(event.args.value); - // Check limits and correct - if (hopData.h_useat == 2) { // Boil - if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) { - newtime = parseFloat($('#boil_time').jqxNumberInput('decimal')); - $('#wh_time').val(newtime); - } - hopData.h_time = newtime; - } else if (hopData.h_useat == 4) { // Whirlpool - if (newtime > 120) { - newtime = 120; - $('#wh_time').val(newtime); - } - hopData.h_time = newtime; - } else if (hopData.h_useat == 5) { // Dry hop - if (newtime > 21) { - newtime = 21; - $('#wh_time').val(newtime); - } - hopData.h_time = newtime * 1440; - } - ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), - parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(), 0, parseFloat(hopData.h_time), 0); - $('#wh_ibu').val(ibu); - }); - $('#wh_useat').jqxDropDownList({ - theme: theme, - source: HopUseAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - height: 23, - autoDropDownHeight: true, - dropDownVerticalAlignment: 'top' - }); - $('#wh_useat').on('select', function(event) { - if (event.args) { - var index = event.args.index; - hopData.h_useat = index; - if ((index == 0) || (index == 1)) { // Mashhop or First wort hop - hopData.h_time = parseFloat(dataRecord.boil_time); - $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); - $('#wh_time').val(hopData.h_time); - } else if (index == 3) { // Aroma - hopData.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'); - } - }); // Tab 4, Diversen - $('#popupMisc').jqxWindow({ - width: 800, - height: 275, - position: { x: 230, y: 100 }, - resizable: false, - theme: theme, - isModal: true, - autoOpen: false, - cancelButton: $('#MiscReady'), - modalOpacity: 0.40 - }); - $('#MiscReady').jqxButton({ template: 'success', width: '90px', theme: theme }); - $('#MiscReady').click(function() { - var row, rowID = $('#miscGrid').jqxGrid('getrowid', miscRow); - console.log('MiscReady row:' + miscRow + ' ID:' + rowID); - row = { - m_name: miscData.m_name, - m_amount: miscData.m_amount, - m_cost: miscData.m_cost, - m_type: miscData.m_type, - m_use_use: miscData.m_use_use, - m_time: miscData.m_time, - m_amount_is_weight: miscData.m_amount_is_weight, - m_inventory: miscData.m_inventory, - m_avail: miscData.m_avail - }; - $('#miscGrid').jqxGrid('updaterow', rowID, row); - }); - $('#wm_name').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#wm_instock').jqxCheckBox({ theme: theme, height: 23 }); - $('#wm_instock').on('change', function(event) { - miscinstock = event.args.checked; - misclist.dataBind(); - }); - $('#wm_select').jqxDropDownList({ - placeHolder: 'Kies ingrediënt:', - theme: theme, - source: misclist, - displayMember: 'name', - width: 150, - height: 23, - dropDownWidth: 500, - dropDownHeight: 500 - }); - $('#wm_select').on('select', function(event) { - if (event.args) { - var datarecord, index = event.args.index; - datarecord = misclist.records[index]; - $('#wm_name').val(datarecord.name); - miscData.m_name = datarecord.name; - miscData.m_cost = datarecord.cost; - miscData.m_type = datarecord.type; - miscData.m_use_use = datarecord.use_use; - miscData.m_amount_is_weight = datarecord.amount_is_weight; - miscData.m_inventory = datarecord.inventory; - } - }); - $('#wm_amount').jqxNumberInput(Spin1dec); - $('#wm_amount').on('change', function(event) { - console.log('amount changed: ' + event.args.value); - miscData.m_amount = parseFloat(event.args.value) / 1000; - }); - $('#wm_time').jqxNumberInput(PosInt); - $('#wm_time').on('change', function(event) { - console.log('time changed: ' + event.args.value); - var newtime = parseFloat(event.args.value); - - if (miscData.m_use_use == 2) { // Boil - if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) { - newtime = parseFloat($('#boil_time').jqxNumberInput('decimal')); - $('#wm_time').val(newtime); - } - miscData.m_time = newtime; - } else if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) { // Primary or Secondary - if (newtime > 21) { - newtime = 21; - $('#wm_time').val(newtime); - } - miscData.m_time = newtime * 1440; - } - }); - $('#wm_use_use').jqxDropDownList({ - theme: theme, - source: MiscUseAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - height: 23, - autoDropDownHeight: true, - dropDownVerticalAlignment: 'top' - }); - $('#wm_use_use').on('select', function(event) { - if (event.args) { - var index = event.args.index; - miscData.m_use_use = index; - if ((index == 2) || (index == 3) || (index == 4)) { // Boil, Primary or Secondary - $('#wm_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); - } else { - miscData.m_time = 0; - $('#wm_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); - $('#wm_time').val(0); - } - } - }); // Tab 5, Gist $('#est_fg2').jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
--- a/www/rec_edit.php Wed Aug 03 16:01:30 2022 +0200 +++ b/www/rec_edit.php Wed Aug 03 17:17:00 2022 +0200 @@ -359,84 +359,6 @@ </div> <!-- jqxTabs --> - <div id="popupHop"> - <div>Wijzig hop detail.</div> - <div style="overflow: hidden;"> - <table style="width: 100%;"> - <tr> - <td align="right" style="vertical-align: top;">Hop naam:</td> - <td style="padding: 3px;"><input readonly="1" id="wh_name" /></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Andere hop:</td> - <td style="padding: 3px;"><div style='overflow: hidden;'> - <div style="float: left;" id="wh_select"></div> - <div style="float: left; margin-left: 10px;">In voorraad:</div> - <div style="float: left; margin-left: 10px;" id="wh_instock"></div></div> - </td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Hoeveelheid gram:</td> - <td style="padding: 3px;"><div id="wh_amount"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Gewenst IBU:</td> - <td style="padding: 3px;"><div id="wh_ibu"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;"><div id="wh_pmpt_time">Tijdsduur:</div></td> - <td style="padding: 3px;"><div id="wh_time"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Gebruik tijdens:</td> - <td style="padding: 3px;"><div id="wh_useat"></div></td> - </tr> - <tr> - <td style="padding-top: 30px;" colspan="2" align="center"> - <input id="HopReady" type="button" value="Sla op" /> - </td> - </tr> - </table> - </div> - </div> - - <div id="popupMisc"> - <div>Wijzig diversen detail.</div> - <div style="overflow: hidden;"> - <table style="width: 100%;"> - <tr> - <td align="right" style="vertical-align: top;">Ingrediënt naam:</td> - <td style="padding: 3px;"><input readonly="1" id="wm_name" /></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Ander ingrediënt:</td> - <td style="padding: 3px;"><div style='overflow: hidden;'> - <div style="float: left;" id="wm_select"></div> - <div style="float: left; margin-left: 10px;">In voorraad:</div> - <div style="float: left; margin-left: 10px;" id="wm_instock"></div></div> - </td> - </tr> - <tr> - <td align="right" style="vertical-align: top;"><div id="wm_pmpt_amount">Hoeveelheid:</div></td> - <td style="padding: 3px;"><div id="wm_amount"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;"><div id="wm_pmpt_time">Tijdsduur:</div></td> - <td style="padding: 3px;"><div id="wm_time"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Gebruik tijdens:</td> - <td style="padding: 3px;"><div id="wm_use_use"></div></td> - </tr> - <tr> - <td style="padding-top: 30px;" colspan="2" align="center"> - <input id="MiscReady" type="button" value="Sla op" /> - </td> - </tr> - </table> - </div> - </div> - <div id="popupYeast"> <div>Wijzig gist detail.</div> <div style="overflow: hidden;">