www/js/profile_water.js

Sat, 14 Sep 2019 19:04:29 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 14 Sep 2019 19:04:29 +0200
changeset 494
af28ebe4a779
parent 485
3cdfcdd71077
child 522
35675eadc655
permissions
-rw-r--r--

Fixed as much as possible warnings from the yui-compressor.

22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BrewCloud
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 function createDelElements() {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 $('#eventWindow').jqxWindow({
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 theme: theme,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 position: { x: 490, y: 210 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 width: 300,
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 22
diff changeset
29 height: 175,
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 resizable: false,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 isModal: true,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 modalOpacity: 0.4,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 okButton: $('#delOk'),
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 cancelButton: $('#delCancel'),
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 $('#delCancel').focus();
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 $('#eventWindow').jqxWindow('hide');
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
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
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 datatype: "json",
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 cache: false,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 datafields: [
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 { name: 'record', type: 'number' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 { name: 'name', type: 'string' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 { name: 'calcium', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 { name: 'bicarbonate', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 { name: 'sulfate', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 { name: 'chloride', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 { name: 'sodium', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 { name: 'magnesium', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 { name: 'ph', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 { name: 'notes', type: 'string' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 { name: 'total_alkalinity', type: 'float' }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 ],
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 id: 'record',
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 url: url,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 deleterow: function (rowid, commit) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 // synchronize with the server - send delete command
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 var data = "delete=true&" + $.param({ record: rowid });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 $.ajax({
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 dataType: 'json',
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 url: url,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 cache: false,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 success: function (data, status, xhr) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 commit(true);
485
3cdfcdd71077 Fixed water profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
90 location.reload( true );
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 error: function (jqXHR, textStatus, errorThrown) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 commit(false);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 addrow: function (rowid, rowdata, position, commit) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 var data = "insert=true&" + $.param(rowdata);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 $.ajax({
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 dataType: 'json',
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 url: url,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 cache: false,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 success: function (data, status, xhr) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 commit(true);
485
3cdfcdd71077 Fixed water profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
107 location.reload( true );
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 error: function(jqXHR, textStatus, errorThrown) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 commit(false);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 updaterow: function (rowid, rowdata, commit) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 var data = "update=true&" + $.param(rowdata);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 $.ajax({
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 dataType: 'json',
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 url: url,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 cache: false,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 success: function (data, status, xhr) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 commit(true);
485
3cdfcdd71077 Fixed water profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
124 location.reload( true );
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 error: function(jqXHR, textStatus, errorThrown) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 commit(false);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 // initialize jqxGrid
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 $("#jqxgrid").jqxGrid({
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 width: 1280,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 height: 630,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 source: dataAdapter,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 theme: theme,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 showstatusbar: true,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 container.append(addButton);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 // add new row.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 addButton.click(function (event) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 $("#popupWindow").jqxWindow('open');
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 filtermode: 'excel',
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 22
diff changeset
190 return "Wijzig";
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 }, buttonclick: function (row) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 // open the popup window when the user clicks a button.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 $("#name").val(dataRecord.name);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 $("#calcium").val(dataRecord.calcium);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 $("#bicarbonate").val(dataRecord.bicarbonate);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 $("#sulfate").val(dataRecord.sulfate);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 $("#chloride").val(dataRecord.chloride);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 $("#sodium").val(dataRecord.sodium);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 $("#magnesium").val(dataRecord.magnesium);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 $("#ph").val(dataRecord.ph);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 $("#notes").val(dataRecord.notes);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 $("#total_alkalinity").val(dataRecord.total_alkalinity);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 // show the popup window.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 $("#popupWindow").jqxWindow('open');
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 ]
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 // initialize the popup window and buttons.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 $("#popupWindow").on('open', function () {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 $("#name").jqxInput('selectAll');
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 $("#Delete").click(function () {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 if (editrow >= 0) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 // Open a popup to confirm this action.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 $('#eventWindow').jqxWindow('open');
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 $("#delOk").click(function () {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 $("#jqxgrid").jqxGrid('deleterow', rowID);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 $("#popupWindow").jqxWindow('hide');
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 // update the edited row when the user clicks the 'Save' button.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 createDelElements();
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279

mercurial