www/js/profile_water.js

Sun, 24 Feb 2019 17:23:52 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 24 Feb 2019 17:23:52 +0100
changeset 286
124af734af68
parent 245
3649c3d31d15
child 485
3cdfcdd71077
permissions
-rw-r--r--

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.

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 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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 // prepare the data
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 var source = {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 datatype: "json",
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 cache: false,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 datafields: [
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 { name: 'record', type: 'number' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 { name: 'name', type: 'string' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 { name: 'calcium', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 { name: 'bicarbonate', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 { name: 'sulfate', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 { name: 'chloride', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 { name: 'sodium', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 { name: 'magnesium', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 { name: 'ph', type: 'float' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 { name: 'notes', type: 'string' },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 { name: 'total_alkalinity', type: 'float' }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 ],
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 id: 'record',
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 url: url,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 deleterow: function (rowid, commit) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 // synchronize with the server - send delete command
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 var data = "delete=true&" + $.param({ record: rowid });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 $.ajax({
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 dataType: 'json',
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 url: url,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 cache: false,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 success: function (data, status, xhr) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 // delete command is executed.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 commit(true);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 error: function (jqXHR, textStatus, errorThrown) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 commit(false);
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 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 addrow: function (rowid, rowdata, position, commit) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 var data = "insert=true&" + $.param(rowdata);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 $.ajax({
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 dataType: 'json',
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 url: url,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 cache: false,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 success: function (data, status, xhr) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 commit(true);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 error: function(jqXHR, textStatus, errorThrown) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 commit(false);
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 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 updaterow: function (rowid, rowdata, commit) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 var data = "update=true&" + $.param(rowdata);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 $.ajax({
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 dataType: 'json',
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 url: url,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 cache: false,
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 success: function (data, status, xhr) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 // update command is executed.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 commit(true);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 },
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 error: function(jqXHR, textStatus, errorThrown) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 commit(false);
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 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 }
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 };
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 var dataAdapter = new $.jqx.dataAdapter(source);
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 var editrow = -1;
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) {
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 22
diff changeset
156 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
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.
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
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 () {
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
253 var 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 }
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 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
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');
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 location.reload( true ); // reload ourself.
22
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 createDelElements();
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 });
99c02fa797f9 Added inventory water profiles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280

mercurial