www/js/profile_water.js

Sat, 23 May 2020 20:53:48 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 23 May 2020 20:53:48 +0200
changeset 691
9c21125f584e
parent 662
4bb005694ce7
child 701
3ce3df681be0
permissions
-rw-r--r--

Added clone command to the equipment inventory.

22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
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: 522
diff changeset
2 * Copyright (C) 2014-2020
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BrewCloud
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 function createDelElements() {
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
25 $('#eventWindow').jqxWindow({
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
26 theme: theme,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
27 position: { x: 490, y: 210 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
28 width: 300,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
29 height: 175,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
30 resizable: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
31 isModal: true,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
32 modalOpacity: 0.4,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
33 okButton: $('#delOk'),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
34 cancelButton: $('#delCancel'),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
35 initContent: function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
36 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
37 $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
38 $('#delCancel').focus();
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
39 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
40 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
41 $('#eventWindow').jqxWindow('hide');
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
45 $(document).ready(function() {
211
63d0e40c58b9 Water profile uses POST instead of GET. Added tooltips to the editor screen. Updated the editor screen. Total alkalinity and Bicarbonate update each other. More and smaller columns in the listing screen. Rearranged the editor screen.
Michiel Broek <mbroek@mbse.eu>
parents: 45
diff changeset
46
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
47 var dataRecord = {},
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
48 url = 'includes/db_profile_water.php',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
49 source = {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
50 datatype: 'json',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
51 cache: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
52 datafields: [
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
53 { name: 'record', type: 'number' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
54 { name: 'name', type: 'string' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
55 { name: 'calcium', type: 'float' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
56 { name: 'bicarbonate', type: 'float' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
57 { name: 'sulfate', type: 'float' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
58 { name: 'chloride', type: 'float' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
59 { name: 'sodium', type: 'float' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
60 { name: 'magnesium', type: 'float' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
61 { name: 'ph', type: 'float' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
62 { name: 'notes', type: 'string' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
63 { name: 'total_alkalinity', type: 'float' }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
64 ],
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
65 id: 'record',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
66 url: url,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
67 deleterow: function(rowid, commit) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
68 // synchronize with the server - send delete command
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
69 var data = 'delete=true&' + $.param({ record: rowid });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
70 $.ajax({
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
71 dataType: 'json',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
72 url: url,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
73 cache: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
74 data: data,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
75 type: 'POST',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
76 success: function(data, status, xhr) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
77 commit(true);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
78 location.reload(true);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
79 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
80 error: function(jqXHR, textStatus, errorThrown) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
81 commit(false);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
82 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
83 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
84 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
85 addrow: function(rowid, rowdata, position, commit) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
86 var data = 'insert=true&' + $.param(rowdata);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
87 $.ajax({
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
88 dataType: 'json',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
89 url: url,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
90 cache: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
91 data: data,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
92 type: 'POST',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
93 success: function(data, status, xhr) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
94 commit(true);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
95 location.reload(true);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
96 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
97 error: function(jqXHR, textStatus, errorThrown) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
98 commit(false);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
99 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
100 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
101 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
102 updaterow: function(rowid, rowdata, commit) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
103 var data = 'update=true&' + $.param(rowdata);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
104 $.ajax({
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
105 dataType: 'json',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
106 url: url,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
107 cache: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
108 data: data,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
109 type: 'POST',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
110 success: function(data, status, xhr) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
111 commit(true);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
112 location.reload(true);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
113 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
114 error: function(jqXHR, textStatus, errorThrown) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
115 commit(false);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
116 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
117 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
118 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
119 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
120 dataAdapter = new $.jqx.dataAdapter(source),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
121 editrow = -1;
494
af28ebe4a779 Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents: 485
diff changeset
122
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
123 // tooltips
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
124 $('#name').jqxTooltip({ content: 'De unieke naam van dit water profiel.' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
125 $('#notes').jqxTooltip({ content: 'Extra opmerkingen over dit water.' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
126 $('#calcium').jqxTooltip({ content: 'Calcium (Ca).' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
127 $('#bicarbonate').jqxTooltip({ content: 'Bicarbonaat (HCO3). Berekend meteen de Totale alkaliteit.' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
128 $('#sulfate').jqxTooltip({ content: 'Calcium Sulfaat (CaSO4).' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
129 $('#chloride').jqxTooltip({ content: 'Chloride (Cl).' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
130 $('#sodium').jqxTooltip({ content: 'Natrium, oftewel keukenzout (Na). In berekeningen ook vaak als Sodium.' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
131 $('#magnesium').jqxTooltip({ content: 'Magnesium (Mg).' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
132 $('#ph').jqxTooltip({ content: 'De zuurgraad (pH).' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
133 $('#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: 522
diff changeset
134 $('#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.' });
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
135
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
136 // initialize the input fields.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
137 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
138 $('#notes').jqxInput({ theme: theme, width: 800, height: 100 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
139 $('#calcium').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
140 $('#bicarbonate').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
141 $('#sulfate').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
142 $('#chloride').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
143 $('#sodium').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
144 $('#magnesium').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
145 $('#ph').jqxNumberInput(Spin2pH);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
146 $('#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: 522
diff changeset
147 $('#balance').jqxNumberInput(Show2dec);
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
149 // initialize jqxGrid
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
150 $('#jqxgrid').jqxGrid({
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
151 width: 1280,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
152 height: 630,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
153 source: dataAdapter,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
154 theme: theme,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
155 showstatusbar: true,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
156 renderstatusbar: function(statusbar) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
157 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
158 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' +
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
159 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Nieuw</span></div>');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
160 container.append(addButton);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
161 statusbar.append(container);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
162 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
163 // add new row.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
164 addButton.click(function(event) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
165 editrow = -1;
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
166 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
167 $('#name').val('');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
168 $('#calcium').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
169 $('#bicarbonate').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
170 $('#sulfate').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
171 $('#chloride').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
172 $('#sodium').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
173 $('#magnesium').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
174 $('#ph').val(7);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
175 $('#notes').val('');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
176 $('#total_alkalinity').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
177 $('#popupWindow').jqxWindow('open');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
178 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
179 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
180 filterable: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
181 filtermode: 'excel',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
182 columns: [
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
183 { text: 'Water Profiel', datafield: 'name', width: 225 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
184 { text: 'Opmerkingen', datafield: 'notes' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
185 { text: 'Ca', datafield: 'calcium', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
186 { text: 'Mg', datafield: 'magnesium', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
187 { text: 'Na', datafield: 'sodium', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
188 { text: 'CaCO3', datafield: 'total_alkalinity', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
189 { text: 'Cl', datafield: 'chloride', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
190 { text: 'SO4', datafield: 'sulfate', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
191 { text: 'pH', datafield: 'ph', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
192 { text: '', datafield: 'Edit', width: 100, columntype: 'button',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
193 cellsrenderer: function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
194 return 'Wijzig';
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
195 }, buttonclick: function(row) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
196 // open the popup window when the user clicks a button.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
197 editrow = row;
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
198 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
199 // get the clicked row's data and initialize the input fields.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
200 dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
201 $('#name').val(dataRecord.name);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
202 $('#calcium').val(dataRecord.calcium);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
203 $('#bicarbonate').val(dataRecord.bicarbonate);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
204 $('#sulfate').val(dataRecord.sulfate);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
205 $('#chloride').val(dataRecord.chloride);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
206 $('#sodium').val(dataRecord.sodium);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
207 $('#magnesium').val(dataRecord.magnesium);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
208 $('#ph').val(dataRecord.ph);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
209 $('#notes').val(dataRecord.notes);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
210 $('#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: 522
diff changeset
211 calcBalance();
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
212 // show the popup window.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
213 $('#popupWindow').jqxWindow('open');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
214 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
215 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
216 ]
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
217 });
211
63d0e40c58b9 Water profile uses POST instead of GET. Added tooltips to the editor screen. Updated the editor screen. Total alkalinity and Bicarbonate update each other. More and smaller columns in the listing screen. Rearranged the editor screen.
Michiel Broek <mbroek@mbse.eu>
parents: 45
diff changeset
218
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: 522
diff changeset
219 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: 522
diff changeset
220 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: 522
diff changeset
221 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: 522
diff changeset
222 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: 522
diff changeset
223 $('#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: 522
diff changeset
224 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: 522
diff changeset
225 $('#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: 522
diff changeset
226 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: 522
diff changeset
227 $('#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: 522
diff changeset
228 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: 522
diff changeset
229 $('#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: 522
diff changeset
230 }
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: 522
diff changeset
231
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: 522
diff changeset
232 $('#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: 522
diff changeset
233 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: 522
diff changeset
234 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: 522
diff changeset
235 });
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: 522
diff changeset
236 $('#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: 522
diff changeset
237 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: 522
diff changeset
238 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: 522
diff changeset
239 });
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: 522
diff changeset
240 $('#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: 522
diff changeset
241 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: 522
diff changeset
242 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: 522
diff changeset
243 });
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
244 $('#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: 522
diff changeset
245 dataRecord.total_alkalinity = parseFloat(event.args.value);
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
246 dataRecord.bicarbonate = parseFloat(event.args.value) * 1.22;
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
247 $('#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: 522
diff changeset
248 calcBalance();
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
249 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
250 $('#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: 522
diff changeset
251 dataRecord.bicarbonate = parseFloat(event.args.value);
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
252 dataRecord.total_alkalinity = parseFloat(event.args.value) * 50 / 61;
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
253 $('#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: 522
diff changeset
254 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: 522
diff changeset
255 });
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: 522
diff changeset
256 $('#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: 522
diff changeset
257 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: 522
diff changeset
258 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: 522
diff changeset
259 });
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: 522
diff changeset
260 $('#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: 522
diff changeset
261 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: 522
diff changeset
262 calcBalance();
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
263 });
211
63d0e40c58b9 Water profile uses POST instead of GET. Added tooltips to the editor screen. Updated the editor screen. Total alkalinity and Bicarbonate update each other. More and smaller columns in the listing screen. Rearranged the editor screen.
Michiel Broek <mbroek@mbse.eu>
parents: 45
diff changeset
264
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
265 // initialize the popup window and buttons.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
266 $('#popupWindow').jqxWindow({
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
267 width: 1050,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
268 height: 550,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
269 resizable: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
270 theme: theme,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
271 isModal: true,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
272 autoOpen: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
273 cancelButton: $('#Cancel'),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
274 modalOpacity: 0.40
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
275 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
276 $('#popupWindow').on('open', function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
277 $('#name').jqxInput('selectAll');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
278 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
279 $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
280 $('#Delete').click(function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
281 if (editrow >= 0) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
282 // Open a popup to confirm this action.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
283 $('#eventWindow').jqxWindow('open');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
284 $('#delOk').click(function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
285 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
286 $('#jqxgrid').jqxGrid('deleterow', rowID);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
287 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
288 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
289 $('#popupWindow').jqxWindow('hide');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
290 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
291 $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
292 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
293 // update the edited row when the user clicks the 'Save' button.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
294 $('#Save').click(function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
295 var row, rowID = -1;
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
296 if (editrow >= 0) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
297 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
298 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
299 row = {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
300 record: rowID,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
301 name: $('#name').val(),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
302 calcium: parseFloat($('#calcium').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
303 bicarbonate: parseFloat($('#bicarbonate').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
304 sulfate: parseFloat($('#sulfate').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
305 chloride: parseFloat($('#chloride').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
306 sodium: parseFloat($('#sodium').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
307 magnesium: parseFloat($('#magnesium').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
308 ph: parseFloat($('#ph').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
309 notes: $('#notes').val(),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
310 total_alkalinity: parseFloat($('#total_alkalinity').jqxNumberInput('decimal'))
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
311 };
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
312 if (editrow >= 0) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
313 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
314 } else {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
315 $('#jqxgrid').jqxGrid('addrow', null, row);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
316 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
317 $('#popupWindow').jqxWindow('hide');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
318 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
319 createDelElements();
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321

mercurial