www/js/inv_waters.js

Sat, 25 Sep 2021 10:42:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 25 Sep 2021 10:42:54 +0200
changeset 778
e64fd38c469c
parent 767
08c0343b622b
child 785
aa79acfdf8a9
permissions
-rw-r--r--

If during styles import the CATEGORY_NUMBER is empty, insert 0 in the database instead.

21
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
767
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
2 * Copyright (C) 2014-2021
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' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
71 { name: 'name', type: 'string' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
72 { name: 'unlimited_stock', type: 'int' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
73 { name: 'calcium', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
74 { name: 'bicarbonate', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
75 { name: 'sulfate', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
76 { name: 'chloride', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
77 { name: 'sodium', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
78 { name: 'magnesium', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
79 { name: 'ph', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
80 { name: 'notes', type: 'string' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
81 { name: 'total_alkalinity', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
82 { name: 'inventory', type: 'float' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
83 { name: 'cost', type: 'float' }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
84 ],
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
85 id: 'record',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
86 url: url,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
87 deleterow: function(rowid, commit) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
88 // synchronize with the server - send delete command
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
89 var data = 'delete=true&' + $.param({ record: rowid });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
90 $.ajax({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
91 dataType: 'json',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
92 url: url,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
93 cache: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
94 data: data,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
95 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
96 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
97 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
98 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
99 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
100 } else {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
101 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
102 }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
103 location.reload(true);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
104 },
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
105 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
106 });
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 addrow: function(rowid, rowdata, position, commit) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
109 var data = 'insert=true&' + $.param(rowdata);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
110 $.ajax({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
111 dataType: 'json',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
112 url: url,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
113 cache: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
114 data: data,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
115 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
116 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
117 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
118 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
119 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
120 } else {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
121 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
122 }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
123 location.reload(true);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
124 },
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
125 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
126 });
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 updaterow: function(rowid, rowdata, commit) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
129 var data = 'update=true&' + $.param(rowdata);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
130 $.ajax({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
131 dataType: 'json',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
132 url: url,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
133 cache: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
134 data: data,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
135 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
136 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
137 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
138 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
139 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
140 } else {
08c0343b622b Improved error handling for inventory equipments, fermentables, hops, miscs, suppliers, water and yeasts.
Michiel Broek <mbroek@mbse.eu>
parents: 702
diff changeset
141 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
142 }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
143 location.reload(true);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
144 },
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
145 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
146 });
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 dataAdapter = new $.jqx.dataAdapter(source),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
150 editrow = -1;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
151
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
152 // initialize the input fields.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
153 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
154 $('#notes').jqxInput({ theme: theme, width: 640, height: 100 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
155 $('#unlimited_stock').jqxCheckBox({ theme: theme, width: 120, height: 23 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
156 $('#calcium').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
157 $('#bicarbonate').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
158 $('#sulfate').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
159 $('#chloride').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
160 $('#sodium').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
161 $('#magnesium').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
162 $('#ph').jqxNumberInput(Spin2pH);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
163 $('#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
164 $('#balance').jqxNumberInput(Show2dec);
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
165 $('#inventory').jqxNumberInput(Spin1dec);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
166 $('#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
167
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
168 // initialize jqxGrid
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
169 $('#jqxgrid').jqxGrid({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
170 width: 1280,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
171 height: 630,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
172 source: dataAdapter,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
173 theme: theme,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
174 showstatusbar: true,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
175 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
176 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
177 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
178 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
179 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
180 '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
181 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
182 '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
183 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
184 container.append(expButton);
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
185 statusbar.append(container);
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
186 addButton.jqxButton({ theme: theme, width: 90, height: 17 });
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
187 expButton.jqxButton({ theme: theme, width: 90, height: 17 });
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
188 // add new row.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
189 addButton.click(function(event) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
190 editrow = -1;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
191 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
192 $('#name').val('Nieuw brouwwater');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
193 $('#unlimited_stock').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
194 $('#calcium').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
195 $('#bicarbonate').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
196 $('#sulfate').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
197 $('#chloride').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
198 $('#sodium').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
199 $('#magnesium').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
200 $('#ph').val(7);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
201 $('#notes').val('');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
202 $('#total_alkalinity').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
203 $('#inventory').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
204 $('#cost').val(0);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
205 $('#popupWindow').jqxWindow('open');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
206 });
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
207 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
208 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
209 });
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
210 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
211 filterable: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
212 columns: [
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
213 { text: 'Water leverancier', datafield: 'name', width: 225 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
214 { text: 'Opmerkingen', datafield: 'notes' },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
215 { text: 'Onbeperkt', datafield: 'unlimited_stock', columntype: 'checkbox', width: 80 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
216 { 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
217 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
218 var amount = '';
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
219 if (value > 0 && rowdata.unlimited_stock == 0)
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
220 amount = dataAdapter.formatNumber(value, 'f1') + ' L';
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
221 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
222 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
223 },
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
224 { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button',
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
225 cellsrenderer: function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
226 return 'Wijzig';
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
227 }, buttonclick: function(row) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
228 // 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
229 editrow = row;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
230 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
231 // 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
232 dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
233 $('#name').val(dataRecord.name);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
234 $('#unlimited_stock').val(dataRecord.unlimited_stock);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
235 $('#calcium').val(dataRecord.calcium);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
236 $('#bicarbonate').val(dataRecord.bicarbonate);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
237 $('#sulfate').val(dataRecord.sulfate);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
238 $('#chloride').val(dataRecord.chloride);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
239 $('#sodium').val(dataRecord.sodium);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
240 $('#magnesium').val(dataRecord.magnesium);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
241 $('#ph').val(dataRecord.ph);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
242 $('#notes').val(dataRecord.notes);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
243 $('#total_alkalinity').val(dataRecord.total_alkalinity);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
244 $('#inventory').val(dataRecord.inventory);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
245 $('#cost').val(dataRecord.cost);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
246 // 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
247 calcBalance();
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
248 $('#popupWindow').jqxWindow('open');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
249 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
250 }
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 });
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
253
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
254 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
255 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
256 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
257 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
258 $('#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
259 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
260 $('#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
261 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
262 $('#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
263 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
264 $('#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
265 }
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
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 $('#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
268 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
269 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
270 });
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 $('#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
272 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
273 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
274 });
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 $('#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
276 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
277 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
278 });
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
279 $('#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
280 dataRecord.total_alkalinity = parseFloat(event.args.value);
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
281 dataRecord.bicarbonate = parseFloat(event.args.value) * 1.22;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
282 $('#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
283 calcBalance();
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
284 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
285 $('#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
286 dataRecord.bicarbonate = parseFloat(event.args.value);
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
287 dataRecord.total_alkalinity = parseFloat(event.args.value) * 50 / 61;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
288 $('#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
289 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
290 });
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 $('#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
292 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
293 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
294 });
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 $('#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
296 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
297 calcBalance();
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
298 });
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
299
528
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
300 // initialize the popup window and buttons.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
301 $('#popupWindow').jqxWindow({
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
302 width: 1050,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
303 height: 550,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
304 resizable: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
305 theme: theme,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
306 isModal: true,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
307 autoOpen: false,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
308 cancelButton: $('#Cancel'),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
309 modalOpacity: 0.40
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
310 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
311 $('#popupWindow').on('open', function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
312 $('#name').jqxInput('selectAll');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
313 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
314 $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
315 $('#Delete').click(function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
316 if (editrow >= 0) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
317 // Open a popup to confirm this action.
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
318 $('#eventWindow').jqxWindow('open');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
319 $('#delOk').click(function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
320 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
321 $('#jqxgrid').jqxGrid('deleterow', rowID);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
322 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
323 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
324 $('#popupWindow').jqxWindow('hide');
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 $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
327 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
328 // 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
329 $('#Save').click(function() {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
330 var row, rowID = -1;
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
331 if (editrow >= 0) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
332 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
333 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
334 row = {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
335 record: rowID,
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
336 name: $('#name').val(),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
337 unlimited_stock: $('#unlimited_stock').val(),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
338 calcium: parseFloat($('#calcium').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
339 bicarbonate: parseFloat($('#bicarbonate').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
340 sulfate: parseFloat($('#sulfate').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
341 chloride: parseFloat($('#chloride').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
342 sodium: parseFloat($('#sodium').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
343 magnesium: parseFloat($('#magnesium').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
344 ph: parseFloat($('#ph').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
345 notes: $('#notes').val(),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
346 total_alkalinity: parseFloat($('#total_alkalinity').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
347 inventory: parseFloat($('#inventory').jqxNumberInput('decimal')),
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
348 cost: parseFloat($('#cost').jqxNumberInput('decimal'))
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
349 };
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
350 if (editrow >= 0) {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
351 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
352 } else {
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
353 $('#jqxgrid').jqxGrid('addrow', null, row);
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
354 }
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
355 $('#popupWindow').jqxWindow('hide');
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
356 });
202272a28052 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
357 createDelElements();
21
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 });
acb2d8098f19 Added inventory miscs and water sources.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359

mercurial