Mon, 11 Feb 2019 17:09:15 +0100
Fix yeast cost during import.
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 | |
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
|
47 | var dataRecord = {}; |
45
95251bedfab4
Moved three inventory tables and screens to profiles
Michiel Broek <mbroek@mbse.eu>
parents:
34
diff
changeset
|
48 | var url = "includes/db_profile_styles.php"; |
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
|
49 | |
28 | 50 | // prepare the data |
51 | var source = { | |
52 | datatype: "json", | |
53 | cache: false, | |
54 | datafields: [ | |
55 | { name: 'record', type: 'number' }, | |
56 | { name: 'name', type: 'string' }, | |
57 | { name: 'category', type: 'string' }, | |
58 | { name: 'category_number', type: 'number' }, | |
59 | { name: 'style_letter', type: 'string' }, | |
60 | { 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
|
61 | { name: 'type', type: 'int' }, |
28 | 62 | { name: 'og_min', type: 'float' }, |
63 | { name: 'og_max', type: 'float' }, | |
64 | { name: 'fg_min', type: 'float' }, | |
65 | { name: 'fg_max', type: 'float' }, | |
66 | { name: 'ibu_min', type: 'float' }, | |
67 | { name: 'ibu_max', type: 'float' }, | |
68 | { name: 'color_min', type: 'float' }, | |
69 | { name: 'color_max', type: 'float' }, | |
70 | { name: 'carb_min', type: 'float' }, | |
71 | { name: 'carb_max', type: 'float' }, | |
72 | { name: 'abv_min', type: 'float' }, | |
73 | { name: 'abv_max', type: 'float' }, | |
74 | { name: 'notes', type: 'string' }, | |
75 | { name: 'profile', type: 'string' }, | |
76 | { name: 'ingredients', type: 'string' }, | |
77 | { name: 'examples', type: 'string' } | |
78 | ], | |
79 | id: 'record', | |
80 | url: url, | |
81 | deleterow: function (rowid, commit) { | |
82 | // synchronize with the server - send delete command | |
83 | var data = "delete=true&" + $.param({ record: rowid }); | |
84 | $.ajax({ | |
85 | dataType: 'json', | |
86 | url: url, | |
87 | cache: false, | |
88 | data: data, | |
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
|
89 | type: "POST", |
28 | 90 | success: function (data, status, xhr) { |
91 | // delete command is executed. | |
92 | commit(true); | |
93 | }, | |
94 | error: function (jqXHR, textStatus, errorThrown) { | |
95 | commit(false); | |
96 | } | |
97 | }); | |
98 | }, | |
99 | addrow: function (rowid, rowdata, position, commit) { | |
100 | var data = "insert=true&" + $.param(rowdata); | |
101 | $.ajax({ | |
102 | dataType: 'json', | |
103 | url: url, | |
104 | cache: false, | |
105 | data: data, | |
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
|
106 | type: "POST", |
28 | 107 | success: function (data, status, xhr) { |
108 | commit(true); | |
109 | }, | |
110 | error: function(jqXHR, textStatus, errorThrown) { | |
111 | commit(false); | |
112 | } | |
113 | }); | |
114 | }, | |
115 | updaterow: function (rowid, rowdata, commit) { | |
116 | var data = "update=true&" + $.param(rowdata); | |
117 | $.ajax({ | |
118 | dataType: 'json', | |
119 | url: url, | |
120 | cache: false, | |
121 | data: data, | |
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
|
122 | type: "POST", |
28 | 123 | success: function (data, status, xhr) { |
124 | // update command is executed. | |
125 | commit(true); | |
126 | }, | |
127 | error: function(jqXHR, textStatus, errorThrown) { | |
128 | commit(false); | |
129 | } | |
130 | }); | |
131 | } | |
132 | }; | |
133 | var srcType = [ "Lager", "Ale", "Mead", "Wheat", "Mixed", "Cider" ]; | |
134 | // 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
|
135 | $("#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
|
136 | $("#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
|
137 | $("#category_number").jqxNumberInput( PosInt ); |
28 | 138 | $("#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
|
139 | $("#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
|
140 | $("#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
|
141 | 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
|
142 | 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
|
143 | 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
|
144 | 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
|
145 | 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
|
146 | 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
|
147 | 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
|
148 | }); |
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 | $("#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
|
150 | $("#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
|
151 | $("#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
|
152 | $("#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
|
153 | $("#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
|
154 | $("#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
|
155 | $("#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
|
156 | $("#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
|
157 | $("#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
|
158 | $("#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
|
159 | $("#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
|
160 | $("#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
|
161 | $("#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
|
162 | $("#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
|
163 | $("#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
|
164 | $("#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
|
165 | $("#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
|
166 | $("#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
|
167 | $("#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
|
168 | $("#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
|
169 | $("#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
|
170 | $("#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
|
171 | $("#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
|
172 | $("#examples").jqxInput({ theme: theme, width: 800, height: 48 }); |
28 | 173 | |
174 | var dataAdapter = new $.jqx.dataAdapter(source); | |
175 | var editrow = -1; | |
176 | // initialize jqxGrid | |
177 | $("#jqxgrid").jqxGrid({ | |
178 | width: 1280, | |
179 | height: 630, | |
180 | source: dataAdapter, | |
181 | theme: theme, | |
182 | showstatusbar: true, | |
183 | localization: getLocalization(), | |
184 | renderstatusbar: function (statusbar) { | |
185 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
34 | 186 | 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>"); |
28 | 187 | container.append(addButton); |
188 | 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
|
189 | addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
28 | 190 | // add new row. |
191 | addButton.click(function (event) { | |
192 | 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
|
193 | $("#name").val('Nieuwe stijl'); |
28 | 194 | $("#category").val(''); |
195 | $("#category_number").val(''); | |
196 | $("#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
|
197 | $("#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
|
198 | $("#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
|
199 | $("#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
|
200 | $("#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
|
201 | $("#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
|
202 | $("#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
|
203 | $("#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
|
204 | $("#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
|
205 | $("#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
|
206 | $("#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
|
207 | $("#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
|
208 | $("#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
|
209 | $("#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
|
210 | $("#abv_max").val(5.0); |
28 | 211 | $("#notes").val(''); |
212 | $("#profile").val(''); | |
213 | $("#ingredients").val(''); | |
214 | $("#examples").val(''); | |
215 | $("#popupWindow").jqxWindow('open'); | |
216 | }); | |
217 | }, | |
218 | filterable: true, | |
219 | filtermode: 'excel', | |
220 | columns: [ | |
221 | { 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
|
222 | { 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
|
223 | { 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
|
224 | { 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
|
225 | { 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
|
226 | { text: 'FG', menu: false, datafield: 'fg_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
|
227 | { text: 'IBU', menu: false, datafield: 'ibu_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
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: 'IBU', menu: false, datafield: 'ibu_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
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: 'EBC', menu: false, datafield: 'color_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
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: 'EBC', menu: false, datafield: 'color_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
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: 'Co2', menu: false, datafield: 'carb_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
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: 'Co2', menu: false, datafield: 'carb_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
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
|
233 | { text: 'ABV', menu: false, datafield: 'abv_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
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
|
234 | { text: 'ABV', menu: false, datafield: 'abv_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
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
|
235 | { text: 'Wijzig', menu: false, datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () { |
34 | 236 | return "Wijzig"; |
28 | 237 | }, buttonclick: function (row) { |
238 | // open the popup window when the user clicks a button. | |
239 | editrow = row; | |
240 | // get the clicked row's data and initialize the input fields. | |
241 | var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); | |
242 | $("#name").val(dataRecord.name); | |
243 | $("#category").val(dataRecord.category); | |
244 | $("#category_number").val(dataRecord.category_number); | |
245 | $("#style_letter").val(dataRecord.style_letter); | |
246 | $("#style_guide").val(dataRecord.style_guide); | |
247 | $("#type").val(dataRecord.type); | |
248 | $("#og_min").val(dataRecord.og_min); | |
249 | $("#og_max").val(dataRecord.og_max); | |
250 | $("#fg_min").val(dataRecord.fg_min); | |
251 | $("#fg_max").val(dataRecord.fg_max); | |
252 | $("#ibu_min").val(dataRecord.ibu_min); | |
253 | $("#ibu_max").val(dataRecord.ibu_max); | |
254 | $("#color_min").val(dataRecord.color_min); | |
255 | $("#color_max").val(dataRecord.color_max); | |
256 | $("#carb_min").val(dataRecord.carb_min); | |
257 | $("#carb_max").val(dataRecord.carb_max); | |
258 | $("#abv_min").val(dataRecord.abv_min); | |
259 | $("#abv_max").val(dataRecord.abv_max); | |
260 | $("#notes").val(dataRecord.notes); | |
261 | $("#profile").val(dataRecord.profile); | |
262 | $("#ingredients").val(dataRecord.ingredients); | |
263 | $("#examples").val(dataRecord.examples); | |
264 | // show the popup window. | |
265 | $("#popupWindow").jqxWindow('open'); | |
266 | } | |
267 | } | |
268 | ] | |
269 | }); | |
270 | // initialize the popup window and buttons. | |
271 | $("#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
|
272 | 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
|
273 | 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
|
274 | 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
|
275 | 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
|
276 | 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
|
277 | 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
|
278 | 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
|
279 | modalOpacity: 0.40 |
28 | 280 | }); |
281 | $("#popupWindow").on('open', function () { | |
282 | $("#name").jqxInput('selectAll'); | |
283 | }); | |
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
|
284 | $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); |
28 | 285 | $("#Delete").click(function () { |
286 | if (editrow >= 0) { | |
287 | // Open a popup to confirm this action. | |
288 | $('#eventWindow').jqxWindow('open'); | |
289 | $("#delOk").click(function () { | |
290 | var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); | |
291 | $("#jqxgrid").jqxGrid('deleterow', rowID); | |
292 | }); | |
293 | } | |
294 | $("#popupWindow").jqxWindow('hide'); | |
295 | }); | |
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
|
296 | $("#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
|
297 | $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
28 | 298 | // update the edited row when the user clicks the 'Save' button. |
299 | $("#Save").click(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
|
300 | var rowID = -1; |
28 | 301 | 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
|
302 | 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
|
303 | } |
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
|
304 | var row = { |
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
|
305 | 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
|
306 | 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
|
307 | 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
|
308 | 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
|
309 | 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
|
310 | 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
|
311 | 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
|
312 | 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
|
313 | 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
|
314 | 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
|
315 | 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
|
316 | 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
|
317 | 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
|
318 | 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
|
319 | 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
|
320 | 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
|
321 | 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
|
322 | 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
|
323 | 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
|
324 | 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
|
325 | 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
|
326 | 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
|
327 | 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
|
328 | }; |
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 | if (editrow >= 0) { |
28 | 330 | $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
331 | } 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
|
332 | $('#jqxgrid').jqxGrid('addrow', null, row); |
28 | 333 | } |
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
|
334 | $("#popupWindow").jqxWindow('hide'); |
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 | location.reload( true ); // reload ourself. |
28 | 336 | }); |
337 | createDelElements(); | |
338 | }); | |
339 |