Thu, 14 Feb 2019 16:11:29 +0100
Product print added yeast section.
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 | var dataRecord = {}; |
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 | |
45
95251bedfab4
Moved three inventory tables and screens to profiles
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
49 | var url = "includes/db_profile_water.php"; |
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
|
50 | // 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
|
51 | $("#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
|
52 | $("#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
|
53 | $("#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
|
54 | $("#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
|
55 | $("#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
|
56 | $("#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
|
57 | $("#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
|
58 | $("#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
|
59 | $("#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
|
60 | $("#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
|
61 | |
22 | 62 | // prepare the data |
63 | var source = { | |
64 | datatype: "json", | |
65 | cache: false, | |
66 | datafields: [ | |
67 | { name: 'record', type: 'number' }, | |
68 | { name: 'name', type: 'string' }, | |
69 | { name: 'calcium', type: 'float' }, | |
70 | { name: 'bicarbonate', type: 'float' }, | |
71 | { name: 'sulfate', type: 'float' }, | |
72 | { name: 'chloride', type: 'float' }, | |
73 | { name: 'sodium', type: 'float' }, | |
74 | { name: 'magnesium', type: 'float' }, | |
75 | { name: 'ph', type: 'float' }, | |
76 | { name: 'notes', type: 'string' }, | |
77 | { name: 'total_alkalinity', type: 'float' } | |
78 | ], | |
79 | id: 'record', | |
80 | url: url, | |
81 | deleterow: function (rowid, commit) { | |
82 | // synchronize with the server - send delete command | |
83 | var data = "delete=true&" + $.param({ record: rowid }); | |
84 | $.ajax({ | |
85 | dataType: 'json', | |
86 | url: url, | |
87 | cache: false, | |
88 | 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
|
89 | type: "POST", |
22 | 90 | success: function (data, status, xhr) { |
91 | // delete command is executed. | |
92 | commit(true); | |
93 | }, | |
94 | error: function (jqXHR, textStatus, errorThrown) { | |
95 | commit(false); | |
96 | } | |
97 | }); | |
98 | }, | |
99 | addrow: function (rowid, rowdata, position, commit) { | |
100 | var data = "insert=true&" + $.param(rowdata); | |
101 | $.ajax({ | |
102 | dataType: 'json', | |
103 | url: url, | |
104 | cache: false, | |
105 | 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
|
106 | type: "POST", |
22 | 107 | success: function (data, status, xhr) { |
108 | commit(true); | |
109 | }, | |
110 | error: function(jqXHR, textStatus, errorThrown) { | |
111 | commit(false); | |
112 | } | |
113 | }); | |
114 | }, | |
115 | updaterow: function (rowid, rowdata, commit) { | |
116 | var data = "update=true&" + $.param(rowdata); | |
117 | $.ajax({ | |
118 | dataType: 'json', | |
119 | url: url, | |
120 | cache: false, | |
121 | 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
|
122 | type: "POST", |
22 | 123 | success: function (data, status, xhr) { |
124 | // update command is executed. | |
125 | commit(true); | |
126 | }, | |
127 | error: function(jqXHR, textStatus, errorThrown) { | |
128 | commit(false); | |
129 | } | |
130 | }); | |
131 | } | |
132 | }; | |
133 | // 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
|
134 | $("#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
|
135 | $("#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
|
136 | $("#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
|
137 | $("#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
|
138 | $("#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
|
139 | $("#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
|
140 | $("#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
|
141 | $("#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
|
142 | $("#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
|
143 | $("#total_alkalinity").jqxNumberInput( Spin1dec ); |
22 | 144 | |
145 | var dataAdapter = new $.jqx.dataAdapter(source); | |
146 | var editrow = -1; | |
147 | // initialize jqxGrid | |
148 | $("#jqxgrid").jqxGrid({ | |
149 | width: 1280, | |
150 | height: 630, | |
151 | source: dataAdapter, | |
152 | theme: theme, | |
153 | showstatusbar: true, | |
154 | localization: getLocalization(), | |
155 | renderstatusbar: function (statusbar) { | |
156 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
34 | 157 | var 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 | 158 | container.append(addButton); |
159 | 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
|
160 | addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
22 | 161 | // add new row. |
162 | addButton.click(function (event) { | |
163 | 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
|
164 | $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); |
22 | 165 | $("#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
|
166 | $("#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
|
167 | $("#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
|
168 | $("#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
|
169 | $("#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
|
170 | $("#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
|
171 | $("#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
|
172 | $("#ph").val(7); |
22 | 173 | $("#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
|
174 | $("#total_alkalinity").val(0); |
22 | 175 | $("#popupWindow").jqxWindow('open'); |
176 | }); | |
177 | }, | |
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
|
178 | filterable: false, |
22 | 179 | filtermode: 'excel', |
180 | 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
|
181 | { 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
|
182 | { 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
|
183 | { 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
|
184 | { 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
|
185 | { 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
|
186 | { 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
|
187 | { 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
|
188 | { 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
|
189 | { text: 'pH', datafield: 'ph', 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
|
190 | { text: 'Wijzig', datafield: 'Edit', width: 100, columntype: 'button', cellsrenderer: function () { |
34 | 191 | return "Wijzig"; |
22 | 192 | }, buttonclick: function (row) { |
193 | // open the popup window when the user clicks a button. | |
194 | 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
|
195 | $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); |
22 | 196 | // get the clicked row's data and initialize the input fields. |
197 | var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); | |
198 | $("#name").val(dataRecord.name); | |
199 | $("#calcium").val(dataRecord.calcium); | |
200 | $("#bicarbonate").val(dataRecord.bicarbonate); | |
201 | $("#sulfate").val(dataRecord.sulfate); | |
202 | $("#chloride").val(dataRecord.chloride); | |
203 | $("#sodium").val(dataRecord.sodium); | |
204 | $("#magnesium").val(dataRecord.magnesium); | |
205 | $("#ph").val(dataRecord.ph); | |
206 | $("#notes").val(dataRecord.notes); | |
207 | $("#total_alkalinity").val(dataRecord.total_alkalinity); | |
208 | // show the popup window. | |
209 | $("#popupWindow").jqxWindow('open'); | |
210 | } | |
211 | } | |
212 | ] | |
213 | }); | |
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
|
214 | |
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 | $("#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
|
216 | 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
|
217 | $("#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
|
218 | }); |
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 | $("#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
|
220 | 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
|
221 | $("#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
|
222 | }); |
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
|
223 | |
22 | 224 | // initialize the popup window and buttons. |
225 | $("#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
|
226 | 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
|
227 | 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
|
228 | 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
|
229 | 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
|
230 | 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
|
231 | 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
|
232 | 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
|
233 | modalOpacity: 0.40 |
22 | 234 | }); |
235 | $("#popupWindow").on('open', function () { | |
236 | $("#name").jqxInput('selectAll'); | |
237 | }); | |
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
|
238 | $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); |
22 | 239 | $("#Delete").click(function () { |
240 | if (editrow >= 0) { | |
241 | // Open a popup to confirm this action. | |
242 | $('#eventWindow').jqxWindow('open'); | |
243 | $("#delOk").click(function () { | |
244 | var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); | |
245 | $("#jqxgrid").jqxGrid('deleterow', rowID); | |
246 | }); | |
247 | } | |
248 | $("#popupWindow").jqxWindow('hide'); | |
249 | }); | |
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
|
250 | $("#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
|
251 | $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
22 | 252 | // update the edited row when the user clicks the 'Save' button. |
253 | $("#Save").click(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
|
254 | var rowID = -1; |
22 | 255 | 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
|
256 | 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
|
257 | } |
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 | var row = { |
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 | 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
|
260 | 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
|
261 | 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
|
262 | 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
|
263 | 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
|
264 | 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
|
265 | 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
|
266 | 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
|
267 | 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
|
268 | 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
|
269 | 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
|
270 | }; |
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
|
271 | if (editrow >= 0) { |
22 | 272 | $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
273 | } 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
|
274 | $('#jqxgrid').jqxGrid('addrow', null, row); |
22 | 275 | } |
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
|
276 | $("#popupWindow").jqxWindow('hide'); |
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
|
277 | location.reload( true ); // reload ourself. |
22 | 278 | }); |
279 | createDelElements(); | |
280 | }); | |
281 |