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