diff -r 293ec25995db -r bd20a8329b1b www/js/prod_edit.js
--- a/www/js/prod_edit.js Fri Aug 05 14:54:22 2022 +0200
+++ b/www/js/prod_edit.js Fri Aug 05 15:10:54 2022 +0200
@@ -47,30 +47,6 @@
cancelButton: $('#pitchrateReady')
});
- $('#popupHop').jqxWindow({
- width: 800,
- height: 300,
- position: { x: 230, y: 100 },
- resizable: false,
- theme: theme,
- isModal: true,
- autoOpen: false,
- cancelButton: $('#HopReady'),
- modalOpacity: 0.40
- });
-
- $('#popupMisc').jqxWindow({
- width: 800,
- height: 275,
- position: { x: 230, y: 100 },
- resizable: false,
- theme: theme,
- isModal: true,
- autoOpen: false,
- cancelButton: $('#MiscReady'),
- modalOpacity: 0.40
- });
-
$('#popupYeast').jqxWindow({
width: 800,
height: 300,
@@ -934,9 +910,6 @@
{ 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); }
},
miscAdapter = new $.jqx.dataAdapter(miscSource, {
beforeLoadComplete: function(records) {
@@ -945,52 +918,73 @@
row = records[i];
data.push(row);
// Initial set water agent values.
- 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); // TODO: this ignores changed percentages.
- 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 == 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(AcidTypeData[0].nl);
+ $('#wa_acid').val(row.m_amount * 1000);
+ $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
+ last_acid = 'Melkzuur';
+ break;
+ case 'Zoutzuur':
+ $('#wa_acid_name').val(AcidTypeData[1].nl);
+ $('#wa_acid').val(row.m_amount * 1000);
+ $('#wa_acid_perc').val(AcidTypeData[1].AcidPrc);
+ last_acid = 'Zoutzuur';
+ break;
+ case 'Fosforzuur':
+ $('#wa_acid_name').val(AcidTypeData[2].nl);
+ $('#wa_acid').val(row.m_amount * 1000);
+ $('#wa_acid_perc').val(AcidTypeData[2].AcidPrc);
+ last_acid = 'Fosforzuur';
+ break;
+ case 'Zwavelzuur':
+ $('#wa_acid_name').val(AcidTypeData[3].nl);
+ $('#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':
+// $('#ss_cacl2').val(row.m_amount * 1000);
+ break;
+ case 'CaSO4':
+// $('#ss_caso4').val(row.m_amount * 1000);
+ break;
+ case 'MgSO4':
+// $('#ss_mgso4').val(row.m_amount * 1000);
+ break;
+ case 'NaCl':
+// $('#ss_nacl').val(row.m_amount * 1000);
+ break;
+ case 'MgCl2':
+// $('#ss_mgcl2').val(row.m_amount * 1000);
+ break;
+ }
}
}
return data;
@@ -1002,65 +996,7 @@
height: 575,
source: miscAdapter,
theme: theme,
- selectionmode: 'singlerow',
- showtoolbar: true,
- rendertoolbar: function(toolbar) {
- var container = $("
");
- toolbar.append(container);
- container.append('');
- container.append('In voorraad:
');
- container.append('');
- container.append('');
- // add misc from dropdownlist.
- $('#maddrowbutton').jqxDropDownList({
- placeHolder: 'Kies ingrediënt:',
- theme: theme,
- template: 'primary',
- source: misclist,
- disabled: (dataRecord.stage > 6),
- 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'] = minimum_misc(dataRecord.stage, 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, disabled: (dataRecord.stage > 6) });
- $('#minstockbutton').on('change', function(event) {
- miscinstock = event.args.checked;
- misclist.dataBind();
- });
- // delete selected misc.
- $('#mdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 6) });
- $('#mdeleterowbutton').on('click', function() {
- var rowscount, type, id, selectedrowindex = $('#miscGrid').jqxGrid('getselectedrowindex');
- rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount;
- type = $('#miscGrid').jqxGrid('getcellvalue', selectedrowindex, 'm_type');
- use_use = $('#miscGrid').jqxGrid('getcellvalue', selectedrowindex, 'm_use_use');
- if (selectedrowindex >= 0 && selectedrowindex < rowscount && type == 4) {
- alert('Brouwzouten verwijderen in de water tab.');
- } else if (block_misc(dataRecord.stage, use_use)) {
- alert('Ingredieënt is al verwerkt.');
- } else {
- id = $('#miscGrid').jqxGrid('getrowid', selectedrowindex);
- $('#miscGrid').jqxGrid('deleterow', id);
- }
- });
- },
+ editable: false,
ready: function() { $('#jqxTabs').jqxTabs('next'); },
columns: [
{ text: 'Ingredient', datafield: 'm_name' },
@@ -1101,39 +1037,6 @@
return '';
}
}
- },
- { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center',
- cellsrenderer: function() {
- return 'Wijzig';
- }, buttonclick: function(row) {
- miscRow = row;
- miscData = $('#miscGrid').jqxGrid('getrowdata', miscRow);
- if (block_misc(dataRecord.stage, miscData.m_use_use)) {
- alert('Ingredieënt is al verwerkt.');
- } else if (miscData.m_type == 4) {
- alert('Brouwzouten wijzigen in de water tab.');
- } else {
- console.log('edit button row ' + row);
- 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);
- drop_endis(dataRecord.stage >= 2, '#wm_use_use', 0);
- drop_endis(dataRecord.stage >= 3, '#wm_use_use', 1);
- drop_endis(dataRecord.stage >= 3, '#wm_use_use', 2);
- drop_endis(dataRecord.stage >= 4, '#wm_use_use', 3);
- drop_endis(dataRecord.stage >= 5, '#wm_use_use', 4);
- // show the popup window.
- $('#popupMisc').jqxWindow('open');
- }
- }
}
]
});
@@ -1821,11 +1724,6 @@
$('#mash_kg').val(mashkg);
console.log('calcFermentables() supplies:' + ok_fermentables + ' moutsuiker:' + Round(sugarsm, 3) + '/' + Round(sugarsf, 3));
to_100 = my_100;
- if (to_100) {
- $('#wf_amount').jqxNumberInput({ width: 90, readOnly: true, spinButtons: false });
- } else {
- $('#wf_amount').jqxNumberInput({ width: 110, readOnly: false, spinButtons: true });
- }
if (mvol > 0) {
v = s / sugardensity + mvol;
@@ -4177,43 +4075,6 @@
colorRanges: [{ stop: 30, color: '#FF0000' },{ stop: 40, color: '#EB7331' },{ stop: 200, color: '#008C00' }],
renderText: function(text) { return (parseInt(text) * 2) + ' lintner'; }
});
- $('#FermentableReady').jqxButton({ template: 'success', width: '90px', theme: theme });
- $('#FermentableReady').click(function() {
- var row, rowID = $('#fermentableGrid').jqxGrid('getrowid', fermentableRow);
- console.log('FermentableReady row:' + fermentableRow + ' ID:' + rowID);
- row = {
- f_name: fermentableData.f_name,
- f_origin: fermentableData.f_origin,
- f_supplier: fermentableData.f_supplier,
- f_amount: fermentableData.f_amount,
- f_cost: fermentableData.f_cost,
- f_type: fermentableData.f_type,
- f_yield: fermentableData.f_yield,
- f_color: fermentableData.f_color,
- f_coarse_fine_diff: fermentableData.f_coarse_fine_diff,
- f_moisture: fermentableData.f_moisture,
- f_diastatic_power: fermentableData.f_diastatic_power,
- f_protein: fermentableData.f_protein,
- f_max_in_batch: fermentableData.f_max_in_batch,
- f_graintype: fermentableData.f_graintype,
- f_added: fermentableData.f_added,
- f_dissolved_protein: fermentableData.f_dissolved_protein,
- f_recommend_mash: fermentableData.f_recommend_mash,
- f_add_after_boil: fermentableData.f_add_after_boil,
- f_adjust_to_total_100: fermentableData.f_adjust_to_total_100,
- f_percentage: fermentableData.f_percentage,
- f_di_ph: fermentableData.f_di_ph,
- f_acid_to_ph_57: fermentableData.f_acid_to_ph_57,
- f_inventory: fermentableData.f_inventory,
- f_avail: fermentableData.f_avail
- };
- $('#fermentableGrid').jqxGrid('updaterow', rowID, row);
- calcPercentages();
- calcFermentables();
- calcIBUs();
- calcMash();
- // Waters: yes there is impact.
- });
// Tab 4, Hops
$('#est_ibu2').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
@@ -4264,237 +4125,8 @@
return 'Zeer veel';
}
});
- $('#HopReady').jqxButton({ template: 'success', width: '90px', theme: theme });
- $('#HopReady').click(function() {
- var row, rowID = $('#hopGrid').jqxGrid('getrowid', hopRow);
- 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) {
- console.log('amount changed: ' + event.args.value + ' time:' + hopData.h_time + ' alpha:' + hopData.h_alpha);
- 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(),
- dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6
- );
- hopData.h_amount = amount;
- $('#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 == 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(),
- dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6);
- $('#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 if (index == 4) { // Whirlpool
- hopData.h_time = (parseFloat(dataRecord.brew_whirlpool9) + parseFloat(dataRecord.brew_whirlpool7) + parseFloat(dataRecord.brew_whirlpool6));
- $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
- $('#wh_time').val(hopData.h_time);
- } else { // Boil, 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 5, Miscs
- $('#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);
- calcMiscs();
- });
- $('#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(Spin2dec);
- $('#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) {
- 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 {
- $('#wm_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
- $('#wm_time').val(0);
- miscData.m_time = 0;
- }
- }
- });
// Tab 6, Yeasts
$('#est_fg2').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });