Wed, 16 Oct 2019 21:05:03 +0200
Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
28 | 1 | /***************************************************************************** |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
2 | * Copyright (C) 2014-2019 |
28 | 3 | * |
4 | * Michiel Broek <mbroek at mbse dot eu> | |
5 | * | |
6 | * This file is part of BrewCloud | |
7 | * | |
8 | * This is free software; you can redistribute it and/or modify it | |
9 | * under the terms of the GNU General Public License as published by the | |
10 | * Free Software Foundation; either version 2, or (at your option) any | |
11 | * later version. | |
12 | * | |
13 | * BrewCloud is distributed in the hope that it will be useful, but | |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free | |
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
21 | *****************************************************************************/ | |
22 | ||
23 | ||
24 | function createDelElements() { | |
25 | $('#eventWindow').jqxWindow({ | |
26 | theme: theme, | |
27 | position: { x: 490, y: 210 }, | |
28 | width: 300, | |
34 | 29 | height: 175, |
28 | 30 | resizable: false, |
31 | isModal: true, | |
32 | modalOpacity: 0.4, | |
33 | okButton: $('#delOk'), | |
34 | cancelButton: $('#delCancel'), | |
35 | initContent: function () { | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
36 | $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
37 | $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme }); |
28 | 38 | $('#delCancel').focus(); |
39 | } | |
40 | }); | |
41 | $('#eventWindow').jqxWindow('hide'); | |
42 | } | |
43 | ||
44 | ||
45 | $(document).ready(function () { | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
46 | |
486
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
47 | var dataRecord = {}, |
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
48 | url = 'includes/db_profile_styles.php', |
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
49 | source = { |
28 | 50 | datatype: "json", |
51 | cache: false, | |
52 | datafields: [ | |
53 | { name: 'record', type: 'number' }, | |
54 | { name: 'name', type: 'string' }, | |
55 | { name: 'category', type: 'string' }, | |
56 | { name: 'category_number', type: 'number' }, | |
57 | { name: 'style_letter', type: 'string' }, | |
58 | { name: 'style_guide', type: 'string' }, | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
59 | { name: 'type', type: 'int' }, |
28 | 60 | { name: 'og_min', type: 'float' }, |
61 | { name: 'og_max', type: 'float' }, | |
62 | { name: 'fg_min', type: 'float' }, | |
63 | { name: 'fg_max', type: 'float' }, | |
64 | { name: 'ibu_min', type: 'float' }, | |
65 | { name: 'ibu_max', type: 'float' }, | |
66 | { name: 'color_min', type: 'float' }, | |
67 | { name: 'color_max', type: 'float' }, | |
68 | { name: 'carb_min', type: 'float' }, | |
69 | { name: 'carb_max', type: 'float' }, | |
70 | { name: 'abv_min', type: 'float' }, | |
71 | { name: 'abv_max', type: 'float' }, | |
72 | { name: 'notes', type: 'string' }, | |
73 | { name: 'profile', type: 'string' }, | |
74 | { name: 'ingredients', type: 'string' }, | |
75 | { name: 'examples', type: 'string' } | |
76 | ], | |
77 | id: 'record', | |
78 | url: url, | |
79 | deleterow: function (rowid, commit) { | |
80 | // synchronize with the server - send delete command | |
81 | var data = "delete=true&" + $.param({ record: rowid }); | |
82 | $.ajax({ | |
83 | dataType: 'json', | |
84 | url: url, | |
85 | cache: false, | |
86 | data: data, | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
87 | type: "POST", |
28 | 88 | success: function (data, status, xhr) { |
89 | commit(true); | |
486
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
90 | location.reload( true ); |
28 | 91 | }, |
92 | error: function (jqXHR, textStatus, errorThrown) { | |
93 | commit(false); | |
94 | } | |
95 | }); | |
96 | }, | |
97 | addrow: function (rowid, rowdata, position, commit) { | |
98 | var data = "insert=true&" + $.param(rowdata); | |
99 | $.ajax({ | |
100 | dataType: 'json', | |
101 | url: url, | |
102 | cache: false, | |
103 | data: data, | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
104 | type: "POST", |
28 | 105 | success: function (data, status, xhr) { |
106 | commit(true); | |
486
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
107 | location.reload( true ); |
28 | 108 | }, |
109 | error: function(jqXHR, textStatus, errorThrown) { | |
110 | commit(false); | |
111 | } | |
112 | }); | |
113 | }, | |
114 | updaterow: function (rowid, rowdata, commit) { | |
115 | var data = "update=true&" + $.param(rowdata); | |
116 | $.ajax({ | |
117 | dataType: 'json', | |
118 | url: url, | |
119 | cache: false, | |
120 | data: data, | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
121 | type: "POST", |
28 | 122 | success: function (data, status, xhr) { |
123 | commit(true); | |
486
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
124 | location.reload( true ); |
28 | 125 | }, |
126 | error: function(jqXHR, textStatus, errorThrown) { | |
127 | commit(false); | |
128 | } | |
129 | }); | |
130 | } | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
486
diff
changeset
|
131 | }, |
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
486
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:
486
diff
changeset
|
133 | editrow = -1; |
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
486
diff
changeset
|
134 | |
28 | 135 | // initialize the input fields. |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
136 | $("#name").jqxInput({ theme: theme, width: 320, height: 23 }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
137 | $("#category").jqxInput({ theme: theme, width: 320, height: 23 }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
138 | $("#category_number").jqxNumberInput( PosInt ); |
28 | 139 | $("#style_letter").jqxInput({ theme: theme, width: 250, height: 23 }); |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
140 | $("#style_guide").jqxInput({ theme: theme, width: 320, height: 23 }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
141 | $("#type").jqxDropDownList({ |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
142 | theme: theme, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
143 | source: StyleTypeAdapter, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
144 | valueMember: 'id', |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
145 | displayMember: 'nl', |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
146 | width: 180, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
147 | height: 23, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
148 | autoDropDownHeight: true |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
149 | }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
150 | $("#og_min").jqxNumberInput( SGopts ); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
151 | $("#og_max").jqxNumberInput( SGopts ); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
152 | $("#fg_min").jqxNumberInput( SGopts ); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
153 | $("#fg_max").jqxNumberInput( SGopts ); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
154 | $("#ibu_min").jqxNumberInput( PosInt ); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
155 | $("#ibu_min").jqxNumberInput({ max: 200 }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
156 | $("#ibu_max").jqxNumberInput( PosInt ); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
157 | $("#ibu_max").jqxNumberInput({ max: 200 }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
158 | $("#color_min").jqxNumberInput( PosInt ); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
159 | $("#color_min").jqxNumberInput({ max: 200 }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
160 | $("#color_max").jqxNumberInput( PosInt ); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
161 | $("#color_max").jqxNumberInput({ max: 200 }); |
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:
217
diff
changeset
|
162 | $("#carb_min").jqxNumberInput( Spin1dec ); |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
163 | $("#carb_min").jqxNumberInput({ max: 5 }); |
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:
217
diff
changeset
|
164 | $("#carb_max").jqxNumberInput( Spin1dec ); |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
165 | $("#carb_max").jqxNumberInput({ max: 5 }); |
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:
217
diff
changeset
|
166 | $("#abv_min").jqxNumberInput( Spin1dec ); |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
167 | $("#abv_min").jqxNumberInput({ max: 20 }); |
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:
217
diff
changeset
|
168 | $("#abv_max").jqxNumberInput( Spin1dec ); |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
169 | $("#abv_max").jqxNumberInput({ max: 20 }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
170 | $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
171 | $("#profile").jqxInput({ theme: theme, width: 800, height: 48 }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
172 | $("#ingredients").jqxInput({ theme: theme, width: 800, height: 23 }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
173 | $("#examples").jqxInput({ theme: theme, width: 800, height: 48 }); |
28 | 174 | |
175 | // initialize jqxGrid | |
176 | $("#jqxgrid").jqxGrid({ | |
177 | width: 1280, | |
178 | height: 630, | |
179 | source: dataAdapter, | |
180 | theme: theme, | |
181 | showstatusbar: true, | |
182 | renderstatusbar: function (statusbar) { | |
486
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
183 | var container, addButton, impButton; |
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
184 | container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
185 | 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>"); |
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
186 | impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>"); |
28 | 187 | container.append(addButton); |
311
f6fafccd8a6d
Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents:
286
diff
changeset
|
188 | container.append(impButton); |
28 | 189 | statusbar.append(container); |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
190 | addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
311
f6fafccd8a6d
Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents:
286
diff
changeset
|
191 | impButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
28 | 192 | // add new row. |
193 | addButton.click(function (event) { | |
194 | editrow = -1; | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
195 | $("#name").val('Nieuwe stijl'); |
28 | 196 | $("#category").val(''); |
197 | $("#category_number").val(''); | |
198 | $("#style_letter").val(''); | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
199 | $("#style_guide").val('BKG 2015'); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
200 | $("#type").val(0); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
201 | $("#og_min").val(1.030); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
202 | $("#og_max").val(1.050); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
203 | $("#fg_min").val(1.005); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
204 | $("#fg_max").val(1.010); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
205 | $("#ibu_min").val(20); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
206 | $("#ibu_max").val(30); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
207 | $("#color_min").val(52); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
208 | $("#color_max").val(79); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
209 | $("#carb_min").val(2.0); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
210 | $("#carb_max").val(2.5); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
211 | $("#abv_min").val(4.0); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
212 | $("#abv_max").val(5.0); |
28 | 213 | $("#notes").val(''); |
214 | $("#profile").val(''); | |
215 | $("#ingredients").val(''); | |
216 | $("#examples").val(''); | |
217 | $("#popupWindow").jqxWindow('open'); | |
218 | }); | |
311
f6fafccd8a6d
Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents:
286
diff
changeset
|
219 | impButton.click(function (event) { |
486
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
220 | window.location.href = 'import_ingredients.php?select=styles'; |
311
f6fafccd8a6d
Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents:
286
diff
changeset
|
221 | }); |
28 | 222 | }, |
223 | filterable: true, | |
224 | filtermode: 'excel', | |
225 | columns: [ | |
444
7e563dbbee32
Profile styles now includes the Style Guide. Adjusted the database index to include the style guide.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
226 | { text: 'Gids', datafield: 'style_guide', width: 100 }, |
28 | 227 | { text: 'Groep', datafield: 'style_letter', width: 30 }, |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
228 | { text: 'Style Name', menu: false, datafield: 'name' }, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
229 | { text: 'OG', menu: false, datafield: 'og_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
230 | { text: 'OG', menu: false, datafield: 'og_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
231 | { text: 'FG', menu: false, datafield: 'fg_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
232 | { text: 'FG', menu: false, datafield: 'fg_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
444
7e563dbbee32
Profile styles now includes the Style Guide. Adjusted the database index to include the style guide.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
233 | { text: 'IBU', menu: false, datafield: 'ibu_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
7e563dbbee32
Profile styles now includes the Style Guide. Adjusted the database index to include the style guide.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
234 | { text: 'IBU', menu: false, datafield: 'ibu_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
7e563dbbee32
Profile styles now includes the Style Guide. Adjusted the database index to include the style guide.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
235 | { text: 'EBC', menu: false, datafield: 'color_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
7e563dbbee32
Profile styles now includes the Style Guide. Adjusted the database index to include the style guide.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
236 | { text: 'EBC', menu: false, datafield: 'color_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
7e563dbbee32
Profile styles now includes the Style Guide. Adjusted the database index to include the style guide.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
237 | { text: 'Co2', menu: false, datafield: 'carb_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
7e563dbbee32
Profile styles now includes the Style Guide. Adjusted the database index to include the style guide.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
238 | { text: 'Co2', menu: false, datafield: 'carb_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
7e563dbbee32
Profile styles now includes the Style Guide. Adjusted the database index to include the style guide.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
239 | { text: 'ABV', menu: false, datafield: 'abv_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
7e563dbbee32
Profile styles now includes the Style Guide. Adjusted the database index to include the style guide.
Michiel Broek <mbroek@mbse.eu>
parents:
311
diff
changeset
|
240 | { text: 'ABV', menu: false, datafield: 'abv_max', width: 50, 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
|
241 | { text: '', menu: false, datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () { |
34 | 242 | return "Wijzig"; |
28 | 243 | }, buttonclick: function (row) { |
244 | // open the popup window when the user clicks a button. | |
245 | editrow = row; | |
246 | // get the clicked row's data and initialize the input fields. | |
486
e17155b3086a
Fixed style profiles race condition
Michiel Broek <mbroek@mbse.eu>
parents:
444
diff
changeset
|
247 | dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
28 | 248 | $("#name").val(dataRecord.name); |
249 | $("#category").val(dataRecord.category); | |
250 | $("#category_number").val(dataRecord.category_number); | |
251 | $("#style_letter").val(dataRecord.style_letter); | |
252 | $("#style_guide").val(dataRecord.style_guide); | |
253 | $("#type").val(dataRecord.type); | |
254 | $("#og_min").val(dataRecord.og_min); | |
255 | $("#og_max").val(dataRecord.og_max); | |
256 | $("#fg_min").val(dataRecord.fg_min); | |
257 | $("#fg_max").val(dataRecord.fg_max); | |
258 | $("#ibu_min").val(dataRecord.ibu_min); | |
259 | $("#ibu_max").val(dataRecord.ibu_max); | |
260 | $("#color_min").val(dataRecord.color_min); | |
261 | $("#color_max").val(dataRecord.color_max); | |
262 | $("#carb_min").val(dataRecord.carb_min); | |
263 | $("#carb_max").val(dataRecord.carb_max); | |
264 | $("#abv_min").val(dataRecord.abv_min); | |
265 | $("#abv_max").val(dataRecord.abv_max); | |
266 | $("#notes").val(dataRecord.notes); | |
267 | $("#profile").val(dataRecord.profile); | |
268 | $("#ingredients").val(dataRecord.ingredients); | |
269 | $("#examples").val(dataRecord.examples); | |
270 | // show the popup window. | |
271 | $("#popupWindow").jqxWindow('open'); | |
272 | } | |
273 | } | |
274 | ] | |
275 | }); | |
276 | // initialize the popup window and buttons. | |
277 | $("#popupWindow").jqxWindow({ | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
278 | width: 1050, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
279 | position: { x: 110, y: 30 }, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
280 | resizable: false, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
281 | theme: theme, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
282 | isModal: true, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
283 | autoOpen: false, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
284 | cancelButton: $("#Cancel"), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
285 | modalOpacity: 0.40 |
28 | 286 | }); |
287 | $("#popupWindow").on('open', function () { | |
288 | $("#name").jqxInput('selectAll'); | |
289 | }); | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
290 | $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); |
28 | 291 | $("#Delete").click(function () { |
292 | if (editrow >= 0) { | |
293 | // Open a popup to confirm this action. | |
294 | $('#eventWindow').jqxWindow('open'); | |
295 | $("#delOk").click(function () { | |
296 | var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); | |
297 | $("#jqxgrid").jqxGrid('deleterow', rowID); | |
298 | }); | |
299 | } | |
300 | $("#popupWindow").jqxWindow('hide'); | |
301 | }); | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
302 | $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
303 | $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
28 | 304 | // update the edited row when the user clicks the 'Save' button. |
305 | $("#Save").click(function () { | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
486
diff
changeset
|
306 | var row, rowID = -1; |
28 | 307 | if (editrow >= 0) { |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
308 | rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
309 | } |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
486
diff
changeset
|
310 | row = { |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
311 | record: rowID, |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
312 | name: $("#name").val(), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
313 | category: $("#category").val(), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
314 | category_number: parseFloat($("#category_number").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
315 | style_letter: $("#style_letter").val(), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
316 | style_guide: $("#style_guide").val(), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
317 | type: $("#type").val(), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
318 | og_min: parseFloat($("#og_min").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
319 | og_max: parseFloat($("#og_max").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
320 | fg_min: parseFloat($("#fg_min").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
321 | fg_max: parseFloat($("#fg_max").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
322 | ibu_min: parseFloat($("#ibu_min").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
323 | ibu_max: parseFloat($("#ibu_max").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
324 | color_min: parseFloat($("#color_min").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
325 | color_max: parseFloat($("#color_max").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
326 | carb_min: parseFloat($("#carb_min").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
327 | carb_max: parseFloat($("#carb_max").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
328 | abv_min: parseFloat($("#abv_min").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
329 | abv_max: parseFloat($("#abv_max").jqxNumberInput('decimal')), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
330 | notes: $("#notes").val(), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
331 | profile: $("#profile").val(), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
332 | ingredients: $("#ingredients").val(), |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
333 | examples: $("#examples").val() |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
334 | }; |
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
335 | if (editrow >= 0) { |
28 | 336 | $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
337 | } else { | |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
338 | $('#jqxgrid').jqxGrid('addrow', null, row); |
28 | 339 | } |
217
318aab371497
Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents:
66
diff
changeset
|
340 | $("#popupWindow").jqxWindow('hide'); |
28 | 341 | }); |
342 | createDelElements(); | |
343 | }); | |
344 |