www/js/rec_new.js

Sat, 02 Feb 2019 14:57:41 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 02 Feb 2019 14:57:41 +0100
changeset 232
daf2d9d6fa18
parent 170
71850ebe5a1c
child 240
a85c1d4c4d12
permissions
-rw-r--r--

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.

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

mercurial