www/js/inv_waters.js

Sat, 05 Mar 2022 16:54:29 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 05 Mar 2022 16:54:29 +0100
changeset 787
9f8ede1b2090
parent 785
aa79acfdf8a9
permissions
-rw-r--r--

Fixed missing first record during fermentables XML export.

21
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
785
aa79acfdf8a9 Added uuid field in inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts. Added uuid field in profiles mash, styles and water.
Michiel Broek <mbroek@mbse.eu>
parents: 767
diff changeset
2 * Copyright (C) 2014-2022
21
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
6 * This file is part of Brewery Management System
21
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 function createDelElements() {
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
25 $('#eventWindow').jqxWindow({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
26 theme: theme,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
27 position: { x: 490, y: 210 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
28 width: 300,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
29 height: 175,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
30 resizable: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
31 isModal: true,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
32 modalOpacity: 0.4,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
33 okButton: $('#delOk'),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
34 cancelButton: $('#delCancel'),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
35 initContent: function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
36 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
37 $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
38 $('#delCancel').focus();
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
39 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
40 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
41 $('#eventWindow').jqxWindow('hide');
21
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 }
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
45 $(document).ready(function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
46
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
47 // tooltips
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
48 $('#name').jqxTooltip({ content: 'De unieke naam van dit brouwwater.' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
49 $('#notes').jqxTooltip({ content: 'Extra opmerkingen over dit water.' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
50 $('#unlimited_stock').jqxTooltip({ content: 'Onbeperkte voorraad zoals kraanwater en bronnen.' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
51 $('#calcium').jqxTooltip({ content: 'Calcium (Ca).' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
52 $('#bicarbonate').jqxTooltip({ content: 'Bicarbonaat (HCO3). Berekend meteen de Totale alkaliteit.' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
53 $('#sulfate').jqxTooltip({ content: 'Calcium Sulfaat (CaSO4).' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
54 $('#chloride').jqxTooltip({ content: 'Chloride (Cl).' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
55 $('#sodium').jqxTooltip({ content: 'Natrium, oftewel keukenzout (Na). In berekeningen ook vaak als Sodium.' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
56 $('#magnesium').jqxTooltip({ content: 'Magnesium (Mg).' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
57 $('#ph').jqxTooltip({ content: 'De zuurgraad (pH).' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
58 $('#total_alkalinity').jqxTooltip({ content: 'Totale alkaliniteit. Berekend meteen de Bicarbonaat.' });
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
59 $('#balance').jqxTooltip({ content: 'De ionen balans van het water. Ideaal minder dan 0.1 verschil tussen kationen en anionen. Meer dan 0.5 is een fout in het waterraport.' });
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
60 $('#inventory').jqxTooltip({ content: 'Voorraad in liters.' });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
61 $('#cost').jqxTooltip({ content: 'Kostprijs per liter. 5 cijfers achter de comma zodat het kraanwater er ook in kan.' });
205
08488ac3bbb1 Inventory waters: use POST instead of GET. Redesigned web editor page. Total Alkalinity and Bicarbonate update eachother with calculated values.
Michiel Broek <mbroek@mbse.eu>
parents: 99
diff changeset
62
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
63 var dataRecord = {},
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
64 url = 'includes/db_inventory_water.php',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
65 // prepare the data
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
66 source = {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
67 datatype: 'json',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
68 cache: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
69 datafields: [
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
70 { name: 'record', type: 'number' },
785
aa79acfdf8a9 Added uuid field in inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts. Added uuid field in profiles mash, styles and water.
Michiel Broek <mbroek@mbse.eu>
parents: 767
diff changeset
71 { name: 'uuid', type: 'string' },
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
72 { name: 'name', type: 'string' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
73 { name: 'unlimited_stock', type: 'int' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
74 { name: 'calcium', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
75 { name: 'bicarbonate', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
76 { name: 'sulfate', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
77 { name: 'chloride', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
78 { name: 'sodium', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
79 { name: 'magnesium', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
80 { name: 'ph', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
81 { name: 'notes', type: 'string' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
82 { name: 'total_alkalinity', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
83 { name: 'inventory', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
84 { name: 'cost', type: 'float' }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
85 ],
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
86 id: 'record',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
87 url: url,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
88 deleterow: function(rowid, commit) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
89 // synchronize with the server - send delete command
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
90 var data = 'delete=true&' + $.param({ record: rowid });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
91 $.ajax({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
92 dataType: 'json',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
93 url: url,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
94 cache: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
95 data: data,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
96 type: 'POST',
767
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
97 success: function(data) {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
98 if (data.error) {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
99 console.log('delete: ' + data.msg);
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
100 alert('Fout: ' + data.msg);
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
101 } else {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
102 console.log('delete: success');
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
103 }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
104 location.reload(true);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
105 },
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
106 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
107 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
108 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
109 addrow: function(rowid, rowdata, position, commit) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
110 var data = 'insert=true&' + $.param(rowdata);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
111 $.ajax({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
112 dataType: 'json',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
113 url: url,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
114 cache: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
115 data: data,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
116 type: 'POST',
767
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
117 success: function(data) {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
118 if (data.error) {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
119 console.log('insert: ' + data.msg);
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
120 alert('Fout: ' + data.msg);
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
121 } else {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
122 console.log('insert: success');
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
123 }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
124 location.reload(true);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
125 },
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
126 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
127 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
128 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
129 updaterow: function(rowid, rowdata, commit) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
130 var data = 'update=true&' + $.param(rowdata);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
131 $.ajax({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
132 dataType: 'json',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
133 url: url,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
134 cache: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
135 data: data,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
136 type: 'POST',
767
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
137 success: function(data) {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
138 if (data.error) {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
139 console.log('updaterow: ' + data.msg);
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
140 alert('Fout: ' + data.msg);
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
141 } else {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
142 console.log('updaterow: success');
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
143 }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
144 location.reload(true);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
145 },
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
146 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
147 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
148 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
149 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
150 dataAdapter = new $.jqx.dataAdapter(source),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
151 editrow = -1;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
152
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
153 // initialize the input fields.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
154 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
155 $('#notes').jqxInput({ theme: theme, width: 640, height: 100 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
156 $('#unlimited_stock').jqxCheckBox({ theme: theme, width: 120, height: 23 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
157 $('#calcium').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
158 $('#bicarbonate').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
159 $('#sulfate').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
160 $('#chloride').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
161 $('#sodium').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
162 $('#magnesium').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
163 $('#ph').jqxNumberInput(Spin2pH);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
164 $('#total_alkalinity').jqxNumberInput(Spin1dec);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
165 $('#balance').jqxNumberInput(Show2dec);
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
166 $('#inventory').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
167 $('#cost').jqxNumberInput({inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 5, spinButtons: true });
488
77f1617b6994 Fixed inventory databases race conditions
Michiel Broek <mbroek@mbse.eu>
parents: 287
diff changeset
168
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
169 // initialize jqxGrid
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
170 $('#jqxgrid').jqxGrid({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
171 width: 1280,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
172 height: 630,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
173 source: dataAdapter,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
174 theme: theme,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
175 showstatusbar: true,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
176 renderstatusbar: function(statusbar) {
702
f0896a6f9b64 Add total count in the statusbar for inventory and profile databases.
Michiel Broek <mbroek@mbse.eu>
parents: 701
diff changeset
177 var rowCount = $("#jqxgrid").jqxGrid('getrows').length;
f0896a6f9b64 Add total count in the statusbar for inventory and profile databases.
Michiel Broek <mbroek@mbse.eu>
parents: 701
diff changeset
178 statusbar.append('<div style="float: left; margin: 8px; color: orange !important;">Aantal items: ' + rowCount + '</div>');
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
179 var addButton, container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
180 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' +
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
181 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Nieuw</span></div>');
563
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents: 528
diff changeset
182 expButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' +
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
183 'src="images/database.png"/><span style="margin-left: 4px; position: relative; top: -10px;">Export</span></div>');
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
184 container.append(addButton);
563
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents: 528
diff changeset
185 container.append(expButton);
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
186 statusbar.append(container);
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
187 addButton.jqxButton({ theme: theme, width: 90, height: 17 });
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
188 expButton.jqxButton({ theme: theme, width: 90, height: 17 });
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
189 // add new row.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
190 addButton.click(function(event) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
191 editrow = -1;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
192 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
193 $('#name').val('Nieuw brouwwater');
785
aa79acfdf8a9 Added uuid field in inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts. Added uuid field in profiles mash, styles and water.
Michiel Broek <mbroek@mbse.eu>
parents: 767
diff changeset
194 dataRecord.uuid = '';
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
195 $('#unlimited_stock').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
196 $('#calcium').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
197 $('#bicarbonate').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
198 $('#sulfate').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
199 $('#chloride').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
200 $('#sodium').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
201 $('#magnesium').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
202 $('#ph').val(7);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
203 $('#notes').val('');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
204 $('#total_alkalinity').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
205 $('#inventory').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
206 $('#cost').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
207 $('#popupWindow').jqxWindow('open');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
208 });
563
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents: 528
diff changeset
209 expButton.click(function(event) {
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents: 528
diff changeset
210 window.open('export_waters.php');
acdd54144838 Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.
Michiel Broek <mbroek@mbse.eu>
parents: 528
diff changeset
211 });
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
212 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
213 filterable: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
214 columns: [
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
215 { text: 'Water leverancier', datafield: 'name', width: 225 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
216 { text: 'Opmerkingen', datafield: 'notes' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
217 { text: 'Onbeperkt', datafield: 'unlimited_stock', columntype: 'checkbox', width: 80 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
218 { text: 'Voorraad', datafield: 'inventory', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
219 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
220 var amount = '';
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
221 if (value > 0 && rowdata.unlimited_stock == 0)
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
222 amount = dataAdapter.formatNumber(value, 'f1') + ' L';
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
223 return '<span style="margin: 3px; margin-top: 6px; float: right;">' + amount + '</span>';
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
224 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
225 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
226 { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
227 cellsrenderer: function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
228 return 'Wijzig';
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
229 }, buttonclick: function(row) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
230 // open the popup window when the user clicks a button.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
231 editrow = row;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
232 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
233 // get the clicked row's data and initialize the input fields.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
234 dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
235 $('#name').val(dataRecord.name);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
236 $('#unlimited_stock').val(dataRecord.unlimited_stock);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
237 $('#calcium').val(dataRecord.calcium);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
238 $('#bicarbonate').val(dataRecord.bicarbonate);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
239 $('#sulfate').val(dataRecord.sulfate);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
240 $('#chloride').val(dataRecord.chloride);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
241 $('#sodium').val(dataRecord.sodium);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
242 $('#magnesium').val(dataRecord.magnesium);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
243 $('#ph').val(dataRecord.ph);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
244 $('#notes').val(dataRecord.notes);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
245 $('#total_alkalinity').val(dataRecord.total_alkalinity);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
246 $('#inventory').val(dataRecord.inventory);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
247 $('#cost').val(dataRecord.cost);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
248 // show the popup window.
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
249 calcBalance();
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
250 $('#popupWindow').jqxWindow('open');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
251 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
252 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
253 ]
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
254 });
205
08488ac3bbb1 Inventory waters: use POST instead of GET. Redesigned web editor page. Total Alkalinity and Bicarbonate update eachother with calculated values.
Michiel Broek <mbroek@mbse.eu>
parents: 99
diff changeset
255
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
256 function calcBalance() {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
257 var cations = (dataRecord.calcium / 20.039) + (dataRecord.magnesium / 12.1525) + (dataRecord.sodium / 22.989);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
258 var anions = (dataRecord.bicarbonate / 61.016) + (dataRecord.sulfate / 48.031) + (dataRecord.chloride / 35.4527);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
259 var balance = Round(cations - anions, 2);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
260 $('#balance').val(balance);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
261 if (balance <= 0.1 && balance >= -0.1)
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
262 $('#wr_balance').html("<img src='images/dialog-ok-apply.png'>");
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
263 else if (balance <= 0.5 && balance >= -0.5)
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
264 $('#wr_balance').html("<img src='images/dialog-ok.png'>");
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
265 else
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
266 $('#wr_balance').html("<img src='images/dialog-error.png'>");
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
267 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
268
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
269 $('#calcium').on('change', function(event) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
270 dataRecord.calcium = parseFloat(event.args.value);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
271 calcBalance();
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
272 });
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
273 $('#magnesium').on('change', function(event) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
274 dataRecord.magnesium = parseFloat(event.args.value);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
275 calcBalance();
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
276 });
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
277 $('#sodium').on('change', function(event) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
278 dataRecord.sodium = parseFloat(event.args.value);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
279 calcBalance();
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
280 });
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
281 $('#total_alkalinity').on('change', function(event) {
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
282 dataRecord.total_alkalinity = parseFloat(event.args.value);
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
283 dataRecord.bicarbonate = parseFloat(event.args.value) * 1.22;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
284 $('#bicarbonate').val(dataRecord.bicarbonate);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
285 calcBalance();
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
286 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
287 $('#bicarbonate').on('change', function(event) {
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
288 dataRecord.bicarbonate = parseFloat(event.args.value);
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
289 dataRecord.total_alkalinity = parseFloat(event.args.value) * 50 / 61;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
290 $('#total_alkalinity').val(dataRecord.total_alkalinity);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
291 calcBalance();
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
292 });
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
293 $('#sulfate').on('change', function(event) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
294 dataRecord.sulfate = parseFloat(event.args.value);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
295 calcBalance();
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
296 });
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
297 $('#chloride').on('change', function(event) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
298 dataRecord.chloride = parseFloat(event.args.value);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 563
diff changeset
299 calcBalance();
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
300 });
205
08488ac3bbb1 Inventory waters: use POST instead of GET. Redesigned web editor page. Total Alkalinity and Bicarbonate update eachother with calculated values.
Michiel Broek <mbroek@mbse.eu>
parents: 99
diff changeset
301
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
302 // initialize the popup window and buttons.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
303 $('#popupWindow').jqxWindow({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
304 width: 1050,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
305 height: 550,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
306 resizable: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
307 theme: theme,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
308 isModal: true,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
309 autoOpen: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
310 cancelButton: $('#Cancel'),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
311 modalOpacity: 0.40
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
312 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
313 $('#popupWindow').on('open', function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
314 $('#name').jqxInput('selectAll');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
315 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
316 $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
317 $('#Delete').click(function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
318 if (editrow >= 0) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
319 // Open a popup to confirm this action.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
320 $('#eventWindow').jqxWindow('open');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
321 $('#delOk').click(function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
322 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
323 $('#jqxgrid').jqxGrid('deleterow', rowID);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
324 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
325 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
326 $('#popupWindow').jqxWindow('hide');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
327 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
328 $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
329 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
330 // update the edited row when the user clicks the 'Save' button.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
331 $('#Save').click(function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
332 var row, rowID = -1;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
333 if (editrow >= 0) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
334 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
335 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
336 row = {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
337 record: rowID,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
338 name: $('#name').val(),
785
aa79acfdf8a9 Added uuid field in inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts. Added uuid field in profiles mash, styles and water.
Michiel Broek <mbroek@mbse.eu>
parents: 767
diff changeset
339 uuid: dataRecord.uuid,
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
340 unlimited_stock: $('#unlimited_stock').val(),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
341 calcium: parseFloat($('#calcium').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
342 bicarbonate: parseFloat($('#bicarbonate').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
343 sulfate: parseFloat($('#sulfate').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
344 chloride: parseFloat($('#chloride').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
345 sodium: parseFloat($('#sodium').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
346 magnesium: parseFloat($('#magnesium').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
347 ph: parseFloat($('#ph').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
348 notes: $('#notes').val(),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
349 total_alkalinity: parseFloat($('#total_alkalinity').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
350 inventory: parseFloat($('#inventory').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
351 cost: parseFloat($('#cost').jqxNumberInput('decimal'))
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
352 };
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
353 if (editrow >= 0) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
354 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
355 } else {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
356 $('#jqxgrid').jqxGrid('addrow', null, row);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
357 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
358 $('#popupWindow').jqxWindow('hide');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
359 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
360 createDelElements();
21
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 });
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362

mercurial