www/js/rec_new.js

Mon, 16 Sep 2019 17:26:38 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 16 Sep 2019 17:26:38 +0200
changeset 496
2465dbc90ea4
parent 472
cdcc7460b6ab
child 524
55a246085522
permissions
-rw-r--r--

Color templates for the prod_new and rec_new tab buttons.

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

mercurial