diff -r 7ee8072baaba -r 7952f9331fd1 www/js/inv_fermentables.js --- a/www/js/inv_fermentables.js Tue Sep 10 15:22:12 2019 +0200 +++ b/www/js/inv_fermentables.js Wed Sep 11 15:58:32 2019 +0200 @@ -335,7 +335,7 @@ $("#name").jqxInput('selectAll'); }); $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); - $("#Delete").click(function () { + $("#Delete").click(function() { if (editrow >= 0) { // Open a popup to confirm this action. $('#eventWindow').jqxWindow('open'); @@ -346,13 +346,47 @@ } $("#popupWindow").jqxWindow('hide'); }); - $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); + $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme }); + $('#Clone').jqxButton({ template: 'warning', width: '90px', theme: theme }); + $('#Clone').click(function() { + var row = { + record: -1, + name: $('#name').val() + ' kopie', + type: $('#type').val(), + yield: parseFloat($('#yield').jqxNumberInput('decimal')), + color: parseFloat($('#color').jqxNumberInput('decimal')), + add_after_boil: $('#add_after_boil').val(), + origin: $('#origin').val(), + supplier: $('#supplier').val(), + notes: $('#notes').val(), + coarse_fine_diff: parseFloat($('#coarse_fine_diff').jqxNumberInput('decimal')), + moisture: parseFloat($('#moisture').jqxNumberInput('decimal')), + diastatic_power: kolbach_to_lintner(parseFloat($('#diastatic_power').jqxNumberInput('decimal'))), + protein: parseFloat($('#protein').jqxNumberInput('decimal')), + dissolved_protein: parseFloat($('#dissolved_protein').jqxNumberInput('decimal')), + max_in_batch: parseFloat($('#max_in_batch').jqxNumberInput('decimal')), + recommend_mash: $('#recommend_mash').val(), + added: $('#added').val(), + always_on_stock: $('#always_on_stock').val(), + di_ph: parseFloat($('#di_ph').jqxNumberInput('decimal')), + acid_to_ph_57: parseFloat($('#acid_to_ph_57').jqxNumberInput('decimal')), + graintype: $('#graintype').val(), + inventory: 0, + cost: parseFloat($('#cost').jqxNumberInput('decimal')), + production_date: '', + tht_date: '' + + }; + $('#jqxgrid').jqxGrid('addrow', null, row); + $('#popupWindow').jqxWindow('hide'); + location.reload( true ); // reload ourself. + }); $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); // update the edited row when the user clicks the 'Save' button. - $("#Save").click(function () { + $("#Save").click(function() { var rowID = -1; if (editrow >= 0) { - var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); + rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); } var row = { record: rowID,