www/js/profile_water.js

Sat, 13 Jun 2020 12:14:26 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 13 Jun 2020 12:14:26 +0200
changeset 701
3ce3df681be0
parent 662
4bb005694ce7
child 702
f0896a6f9b64
permissions
-rw-r--r--

Changed inventory and profile databases filtering.

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 *
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
22
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 },
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
80 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
81 });
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 addrow: function(rowid, rowdata, position, commit) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
84 var data = 'insert=true&' + $.param(rowdata);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
85 $.ajax({
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
86 dataType: 'json',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
87 url: url,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
88 cache: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
89 data: data,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
90 type: 'POST',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
91 success: function(data, status, xhr) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
92 commit(true);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
93 location.reload(true);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
94 },
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
95 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
522
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 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
98 updaterow: function(rowid, rowdata, commit) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
99 var data = 'update=true&' + $.param(rowdata);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
100 $.ajax({
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
101 dataType: 'json',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
102 url: url,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
103 cache: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
104 data: data,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
105 type: 'POST',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
106 success: function(data, status, xhr) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
107 commit(true);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
108 location.reload(true);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
109 },
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
110 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
111 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
112 }
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 dataAdapter = new $.jqx.dataAdapter(source),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
115 editrow = -1;
494
af28ebe4a779 Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents: 485
diff changeset
116
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
117 // tooltips
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
118 $('#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
119 $('#notes').jqxTooltip({ content: 'Extra opmerkingen over dit water.' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
120 $('#calcium').jqxTooltip({ content: 'Calcium (Ca).' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
121 $('#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
122 $('#sulfate').jqxTooltip({ content: 'Calcium Sulfaat (CaSO4).' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
123 $('#chloride').jqxTooltip({ content: 'Chloride (Cl).' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
124 $('#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
125 $('#magnesium').jqxTooltip({ content: 'Magnesium (Mg).' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
126 $('#ph').jqxTooltip({ content: 'De zuurgraad (pH).' });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
127 $('#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
128 $('#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
129
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
130 // initialize the input fields.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
131 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
132 $('#notes').jqxInput({ theme: theme, width: 800, height: 100 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
133 $('#calcium').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
134 $('#bicarbonate').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
135 $('#sulfate').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
136 $('#chloride').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
137 $('#sodium').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
138 $('#magnesium').jqxNumberInput(Spin1dec);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
139 $('#ph').jqxNumberInput(Spin2pH);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
140 $('#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
141 $('#balance').jqxNumberInput(Show2dec);
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
143 // initialize jqxGrid
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
144 $('#jqxgrid').jqxGrid({
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
145 width: 1280,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
146 height: 630,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
147 source: dataAdapter,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
148 theme: theme,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
149 showstatusbar: true,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
150 renderstatusbar: function(statusbar) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
151 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
152 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
153 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Nieuw</span></div>');
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
154 container.append(addButton);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
155 statusbar.append(container);
701
3ce3df681be0 Changed inventory and profile databases filtering.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
156 addButton.jqxButton({ theme: theme, width: 90, height: 17 });
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
157 // add new row.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
158 addButton.click(function(event) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
159 editrow = -1;
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
160 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
161 $('#name').val('');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
162 $('#calcium').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
163 $('#bicarbonate').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
164 $('#sulfate').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
165 $('#chloride').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
166 $('#sodium').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
167 $('#magnesium').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
168 $('#ph').val(7);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
169 $('#notes').val('');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
170 $('#total_alkalinity').val(0);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
171 $('#popupWindow').jqxWindow('open');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
172 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
173 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
174 filterable: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
175 filtermode: 'excel',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
176 columns: [
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
177 { text: 'Water Profiel', datafield: 'name', width: 225 },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
178 { text: 'Opmerkingen', datafield: 'notes' },
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
179 { 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
180 { 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
181 { 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
182 { 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
183 { 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
184 { 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
185 { 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
186 { text: '', datafield: 'Edit', width: 100, columntype: 'button',
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
187 cellsrenderer: function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
188 return 'Wijzig';
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
189 }, buttonclick: function(row) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
190 // 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
191 editrow = row;
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
192 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
193 // 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
194 dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
195 $('#name').val(dataRecord.name);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
196 $('#calcium').val(dataRecord.calcium);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
197 $('#bicarbonate').val(dataRecord.bicarbonate);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
198 $('#sulfate').val(dataRecord.sulfate);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
199 $('#chloride').val(dataRecord.chloride);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
200 $('#sodium').val(dataRecord.sodium);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
201 $('#magnesium').val(dataRecord.magnesium);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
202 $('#ph').val(dataRecord.ph);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
203 $('#notes').val(dataRecord.notes);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
204 $('#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
205 calcBalance();
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
206 // show the popup window.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
207 $('#popupWindow').jqxWindow('open');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
208 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
209 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
210 ]
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
211 });
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
212
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
213 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
214 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
215 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
216 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
217 $('#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
218 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
219 $('#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
220 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
221 $('#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
222 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
223 $('#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
224 }
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
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 $('#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
227 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
228 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
229 });
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 $('#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
231 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
232 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
233 });
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 $('#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
235 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
236 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
237 });
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
238 $('#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
239 dataRecord.total_alkalinity = parseFloat(event.args.value);
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
240 dataRecord.bicarbonate = parseFloat(event.args.value) * 1.22;
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
241 $('#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
242 calcBalance();
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
243 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
244 $('#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
245 dataRecord.bicarbonate = parseFloat(event.args.value);
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
246 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
247 $('#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
248 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
249 });
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
250 $('#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
251 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
252 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
253 });
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 $('#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
255 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
256 calcBalance();
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
257 });
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
258
522
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
259 // initialize the popup window and buttons.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
260 $('#popupWindow').jqxWindow({
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
261 width: 1050,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
262 height: 550,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
263 resizable: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
264 theme: theme,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
265 isModal: true,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
266 autoOpen: false,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
267 cancelButton: $('#Cancel'),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
268 modalOpacity: 0.40
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
269 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
270 $('#popupWindow').on('open', function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
271 $('#name').jqxInput('selectAll');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
272 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
273 $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
274 $('#Delete').click(function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
275 if (editrow >= 0) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
276 // Open a popup to confirm this action.
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
277 $('#eventWindow').jqxWindow('open');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
278 $('#delOk').click(function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
279 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
280 $('#jqxgrid').jqxGrid('deleterow', rowID);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
281 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
282 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
283 $('#popupWindow').jqxWindow('hide');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
284 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
285 $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
286 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
287 // 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
288 $('#Save').click(function() {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
289 var row, rowID = -1;
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
290 if (editrow >= 0) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
291 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
292 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
293 row = {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
294 record: rowID,
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
295 name: $('#name').val(),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
296 calcium: parseFloat($('#calcium').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
297 bicarbonate: parseFloat($('#bicarbonate').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
298 sulfate: parseFloat($('#sulfate').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
299 chloride: parseFloat($('#chloride').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
300 sodium: parseFloat($('#sodium').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
301 magnesium: parseFloat($('#magnesium').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
302 ph: parseFloat($('#ph').jqxNumberInput('decimal')),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
303 notes: $('#notes').val(),
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
304 total_alkalinity: parseFloat($('#total_alkalinity').jqxNumberInput('decimal'))
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
305 };
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
306 if (editrow >= 0) {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
307 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
308 } else {
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
309 $('#jqxgrid').jqxGrid('addrow', null, row);
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
310 }
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
311 $('#popupWindow').jqxWindow('hide');
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
312 });
35675eadc655 Removed yui-compressor on javascript files.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
313 createDelElements();
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315

mercurial