19 * along with ThermFerm; see the file COPYING. If not, write to the Free |
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. |
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
21 *****************************************************************************/ |
21 *****************************************************************************/ |
22 |
22 |
23 |
23 |
24 $(document).ready(function () { |
24 $(document).ready(function() { |
25 |
25 |
26 var recipe_type = 2, |
26 var recipe_type = 2, |
27 style_type = 0, |
27 style_type = 0, |
28 |
28 |
29 //Creating wizard module |
29 //Creating wizard module |
30 wizard = (function () { |
30 wizard = (function() { |
31 |
31 |
32 //Adding event listeners |
32 //Adding event listeners |
33 var _addHandlers = function () { |
33 var _addHandlers = function() { |
34 $('#name').on('change', function (event) { wizard.validate(true); }); |
34 $('#name').on('change', function(event) { wizard.validate(true); }); |
35 $('#type').on('change', function (event) { wizard.validate(true); }); |
35 $('#type').on('change', function(event) { wizard.validate(true); }); |
36 $('#boil_time').on('change', function (event) { wizard.validate(true); }); |
36 $('#boil_time').on('change', function(event) { wizard.validate(true); }); |
37 $('#est_og').on('change', function (event) { wizard.validate(true); }); |
37 $('#est_og').on('change', function(event) { wizard.validate(true); }); |
38 $('#efficiency').on('change', function (event) { wizard.validate(true); }); |
38 $('#efficiency').on('change', function(event) { wizard.validate(true); }); |
39 $('#styleSelect').on('change', function (event) { wizard.validate(true); }); |
39 $('#styleSelect').on('change', function(event) { wizard.validate(true); }); |
40 $('#nextButtonCompleted').click(function () { |
40 $('#nextButtonCompleted').click(function() { |
41 console.log("insert start"); |
41 console.log('insert start'); |
42 var newrow = { |
42 var newrow = { |
43 record: -1, |
43 record: -1, |
44 locked: 0, |
44 locked: 0, |
45 name: $("#name").val(), |
45 name: $('#name').val(), |
46 notes: $("#notes").val(), |
46 notes: $('#notes').val(), |
47 st_name: $('#st_name').val(), |
47 st_name: $('#st_name').val(), |
48 st_letter: $('#st_style_letter').val(), |
48 st_letter: $('#st_style_letter').val(), |
49 st_guide: $('#st_style_guide').val(), |
49 st_guide: $('#st_style_guide').val(), |
50 st_category: $('#st_category').val(), |
50 st_category: $('#st_category').val(), |
51 st_category_number: parseFloat($('#st_category_number').jqxNumberInput('decimal')), |
51 st_category_number: parseFloat($('#st_category_number').jqxNumberInput('decimal')), |
52 st_type: style_type, |
52 st_type: style_type, |
53 st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')), |
53 st_og_min: parseFloat($('#st_og_min').jqxNumberInput('decimal')), |
54 st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')), |
54 st_og_max: parseFloat($('#st_og_max').jqxNumberInput('decimal')), |
55 st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')), |
55 st_fg_min: parseFloat($('#st_fg_min').jqxNumberInput('decimal')), |
56 st_fg_max: parseFloat($("#st_fg_max").jqxNumberInput('decimal')), |
56 st_fg_max: parseFloat($('#st_fg_max').jqxNumberInput('decimal')), |
57 st_ibu_min: parseFloat($("#st_ibu_min").jqxNumberInput('decimal')), |
57 st_ibu_min: parseFloat($('#st_ibu_min').jqxNumberInput('decimal')), |
58 st_ibu_max: parseFloat($("#st_ibu_max").jqxNumberInput('decimal')), |
58 st_ibu_max: parseFloat($('#st_ibu_max').jqxNumberInput('decimal')), |
59 st_color_min: parseFloat($("#st_color_min").jqxNumberInput('decimal')), |
59 st_color_min: parseFloat($('#st_color_min').jqxNumberInput('decimal')), |
60 st_color_max: parseFloat($("#st_color_max").jqxNumberInput('decimal')), |
60 st_color_max: parseFloat($('#st_color_max').jqxNumberInput('decimal')), |
61 st_carb_min: parseFloat($("#st_carb_min").jqxNumberInput('decimal')), |
61 st_carb_min: parseFloat($('#st_carb_min').jqxNumberInput('decimal')), |
62 st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')), |
62 st_carb_max: parseFloat($('#st_carb_max').jqxNumberInput('decimal')), |
63 st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')), |
63 st_abv_min: parseFloat($('#st_abv_min').jqxNumberInput('decimal')), |
64 st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')), |
64 st_abv_max: parseFloat($('#st_abv_max').jqxNumberInput('decimal')), |
65 type: recipe_type, |
65 type: recipe_type, |
66 batch_size: 20.0, |
66 batch_size: 20.0, |
67 boil_size: 22.0, |
67 boil_size: 22.0, |
68 boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), |
68 boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')), |
69 efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')), |
69 efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')), |
70 est_og: parseFloat($("#est_og").jqxNumberInput('decimal')), |
70 est_og: parseFloat($('#est_og').jqxNumberInput('decimal')), |
71 est_fg: 1.000, |
71 est_fg: 1.000, |
72 est_color: 0, |
72 est_color: 0, |
73 est_abv: 0.0, |
73 est_abv: 0.0, |
74 est_carb: 0.0, |
74 est_carb: 0.0, |
75 color_method: 0, // Morey |
75 color_method: 0, // Morey |
76 est_ibu: 0, |
76 est_ibu: 0, |
77 ibu_method: 0, // Tinseth |
77 ibu_method: 0, // Tinseth |
78 mash_name: "", |
78 mash_name: '', |
79 mash_ph: 5.4, |
79 mash_ph: 5.4, |
80 sparge_temp: 85.0, |
80 sparge_temp: 85.0, |
81 sparge_volume: 12.0, |
81 sparge_volume: 12.0, |
82 sparge_ph: 5.8, |
82 sparge_ph: 5.8, |
83 sparge_source: 0, // Source 1 |
83 sparge_source: 0, // Source 1 |
84 sparge_acid_type: 0, // Lactic acid |
84 sparge_acid_type: 0, // Lactic acid |
85 sparge_acid_perc: 80, |
85 sparge_acid_perc: 80, |
86 sparge_acid_amount: 0, |
86 sparge_acid_amount: 0, |
87 calc_acid: true, |
87 calc_acid: true, |
88 w1_name: 'Tap water', |
88 w1_name: 'Tap water', |
89 w1_amount: 15, |
89 w1_amount: 15, |
90 w1_calcium: 0, |
90 w1_calcium: 0, |
91 w1_sulfate: 0, |
91 w1_sulfate: 0, |
92 w1_chloride: 0, |
92 w1_chloride: 0, |
93 w1_sodium: 0, |
93 w1_sodium: 0, |
94 w1_magnesium: 0, |
94 w1_magnesium: 0, |
95 w1_total_alkalinity: 0, |
95 w1_total_alkalinity: 0, |
96 w1_ph: 7.0, |
96 w1_ph: 7.0, |
97 w1_cost: 0.0, |
97 w1_cost: 0.0, |
98 wa_acid_name: 0, // Lactic acid |
98 wa_acid_name: 0, // Lactic acid |
99 wa_acid_perc: 80, |
99 wa_acid_perc: 80, |
100 wa_base_name: 0 |
100 wa_base_name: 0 |
101 }, |
101 }, |
102 data = "insert=true&return=" + my_return + "&" + $.param(newrow); |
102 data = 'insert=true&return=' + my_return + '&' + $.param(newrow); |
103 $.ajax({ |
103 $.ajax({ |
104 dataType: 'json', |
104 dataType: 'json', |
105 url: "includes/db_recipes.php", |
105 url: 'includes/db_recipes.php', |
106 cache: false, |
106 cache: false, |
107 data: data, |
107 data: data, |
108 type: "POST", |
108 type: 'POST', |
109 success: function (data, status, xhr) { |
109 success: function(data, status, xhr) { |
110 // update command is executed. |
110 // update command is executed. |
111 window.location.href = my_return; |
111 window.location.href = my_return; |
112 }, |
112 }, |
113 error: function(jqXHR, textStatus, errorThrown) { |
113 error: function(jqXHR, textStatus, errorThrown) { |
114 } |
114 } |
115 }); |
115 }); |
116 }); |
116 }); |
117 $('.nextButton').click(function () { |
117 $('.nextButton').click(function() { |
118 wizard.validate(true); |
118 wizard.validate(true); |
119 $('#jqxTabs').jqxTabs('next'); |
119 $('#jqxTabs').jqxTabs('next'); |
120 }); |
120 }); |
121 $('.backButton').click(function () { |
121 $('.backButton').click(function() { |
122 wizard.validate(true); |
122 wizard.validate(true); |
123 $('#jqxTabs').jqxTabs('previous'); |
123 $('#jqxTabs').jqxTabs('previous'); |
124 }); |
124 }); |
125 }; |
125 }; |
126 |
126 |
127 return { |
127 return { |
128 //Initializing the wizzard - creating all elements, adding event handlers and starting the validation |
128 //Initializing the wizzard - creating all elements, adding event handlers and starting the validation |
129 init: function () { |
129 init: function() { |
130 $('#jqxTabs').jqxTabs({ |
130 $('#jqxTabs').jqxTabs({ |
131 theme: theme, |
131 theme: theme, |
132 height: 630, |
132 height: 630, |
133 width: 1280, |
133 width: 1280, |
134 autoHeight: false, |
134 autoHeight: false, |
135 position: 'top', |
135 position: 'top', |
136 keyboardNavigation: false |
136 keyboardNavigation: false |
137 }); |
137 }); |
138 $('#nextButtonBase').jqxButton({ theme: theme, width: 150 }); |
138 $('#nextButtonBase').jqxButton({ theme: theme, width: 150 }); |
139 $('#nextButtonStyle').jqxButton({ theme: theme, width: 150}); |
139 $('#nextButtonStyle').jqxButton({ theme: theme, width: 150}); |
140 $('#backButtonStyle').jqxButton({ theme: theme, template: 'success', width: 150}); |
140 $('#backButtonStyle').jqxButton({ theme: theme, template: 'success', width: 150}); |
141 $('#nextButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150}); |
141 $('#nextButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150}); |
142 $('#backButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150}); |
142 $('#backButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150}); |
143 _addHandlers(); |
143 _addHandlers(); |
144 this.validate(); |
144 this.validate(); |
145 this.showHint('Vul de nodige gegevens in.'); |
145 this.showHint('Vul de nodige gegevens in.'); |
146 }, |
146 }, |
147 |
147 |
148 //Validating all wizard tabs |
148 //Validating all wizard tabs |
149 validate: function (notify) { |
149 validate: function(notify) { |
150 if (!this.firstTab(notify)) { |
150 if (!this.firstTab(notify)) { |
151 $('#jqxTabs').jqxTabs('disableAt', 1); |
151 $('#jqxTabs').jqxTabs('disableAt', 1); |
152 $('#jqxTabs').jqxTabs('disableAt', 2); |
152 $('#jqxTabs').jqxTabs('disableAt', 2); |
153 return; |
153 return; |
154 } else { |
154 } else { |
155 $('#jqxTabs').jqxTabs('enableAt', 1); |
155 $('#jqxTabs').jqxTabs('enableAt', 1); |
156 } |
156 } |
157 if (!this.secondTab(notify)) { |
157 if (!this.secondTab(notify)) { |
158 $('#jqxTabs').jqxTabs('disableAt', 2); |
158 $('#jqxTabs').jqxTabs('disableAt', 2); |
159 return; |
159 return; |
160 } else { |
160 } else { |
161 $('#jqxTabs').jqxTabs('enableAt', 2); |
161 $('#jqxTabs').jqxTabs('enableAt', 2); |
162 } |
162 } |
163 }, |
163 }, |
164 |
164 |
165 //Displaying message to the user |
165 //Displaying message to the user |
166 showHint: function (message, selector) { |
166 showHint: function(message, selector) { |
167 if (typeof selector === 'undefined') { |
167 if (typeof selector === 'undefined') { |
168 selector = '.hint'; |
168 selector = '.hint'; |
169 } |
169 } |
170 if (message === '') { |
170 if (message === '') { |
171 message = 'Ok, je mag doorgaan.'; |
171 message = 'Ok, je mag doorgaan.'; |
172 } |
172 } |
173 $(selector).html('<strong>' + message + '</strong>'); |
173 $(selector).html('<strong>' + message + '</strong>'); |
174 }, |
174 }, |
175 |
175 |
176 //Validating the first tab |
176 //Validating the first tab |
177 firstTab: function (notify) { |
177 firstTab: function(notify) { |
178 var name = $('#name').val(), |
178 var name = $('#name').val(), |
179 type = $('#type').val(), |
179 type = $('#type').val(), |
180 boil_time = parseFloat($("#boil_time").jqxNumberInput('decimal')), |
180 boil_time = parseFloat($('#boil_time').jqxNumberInput('decimal')), |
181 est_og = parseFloat($("#est_og").jqxNumberInput('decimal')), |
181 est_og = parseFloat($('#est_og').jqxNumberInput('decimal')), |
182 efficiency = parseFloat($("#efficiency").jqxNumberInput('decimal')), |
182 efficiency = parseFloat($('#efficiency').jqxNumberInput('decimal')), |
183 message = ''; |
183 message = ''; |
184 if (name.length < 3) { |
184 if (name.length < 3) { |
185 message += 'Je moet een recept naam invullen. <br />'; |
185 message += 'Je moet een recept naam invullen. <br />'; |
186 } |
186 } |
187 // Check if name already exists. |
187 // Check if name already exists. |
188 if (type.length < 1) { |
188 if (type.length < 1) { |
189 message += 'Je moet een brouw type kiezen. <br />'; |
189 message += 'Je moet een brouw type kiezen. <br />'; |
190 } |
190 } |
191 if ((boil_time < 4) || (boil_time > 360)) { |
191 if ((boil_time < 4) || (boil_time > 360)) { |
192 message += 'De kooktijd moet tussen 4 en 360 minuten zijn. <br />'; |
192 message += 'De kooktijd moet tussen 4 en 360 minuten zijn. <br />'; |
193 } |
193 } |
194 if ((est_og < 1.010) || (est_og > 1.200)) { |
194 if ((est_og < 1.010) || (est_og > 1.200)) { |
195 message += 'Het OG moet tussen 1.010 en 1.200 zijn. <br />'; |
195 message += 'Het OG moet tussen 1.010 en 1.200 zijn. <br />'; |
196 } |
196 } |
197 if ((efficiency < 35) || (efficiency > 95)) { |
197 if ((efficiency < 35) || (efficiency > 95)) { |
198 message += 'Het brouwzaal rendement moet tussen 35 en 95 zijn. <br />'; |
198 message += 'Het brouwzaal rendement moet tussen 35 en 95 zijn. <br />'; |
199 } |
199 } |
200 if (message !== '') { |
200 if (message !== '') { |
201 if (notify) { |
201 if (notify) { |
202 this.showHint(message, '#hintBase'); |
202 this.showHint(message, '#hintBase'); |
203 } |
203 } |
204 return false; |
204 return false; |
205 } |
205 } |
206 this.showHint('Ok, je mag doorgaan.', '#hintBase'); |
206 this.showHint('Ok, je mag doorgaan.', '#hintBase'); |
207 $('#nextButtonBase').jqxButton({ template: 'success' }); |
207 $('#nextButtonBase').jqxButton({ template: 'success' }); |
208 return true; |
208 return true; |
209 }, |
209 }, |
210 |
210 |
211 //Validating the second tab |
211 //Validating the second tab |
212 secondTab: function (notify) { |
212 secondTab: function(notify) { |
213 var stylesel = $('#styleSelect').val(), |
213 var stylesel = $('#styleSelect').val(), |
214 message = ''; |
214 message = ''; |
215 if (stylesel.length < 3) { |
215 if (stylesel.length < 3) { |
216 message += 'Je moet een bierstijl kiezen. <br />'; |
216 message += 'Je moet een bierstijl kiezen. <br />'; |
217 } |
217 } |
218 if (message !== '') { |
218 if (message !== '') { |
219 if (notify) { |
219 if (notify) { |
220 this.showHint(message, '#hintStyle'); |
220 this.showHint(message, '#hintStyle'); |
221 } |
221 } |
222 return false; |
222 return false; |
223 } |
223 } |
224 this.showHint('Ok, je mag doorgaan.', '#hintStyle'); |
224 this.showHint('Ok, je mag doorgaan.', '#hintStyle'); |
225 $('#nextButtonStyle').jqxButton({ template: 'success' }); |
225 $('#nextButtonStyle').jqxButton({ template: 'success' }); |
226 return true; |
226 return true; |
227 } |
227 } |
228 } |
228 }; |
229 } ()); |
229 } ()); |
230 |
230 |
231 // Tab 1, Base |
231 // Tab 1, Base |
232 $("#name").jqxTooltip({ content: 'De naam voor dit recept.' }); |
232 $('#name').jqxTooltip({ content: 'De naam voor dit recept.' }); |
233 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); |
233 $('#name').jqxInput({ theme: theme, width: 640, height: 23 }); |
234 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' }); |
234 $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' }); |
235 $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); |
235 $('#notes').jqxInput({ theme: theme, width: 960, height: 200 }); |
236 $("#type").jqxDropDownList({ |
236 $('#type').jqxDropDownList({ |
237 theme: theme, |
237 theme: theme, |
238 source: RecipeTypeAdapter, |
238 source: RecipeTypeAdapter, |
239 valueMember: 'id', |
239 valueMember: 'id', |
240 displayMember: 'nl', |
240 displayMember: 'nl', |
241 width: 180, |
241 width: 180, |
242 height: 23, |
242 height: 23, |
243 autoDropDownHeight: true |
243 autoDropDownHeight: true |
244 }); |
244 }); |
245 $("#type").jqxDropDownList('selectItem', 2); |
245 $('#type').jqxDropDownList('selectItem', 2); |
246 $("#type").on('select', function (event) { |
246 $('#type').on('select', function(event) { |
247 if (event.args) { |
247 if (event.args) { |
248 recipe_type = event.args.index; |
248 recipe_type = event.args.index; |
249 } |
249 } |
250 }); |
250 }); |
251 $("#boil_time").jqxNumberInput( PosInt ); |
251 $('#boil_time').jqxNumberInput(PosInt); |
252 $("#boil_time").jqxNumberInput({ min: 4, max: 360 }); |
252 $('#boil_time').jqxNumberInput({ min: 4, max: 360 }); |
253 $("#efficiency").jqxNumberInput( Perc0 ); |
253 $('#efficiency').jqxNumberInput(Perc0); |
254 $("#est_og").jqxNumberInput( SGopts ); |
254 $('#est_og').jqxNumberInput(SGopts); |
255 // Default values. |
255 // Default values. |
256 $("#boil_time").val(90); |
256 $('#boil_time').val(90); |
257 $("#efficiency").val(75); |
257 $('#efficiency').val(75); |
258 $("#est_og").val(1.052); |
258 $('#est_og').val(1.052); |
259 |
259 |
260 // Tab 2, Style |
260 // Tab 2, Style |
261 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); |
261 $('#st_name').jqxInput({ theme: theme, width: 250, height: 23 }); |
262 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); |
262 $('#st_category').jqxInput({ theme: theme, width: 250, height: 23 }); |
263 $("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 }); |
263 $('#st_category_number').jqxInput({ theme: theme, width: 70, height: 23 }); |
264 $("#st_style_letter").jqxInput({ theme: theme, width: 250, height: 23 }); |
264 $('#st_style_letter').jqxInput({ theme: theme, width: 250, height: 23 }); |
265 $("#st_style_guide").jqxInput({ theme: theme, width: 250, height: 23 }); |
265 $('#st_style_guide').jqxInput({ theme: theme, width: 250, height: 23 }); |
266 $("#st_notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
266 $('#st_notes').jqxInput({ theme: theme, width: 800, height: 100 }); |
267 $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); |
267 $('#st_type').jqxInput({ theme: theme, width: 250, height: 23 }); |
268 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
268 $('#st_og_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
269 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
269 $('#st_og_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
270 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
270 $('#st_fg_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
271 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
271 $('#st_fg_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
272 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
272 $('#st_ibu_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
273 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
273 $('#st_ibu_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
274 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
274 $('#st_color_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
275 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
275 $('#st_color_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
276 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
276 $('#st_carb_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
277 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
277 $('#st_carb_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
278 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
278 $('#st_abv_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
279 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
279 $('#st_abv_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
280 $("#st_profile").jqxInput({ theme: theme, width: 800, height: 48 }); |
280 $('#st_profile').jqxInput({ theme: theme, width: 800, height: 48 }); |
281 $("#st_ingredients").jqxInput({ theme: theme, width: 800, height: 23 }); |
281 $('#st_ingredients').jqxInput({ theme: theme, width: 800, height: 23 }); |
282 $("#st_examples").jqxInput({ theme: theme, width: 800, height: 48 }); |
282 $('#st_examples').jqxInput({ theme: theme, width: 800, height: 48 }); |
283 $("#styleSelect").jqxDropDownList({ |
283 $('#styleSelect').jqxDropDownList({ |
284 placeHolder: "Kies bierstijl:", |
284 placeHolder: 'Kies bierstijl:', |
285 theme: theme, |
285 theme: theme, |
286 source: styleslist, |
286 source: styleslist, |
287 displayMember: "name", |
287 displayMember: 'name', |
288 width: 250, |
288 width: 250, |
289 height: 27, |
289 height: 27, |
290 dropDownWidth: 500, |
290 dropDownWidth: 500, |
291 dropDownHeight: 500, |
291 dropDownHeight: 500, |
292 renderer: function (index, label, value) { |
292 renderer: function(index, label, value) { |
293 var datarecord = styleslist.records[index]; |
293 var datarecord = styleslist.records[index]; |
294 return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name; |
294 return datarecord.style_guide + ' ' + datarecord.style_letter + ' ' + datarecord.name; |
295 } |
295 } |
296 }); |
296 }); |
297 $("#styleSelect").on('select', function (event) { |
297 $('#styleSelect').on('select', function(event) { |
298 if (event.args) { |
298 if (event.args) { |
299 var datarecord, index = event.args.index; |
299 var datarecord, index = event.args.index; |
300 datarecord = styleslist.records[index]; |
300 datarecord = styleslist.records[index]; |
301 $("#st_name").val(datarecord.name); |
301 $('#st_name').val(datarecord.name); |
302 $("#st_category").val(datarecord.category); |
302 $('#st_category').val(datarecord.category); |
303 $("#st_category_number").val(datarecord.category_number); |
303 $('#st_category_number').val(datarecord.category_number); |
304 $("#st_style_letter").val(datarecord.style_letter); |
304 $('#st_style_letter').val(datarecord.style_letter); |
305 $("#st_style_guide").val(datarecord.style_guide); |
305 $('#st_style_guide').val(datarecord.style_guide); |
306 style_type = datarecord.type; |
306 style_type = datarecord.type; |
307 $("#st_type").val(StyleTypeData[datarecord.type].nl); |
307 $('#st_type').val(StyleTypeData[datarecord.type].nl); |
308 $("#st_og_min").val(datarecord.og_min); |
308 $('#st_og_min').val(datarecord.og_min); |
309 $("#st_og_max").val(datarecord.og_max); |
309 $('#st_og_max').val(datarecord.og_max); |
310 $("#st_fg_min").val(datarecord.fg_min); |
310 $('#st_fg_min').val(datarecord.fg_min); |
311 $("#st_fg_max").val(datarecord.fg_max); |
311 $('#st_fg_max').val(datarecord.fg_max); |
312 $("#st_ibu_min").val(datarecord.ibu_min); |
312 $('#st_ibu_min').val(datarecord.ibu_min); |
313 $("#st_ibu_max").val(datarecord.ibu_max); |
313 $('#st_ibu_max').val(datarecord.ibu_max); |
314 $("#st_color_min").val(datarecord.color_min); |
314 $('#st_color_min').val(datarecord.color_min); |
315 $("#st_color_max").val(datarecord.color_max); |
315 $('#st_color_max').val(datarecord.color_max); |
316 $("#st_carb_min").val(datarecord.carb_min); |
316 $('#st_carb_min').val(datarecord.carb_min); |
317 $("#st_carb_max").val(datarecord.carb_max); |
317 $('#st_carb_max').val(datarecord.carb_max); |
318 $("#st_abv_min").val(datarecord.abv_min); |
318 $('#st_abv_min').val(datarecord.abv_min); |
319 $("#st_abv_max").val(datarecord.abv_max); |
319 $('#st_abv_max').val(datarecord.abv_max); |
320 $("#st_notes").val(datarecord.notes); |
320 $('#st_notes').val(datarecord.notes); |
321 $("#st_profile").val(datarecord.profile); |
321 $('#st_profile').val(datarecord.profile); |
322 $("#st_ingredients").val(datarecord.ingredients); |
322 $('#st_ingredients').val(datarecord.ingredients); |
323 $("#st_examples").val(datarecord.examples); |
323 $('#st_examples').val(datarecord.examples); |
324 } |
324 } |
325 }); |
325 }); |
326 |
326 |
327 //Initializing the wizard |
327 //Initializing the wizard |
328 wizard.init(); |
328 wizard.init(); |
329 }); |
329 }); |
330 |
330 |