42 } |
42 } |
43 |
43 |
44 |
44 |
45 $(document).ready(function () { |
45 $(document).ready(function () { |
46 |
46 |
47 var dataRecord = {}; |
|
48 |
|
49 function calcBatchVolume() { |
47 function calcBatchVolume() { |
50 var calc = $("#calc_boil_volume").val(); |
48 var calc = $("#calc_boil_volume").val(), |
51 var boil_size = parseFloat($("#boil_size").jqxNumberInput('decimal')); |
49 boil_size = parseFloat($("#boil_size").jqxNumberInput('decimal')), |
52 var evap_rate = parseFloat($("#evap_rate").jqxNumberInput('decimal')); |
50 evap_rate = parseFloat($("#evap_rate").jqxNumberInput('decimal')), |
53 var boil_time = parseFloat($("#boil_time").jqxNumberInput('decimal')); |
51 boil_time = parseFloat($("#boil_time").jqxNumberInput('decimal')), |
54 var top_up = parseFloat($("#top_up_kettle").jqxNumberInput('decimal')); |
52 top_up = parseFloat($("#top_up_kettle").jqxNumberInput('decimal')), |
|
53 batch; |
55 |
54 |
56 if (calc) { // If checked, calculate the batch size. |
55 if (calc) { // If checked, calculate the batch size. |
57 var batch = boil_size - (evap_rate * boil_time / 60) + top_up; |
56 batch = boil_size - (evap_rate * boil_time / 60) + top_up; |
58 $("#batch_size").val(batch); |
57 $("#batch_size").val(batch); |
59 } |
58 } |
60 } |
59 } |
61 |
60 |
62 var url = "includes/db_inventory_equipments.php"; |
|
63 // tooltips |
61 // tooltips |
64 $("#name").jqxTooltip({ content: 'The unique name of this brew equipment.' }); |
62 $("#name").jqxTooltip({ content: 'The unique name of this brew equipment.' }); |
65 $("#notes").jqxTooltip({ content: 'Some notes about the equipment.' }); |
63 $("#notes").jqxTooltip({ content: 'Some notes about the equipment.' }); |
66 $("#tun_volume").jqxTooltip({ content: 'Mash TUN volume.' }); |
64 $("#tun_volume").jqxTooltip({ content: 'Mash TUN volume.' }); |
67 $("#tun_height").jqxTooltip({ content: 'Mash TUN height in cm.' }); |
65 $("#tun_height").jqxTooltip({ content: 'Mash TUN height in cm.' }); |
80 $("#boil_time").jqxTooltip({ content: 'Normal boil time in minutes.' }); |
78 $("#boil_time").jqxTooltip({ content: 'Normal boil time in minutes.' }); |
81 $("#top_up_kettle").jqxTooltip({ content: 'Extra water added to the boil.' }); |
79 $("#top_up_kettle").jqxTooltip({ content: 'Extra water added to the boil.' }); |
82 $("#hop_utilization").jqxTooltip({ content: '100% for smaller installations, higher for large breweries.' }); |
80 $("#hop_utilization").jqxTooltip({ content: '100% for smaller installations, higher for large breweries.' }); |
83 $("#batch_size").jqxTooltip({ content: 'Calculated batch size, liters at end of the boil.' }); |
81 $("#batch_size").jqxTooltip({ content: 'Calculated batch size, liters at end of the boil.' }); |
84 $("#trub_chiller_loss").jqxTooltip({ content: 'Standard loss in liters during transfer to the fermenter.' }); |
82 $("#trub_chiller_loss").jqxTooltip({ content: 'Standard loss in liters during transfer to the fermenter.' }); |
85 |
83 |
|
84 var dataRecord = {}, |
|
85 url = 'includes/db_inventory_equipments.php', |
86 // prepare the data |
86 // prepare the data |
87 var source = { |
87 source = { |
88 datatype: "json", |
88 datatype: "json", |
89 cache: false, |
89 cache: false, |
90 datafields: [ |
90 datafields: [ |
91 { name: 'record', type: 'number' }, |
91 { name: 'record', type: 'number' }, |
92 { name: 'name', type: 'string' }, |
92 { name: 'name', type: 'string' }, |
221 height: 630, |
221 height: 630, |
222 source: dataAdapter, |
222 source: dataAdapter, |
223 theme: theme, |
223 theme: theme, |
224 showstatusbar: true, |
224 showstatusbar: true, |
225 renderstatusbar: function (statusbar) { |
225 renderstatusbar: function (statusbar) { |
226 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
226 var addButton, container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
227 var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>"); |
227 addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>"); |
228 container.append(addButton); |
228 container.append(addButton); |
229 statusbar.append(container); |
229 statusbar.append(container); |
230 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
230 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
231 // add new row. |
231 // add new row. |
232 addButton.click(function (event) { |
232 addButton.click(function (event) { |
342 }); |
342 }); |
343 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); |
343 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); |
344 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
344 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
345 // update the edited row when the user clicks the 'Save' button. |
345 // update the edited row when the user clicks the 'Save' button. |
346 $("#Save").click(function () { |
346 $("#Save").click(function () { |
347 var rowID = -1; |
347 var row, rowID = -1; |
348 if (editrow >= 0) { |
348 if (editrow >= 0) { |
349 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
349 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
350 } |
350 } |
351 var row = { |
351 row = { |
352 record: rowID, |
352 record: rowID, |
353 name: $("#name").val(), |
353 name: $("#name").val(), |
354 boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')), |
354 boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')), |
355 batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), |
355 batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), |
356 tun_volume: parseFloat($("#tun_volume").jqxNumberInput('decimal')), |
356 tun_volume: parseFloat($("#tun_volume").jqxNumberInput('decimal')), |
379 $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
379 $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
380 } else { |
380 } else { |
381 $('#jqxgrid').jqxGrid('addrow', null, row); |
381 $('#jqxgrid').jqxGrid('addrow', null, row); |
382 } |
382 } |
383 $("#popupWindow").jqxWindow('hide'); |
383 $("#popupWindow").jqxWindow('hide'); |
384 location.reload( true ); // reload ourself. |
|
385 }); |
384 }); |
386 createDelElements(); |
385 createDelElements(); |
387 }); |
386 }); |
388 |
387 |