diff -r 06df1320327c -r 77f1617b6994 www/js/inv_equipments.js --- a/www/js/inv_equipments.js Fri Sep 13 16:54:51 2019 +0200 +++ b/www/js/inv_equipments.js Fri Sep 13 20:24:31 2019 +0200 @@ -44,22 +44,20 @@ $(document).ready(function () { - var dataRecord = {}; - function calcBatchVolume() { - var calc = $("#calc_boil_volume").val(); - var boil_size = parseFloat($("#boil_size").jqxNumberInput('decimal')); - var evap_rate = parseFloat($("#evap_rate").jqxNumberInput('decimal')); - var boil_time = parseFloat($("#boil_time").jqxNumberInput('decimal')); - var top_up = parseFloat($("#top_up_kettle").jqxNumberInput('decimal')); + var calc = $("#calc_boil_volume").val(), + boil_size = parseFloat($("#boil_size").jqxNumberInput('decimal')), + evap_rate = parseFloat($("#evap_rate").jqxNumberInput('decimal')), + boil_time = parseFloat($("#boil_time").jqxNumberInput('decimal')), + top_up = parseFloat($("#top_up_kettle").jqxNumberInput('decimal')), + batch; if (calc) { // If checked, calculate the batch size. - var batch = boil_size - (evap_rate * boil_time / 60) + top_up; + batch = boil_size - (evap_rate * boil_time / 60) + top_up; $("#batch_size").val(batch); } } - var url = "includes/db_inventory_equipments.php"; // tooltips $("#name").jqxTooltip({ content: 'The unique name of this brew equipment.' }); $("#notes").jqxTooltip({ content: 'Some notes about the equipment.' }); @@ -82,9 +80,11 @@ $("#hop_utilization").jqxTooltip({ content: '100% for smaller installations, higher for large breweries.' }); $("#batch_size").jqxTooltip({ content: 'Calculated batch size, liters at end of the boil.' }); $("#trub_chiller_loss").jqxTooltip({ content: 'Standard loss in liters during transfer to the fermenter.' }); - + + var dataRecord = {}, + url = 'includes/db_inventory_equipments.php', // prepare the data - var source = { + source = { datatype: "json", cache: false, datafields: [ @@ -126,8 +126,8 @@ data: data, type: "POST", success: function (data, status, xhr) { - // delete command is executed. commit(true); + location.reload( true ); }, error: function (jqXHR, textStatus, errorThrown) { commit(false); @@ -144,6 +144,7 @@ type: "POST", success: function (data, status, xhr) { commit(true); + location.reload( true ); }, error: function(jqXHR, textStatus, errorThrown) { commit(false); @@ -159,8 +160,8 @@ data: data, type: "POST", success: function (data, status, xhr) { - // update command is executed. commit(true); + location.reload( true ); }, error: function(jqXHR, textStatus, errorThrown) { commit(false); @@ -183,7 +184,6 @@ source: MaterialAdapter, valueMember: 'id', displayMember: 'nl', -// selectedIndex: 0, width: 180, height: 23, autoDropDownHeight: true @@ -223,8 +223,8 @@ theme: theme, showstatusbar: true, renderstatusbar: function (statusbar) { - var container = $("
"); - var addButton = $("
Nieuw
"); + var addButton, container = $("
"); + addButton = $("
Nieuw
"); container.append(addButton); statusbar.append(container); addButton.jqxButton({ theme: theme, width: 90, height: 20 }); @@ -344,11 +344,11 @@ $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); // update the edited row when the user clicks the 'Save' button. $("#Save").click(function () { - var rowID = -1; + var row, rowID = -1; if (editrow >= 0) { - var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); + rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); } - var row = { + row = { record: rowID, name: $("#name").val(), boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')), @@ -381,7 +381,6 @@ $('#jqxgrid').jqxGrid('addrow', null, row); } $("#popupWindow").jqxWindow('hide'); - location.reload( true ); // reload ourself. }); createDelElements(); });