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 var style_type = 0; |
27 style_type = 0, |
28 |
|
29 // Tab 1, Base |
|
30 $("#name").jqxTooltip({ content: 'De naam voor dit recept.' }); |
|
31 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); |
|
32 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' }); |
|
33 $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); |
|
34 $("#type").jqxDropDownList({ |
|
35 theme: theme, |
|
36 source: RecipeTypeAdapter, |
|
37 valueMember: 'id', |
|
38 displayMember: 'nl', |
|
39 width: 180, |
|
40 height: 23, |
|
41 autoDropDownHeight: true |
|
42 }); |
|
43 $("#type").jqxDropDownList('selectItem', 2); |
|
44 $("#type").on('select', function (event) { |
|
45 if (event.args) { |
|
46 recipe_type = event.args.index; |
|
47 } |
|
48 }); |
|
49 $("#boil_time").jqxNumberInput( PosInt ); |
|
50 $("#boil_time").jqxNumberInput({ min: 4, max: 360 }); |
|
51 $("#efficiency").jqxNumberInput( Perc0 ); |
|
52 $("#est_og").jqxNumberInput( SGopts ); |
|
53 // Default values. |
|
54 $("#boil_time").val(90); |
|
55 $("#efficiency").val(75); |
|
56 $("#est_og").val(1.052); |
|
57 |
|
58 // Tab 2, Style |
|
59 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); |
|
60 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); |
|
61 $("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 }); |
|
62 $("#st_style_letter").jqxInput({ theme: theme, width: 250, height: 23 }); |
|
63 $("#st_style_guide").jqxInput({ theme: theme, width: 250, height: 23 }); |
|
64 $("#st_notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
|
65 $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); |
|
66 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
|
67 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
|
68 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
|
69 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
|
70 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
|
71 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
|
72 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
|
73 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
|
74 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
|
75 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
|
76 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
|
77 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
|
78 $("#st_profile").jqxInput({ theme: theme, width: 800, height: 48 }); |
|
79 $("#st_ingredients").jqxInput({ theme: theme, width: 800, height: 23 }); |
|
80 $("#st_examples").jqxInput({ theme: theme, width: 800, height: 48 }); |
|
81 |
|
82 $("#styleSelect").jqxDropDownList({ |
|
83 placeHolder: "Kies bierstijl:", |
|
84 theme: theme, |
|
85 source: styleslist, |
|
86 displayMember: "name", |
|
87 width: 250, |
|
88 height: 27, |
|
89 dropDownWidth: 500, |
|
90 dropDownHeight: 500, |
|
91 renderer: function (index, label, value) { |
|
92 var datarecord = styleslist.records[index]; |
|
93 return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name; |
|
94 } |
|
95 }); |
|
96 $("#styleSelect").on('select', function (event) { |
|
97 if (event.args) { |
|
98 var index = event.args.index; |
|
99 var datarecord = styleslist.records[index]; |
|
100 $("#st_name").val(datarecord.name); |
|
101 $("#st_category").val(datarecord.category); |
|
102 $("#st_category_number").val(datarecord.category_number); |
|
103 $("#st_style_letter").val(datarecord.style_letter); |
|
104 $("#st_style_guide").val(datarecord.style_guide); |
|
105 style_type = datarecord.type; |
|
106 $("#st_type").val(StyleTypeData[datarecord.type].nl); |
|
107 $("#st_og_min").val(datarecord.og_min); |
|
108 $("#st_og_max").val(datarecord.og_max); |
|
109 $("#st_fg_min").val(datarecord.fg_min); |
|
110 $("#st_fg_max").val(datarecord.fg_max); |
|
111 $("#st_ibu_min").val(datarecord.ibu_min); |
|
112 $("#st_ibu_max").val(datarecord.ibu_max); |
|
113 $("#st_color_min").val(datarecord.color_min); |
|
114 $("#st_color_max").val(datarecord.color_max); |
|
115 $("#st_carb_min").val(datarecord.carb_min); |
|
116 $("#st_carb_max").val(datarecord.carb_max); |
|
117 $("#st_abv_min").val(datarecord.abv_min); |
|
118 $("#st_abv_max").val(datarecord.abv_max); |
|
119 $("#st_notes").val(datarecord.notes); |
|
120 $("#st_profile").val(datarecord.profile); |
|
121 $("#st_ingredients").val(datarecord.ingredients); |
|
122 $("#st_examples").val(datarecord.examples); |
|
123 } |
|
124 }); |
|
125 |
28 |
126 //Creating wizard module |
29 //Creating wizard module |
127 var wizard = (function () { |
30 wizard = (function () { |
128 |
31 |
129 //Adding event listeners |
32 //Adding event listeners |
130 var _addHandlers = function () { |
33 var _addHandlers = function () { |
131 $('#name').on('change', function (event) { wizard.validate(true); }); |
34 $('#name').on('change', function (event) { wizard.validate(true); }); |
132 $('#type').on('change', function (event) { wizard.validate(true); }); |
35 $('#type').on('change', function (event) { wizard.validate(true); }); |
321 return true; |
224 return true; |
322 } |
225 } |
323 } |
226 } |
324 } ()); |
227 } ()); |
325 |
228 |
|
229 // Tab 1, Base |
|
230 $("#name").jqxTooltip({ content: 'De naam voor dit recept.' }); |
|
231 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); |
|
232 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' }); |
|
233 $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); |
|
234 $("#type").jqxDropDownList({ |
|
235 theme: theme, |
|
236 source: RecipeTypeAdapter, |
|
237 valueMember: 'id', |
|
238 displayMember: 'nl', |
|
239 width: 180, |
|
240 height: 23, |
|
241 autoDropDownHeight: true |
|
242 }); |
|
243 $("#type").jqxDropDownList('selectItem', 2); |
|
244 $("#type").on('select', function (event) { |
|
245 if (event.args) { |
|
246 recipe_type = event.args.index; |
|
247 } |
|
248 }); |
|
249 $("#boil_time").jqxNumberInput( PosInt ); |
|
250 $("#boil_time").jqxNumberInput({ min: 4, max: 360 }); |
|
251 $("#efficiency").jqxNumberInput( Perc0 ); |
|
252 $("#est_og").jqxNumberInput( SGopts ); |
|
253 // Default values. |
|
254 $("#boil_time").val(90); |
|
255 $("#efficiency").val(75); |
|
256 $("#est_og").val(1.052); |
|
257 |
|
258 // Tab 2, Style |
|
259 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); |
|
260 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); |
|
261 $("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 }); |
|
262 $("#st_style_letter").jqxInput({ theme: theme, width: 250, height: 23 }); |
|
263 $("#st_style_guide").jqxInput({ theme: theme, width: 250, height: 23 }); |
|
264 $("#st_notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
|
265 $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); |
|
266 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
|
267 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
|
268 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
|
269 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
|
270 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
|
271 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
|
272 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
|
273 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
|
274 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
|
275 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
|
276 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
|
277 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
|
278 $("#st_profile").jqxInput({ theme: theme, width: 800, height: 48 }); |
|
279 $("#st_ingredients").jqxInput({ theme: theme, width: 800, height: 23 }); |
|
280 $("#st_examples").jqxInput({ theme: theme, width: 800, height: 48 }); |
|
281 $("#styleSelect").jqxDropDownList({ |
|
282 placeHolder: "Kies bierstijl:", |
|
283 theme: theme, |
|
284 source: styleslist, |
|
285 displayMember: "name", |
|
286 width: 250, |
|
287 height: 27, |
|
288 dropDownWidth: 500, |
|
289 dropDownHeight: 500, |
|
290 renderer: function (index, label, value) { |
|
291 var datarecord = styleslist.records[index]; |
|
292 return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name; |
|
293 } |
|
294 }); |
|
295 $("#styleSelect").on('select', function (event) { |
|
296 if (event.args) { |
|
297 var datarecord, index = event.args.index; |
|
298 datarecord = styleslist.records[index]; |
|
299 $("#st_name").val(datarecord.name); |
|
300 $("#st_category").val(datarecord.category); |
|
301 $("#st_category_number").val(datarecord.category_number); |
|
302 $("#st_style_letter").val(datarecord.style_letter); |
|
303 $("#st_style_guide").val(datarecord.style_guide); |
|
304 style_type = datarecord.type; |
|
305 $("#st_type").val(StyleTypeData[datarecord.type].nl); |
|
306 $("#st_og_min").val(datarecord.og_min); |
|
307 $("#st_og_max").val(datarecord.og_max); |
|
308 $("#st_fg_min").val(datarecord.fg_min); |
|
309 $("#st_fg_max").val(datarecord.fg_max); |
|
310 $("#st_ibu_min").val(datarecord.ibu_min); |
|
311 $("#st_ibu_max").val(datarecord.ibu_max); |
|
312 $("#st_color_min").val(datarecord.color_min); |
|
313 $("#st_color_max").val(datarecord.color_max); |
|
314 $("#st_carb_min").val(datarecord.carb_min); |
|
315 $("#st_carb_max").val(datarecord.carb_max); |
|
316 $("#st_abv_min").val(datarecord.abv_min); |
|
317 $("#st_abv_max").val(datarecord.abv_max); |
|
318 $("#st_notes").val(datarecord.notes); |
|
319 $("#st_profile").val(datarecord.profile); |
|
320 $("#st_ingredients").val(datarecord.ingredients); |
|
321 $("#st_examples").val(datarecord.examples); |
|
322 } |
|
323 }); |
|
324 |
326 //Initializing the wizard |
325 //Initializing the wizard |
327 wizard.init(); |
326 wizard.init(); |
328 }); |
327 }); |
329 |
328 |