Sat, 01 Sep 2018 22:24:09 +0200
Next steps to implement a recipe editor
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * Copyright (C) 2018 |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of BMS |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * BrewCloud is distributed in the hope that it will be useful, but |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | function createDelElements() { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | $('#eventWindow').jqxWindow({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | theme: theme, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | position: { x: 490, y: 210 }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | width: 300, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | height: 175, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | resizable: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | isModal: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | modalOpacity: 0.4, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | okButton: $('#delOk'), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | cancelButton: $('#delCancel'), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | initContent: function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | $('#delOk').jqxButton({ width: '65px', theme: theme }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | $('#delCancel').jqxButton({ width: '65px', theme: theme }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | $('#delCancel').focus(); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | $('#eventWindow').jqxWindow('hide'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | $(document).ready(function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | var url = "includes/db_recipes.php"; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | // tooltips |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | $("#name").jqxTooltip({ content: 'De naam voor dit recept.' }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | $("#style_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | $("#type").jqxTooltip({ content: 'Het brouw type van dit recept.' }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | // prepare the data |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | var source = { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | datatype: "json", |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | cache: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | datafields: [ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | { name: 'record', type: 'number' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | { name: 'style_name', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | { name: 'style_letter', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | { name: 'style_guide', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | { name: 'name', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | { name: 'notes', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | { name: 'type', type: 'number' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | { name: 'batch_size', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | { name: 'boil_time', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | { name: 'efficiency', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | { name: 'est_og', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | { name: 'est_fg', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | { name: 'est_color', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | { name: 'color_method', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | { name: 'est_ibu', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | { name: 'ibu_method', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | { name: 'json_fermentables', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | { name: 'json_hops', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | { name: 'json_miscs', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | { name: 'json_yeasts', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | { name: 'json_waters', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | { name: 'json_mash', type: 'string' } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | ], |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | id: 'record', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | url: url, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | deleterow: function (rowid, commit) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | // synchronize with the server - send delete command |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | var data = "delete=true&" + $.param({ record: rowid }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | $.ajax({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | dataType: 'json', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | url: url, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
88 | cache: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | data: data, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | success: function (data, status, xhr) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | // delete command is executed. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | commit(true); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | error: function (jqXHR, textStatus, errorThrown) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | commit(false); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | addrow: function (rowid, rowdata, position, commit) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | var data = "insert=true&" + $.param(rowdata); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | $.ajax({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | dataType: 'json', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | url: url, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | cache: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | data: data, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | success: function (data, status, xhr) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | commit(true); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | error: function(jqXHR, textStatus, errorThrown) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | commit(false); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
111 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | updaterow: function (rowid, rowdata, commit) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | var data = "update=true&" + $.param(rowdata); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | $.ajax({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | dataType: 'json', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | url: url, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | cache: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | data: data, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
121 | success: function (data, status, xhr) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | // update command is executed. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | commit(true); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | error: function(jqXHR, textStatus, errorThrown) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
126 | commit(false); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
127 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
128 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
129 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
131 | var dataAdapter = new $.jqx.dataAdapter(source); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
132 | // Inline steps editor |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | /* var editsteps = function (data) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | var generaterow = function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | var row = {}; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | row["step_name"] = "Stap 1"; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | row["step_type"] = "Infusion"; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | row["step_temp"] = 62.0; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | row['step_time'] = 20.0; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | row['ramp_time'] = 1.0; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | row['end_temp'] = 62.0; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | return row; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | var stepSource = { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | localdata: data.steps, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | datatype: "local", |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | datafields: [ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | { name: 'step_name', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | { name: 'step_type', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
150 | { name: 'step_temp', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | { name: 'step_time', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | { name: 'ramp_time', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
153 | { name: 'end_temp', type: 'float' } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | ], |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | addrow: function (rowid, rowdata, position, commit) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | commit(true); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
157 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | deleterow: function (rowid, commit) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | commit(true); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
161 | }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
162 | var stepAdapter = new $.jqx.dataAdapter(stepSource); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
163 | $("#grid").jqxGrid({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
164 | width: 640, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
165 | height: 330, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
166 | source: stepAdapter, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
167 | theme: theme, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
168 | selectionmode: 'singlerow', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
169 | editmode: 'selectedrow', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
170 | editable: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
171 | showtoolbar: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
172 | rendertoolbar: function (toolbar) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
173 | var me = this; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
174 | var container = $("<div style='margin: 5px;'></div>"); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
175 | toolbar.append(container); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
176 | container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
177 | container.append('<input style="margin-left: 140px;" id="deleterowbutton" type="button" value="Verwijder stap" />'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
178 | $("#addrowbutton").jqxButton({ theme: theme, width: 150 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
179 | $("#deleterowbutton").jqxButton({ theme: theme, width: 150 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
180 | // create new row. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
181 | $("#addrowbutton").on('click', function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
182 | var datarow = generaterow(); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
183 | var commit = $("#grid").jqxGrid('addrow', null, datarow); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
184 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
185 | // delete row. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
186 | $("#deleterowbutton").on('click', function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
187 | var selectedrowindex = $("#grid").jqxGrid('getselectedrowindex'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
188 | var rowscount = $("#grid").jqxGrid('getdatainformation').rowscount; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
189 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
190 | var id = $("#grid").jqxGrid('getrowid', selectedrowindex); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
191 | var commit = $("#grid").jqxGrid('deleterow', id); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
192 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
193 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
194 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
195 | columns: [ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
196 | { text: 'Stap naam', datafield: 'step_name' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
197 | { text: 'Stap type', datafield: 'step_type', width: 100, columntype: 'dropdownlist', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
198 | createeditor: function (row, cellvalue, editor, celltext, cellwidth, cellheight) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
199 | var dataSource = [ "Infusion", "Temperature", "Decoction" ]; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
200 | editor.jqxDropDownList({ source: dataSource, dropDownHeight: 95 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
201 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
202 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
203 | { text: 'Temperatuur', datafield: 'step_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
204 | validation: function (cell, value) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
205 | if (value < 35 || value > 80) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
206 | return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
207 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
208 | return true; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
209 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
210 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
211 | { text: 'Eind', datafield: 'end_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
212 | validation: function (cell, value) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
213 | if (value < 35 || value > 80) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
214 | return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
215 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
216 | return true; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
217 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
218 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
219 | { text: 'Tijd', datafield: 'step_time', width: 70, align: 'right', cellsalign: 'right', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
220 | validation: function (cell, value) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
221 | if (value < 1 || value > 360) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
222 | return { result: false, message: "De tijd moet tussen 1 en 360 zijn." }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
223 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
224 | return true; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
225 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
226 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
227 | { text: 'Stap', datafield: 'ramp_time', width: 70, align: 'right', cellsalign: 'right', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
228 | validation: function (cell, value) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
229 | if (value < 1 || value > 60) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
230 | return { result: false, message: "De tijd moet tussen 1 en 60 zijn." }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
231 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
232 | return true; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
233 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
234 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
235 | ] |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
236 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
237 | $("#grid").on('cellendedit', function (event) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
238 | $('#grid').jqxGrid('sortby', 'step_temp', 'asc'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
239 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
240 | }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
241 | */ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
242 | // initialize the input fields. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
243 | var srcType = [ "All Grain", "Partial Mash", "Extract" ]; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
244 | var srcColor = [ "Morey", "Mosher", "Daniels" ]; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
245 | var srcIBU = [ "Tinseth", "Rager", "Garetz", "Daniels", "Mosher", "Noonan" ]; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
246 | $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
247 | $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
248 | $("#style_name").jqxInput({ theme: theme, width: 250, height: 23 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
249 | $("#style_letter").jqxInput({ theme: theme, width: 100, height: 23 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
250 | $("#style_guide").jqxInput({ theme: theme, width: 250, height: 23 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
251 | $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 125, height: 23, dropDownHeight: 95 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
252 | $("#batch_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: 'L', symbolPosition: 'right' }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
253 | $("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', template: "success", theme: theme, width: 100, height: 23, min: 4, max: 360, decimalDigits: 0, spinButtons: true }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
254 | $("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 40, max: 100, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
255 | $("#est_og").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 1, max: 1.9, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
256 | $("#est_fg").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, min: 0.980, max: 1.040, decimalDigits: 3, readOnly: true }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
257 | $("#est_color").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 1, max: 200, decimalDigits: 0, spinButtons: true }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
258 | $("#color_method").jqxDropDownList({ theme: theme, source: srcColor, width: 125, height: 23, dropDownHeight: 95 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
259 | $("#est_ibu").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 200, decimalDigits: 0, spinButtons: true }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
260 | $("#ibu_method").jqxDropDownList({ theme: theme, source: srcIBU, width: 125, height: 23, dropDownHeight: 180 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
261 | var editrow = -1; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
262 | // initialize jqxGrid |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
263 | $("#jqxgrid").jqxGrid({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
264 | width: 1280, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
265 | height: 630, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
266 | source: dataAdapter, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
267 | groupable: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
268 | theme: theme, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
269 | showstatusbar: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
270 | localization: getLocalization(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
271 | renderstatusbar: function (statusbar) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
272 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
273 | var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Add</span></div>"); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
274 | container.append(addButton); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
275 | statusbar.append(container); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
276 | addButton.jqxButton({ theme: theme, width: 120, height: 20 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
277 | // add new row. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
278 | addButton.click(function (event) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
279 | editrow = -1; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
280 | $("#popupWindow").jqxWindow({ position: { x: 40, y: 20 } }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
281 | $("#name").val(''); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
282 | $("#notes").val(''); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
283 | $("#style_name").val(''); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
284 | $("#style_letter").val(''); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
285 | $("#style_guide").val(''); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
286 | $("#type").val('All Grain'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
287 | $("#batch_size").val(20); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
288 | $("#boil_time").val(90); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
289 | $("#efficiency").val(75); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
290 | $("#est_og").val(1.062); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
291 | $("#est_fg").val(1.000); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
292 | $("#est_color").val(0); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
293 | $("#color_method").val('Morey'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
294 | $("#est_ibu").val(0); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
295 | $("#ibu_method").val('Tinseth'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
296 | // editsteps(''); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
297 | $("#popupWindow").jqxWindow('open'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
298 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
299 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
300 | filterable: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
301 | filtermode: 'excel', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
302 | columns: [ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
303 | { text: 'Stijlgids', datafield: 'style_guide', width: 120 }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
304 | { text: 'Letter', datafield: 'style_letter', width: 60 }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
305 | { text: 'Stijl', datafield: 'style_name', width: 150 }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
306 | { text: 'Naam', datafield: 'name' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
307 | { text: 'OG', datafield: 'est_og', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
308 | { text: 'EBC', datafield: 'est_color', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
309 | { text: 'IBU', datafield: 'est_ibu', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
310 | { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
311 | return "Wijzig"; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
312 | }, buttonclick: function (row) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
313 | // open the popup window when the user clicks a button. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
314 | editrow = row; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
315 | $("#popupWindow").jqxWindow({ position: { x: 40, y: 20 } }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
316 | // get the clicked row's data and initialize the input fields. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
317 | var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
318 | $("#name").val(dataRecord.name); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
319 | $("#notes").val(dataRecord.notes); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
320 | $("#style_name").val(dataRecord.style_name); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
321 | $("#style_letter").val(dataRecord.style_letter); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
322 | $("#style_guide").val(dataRecord.style_guide); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
323 | $("#type").val(dataRecord.type); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
324 | $("#batch_size").val(dataRecord.batch_size); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
325 | $("#boil_time").val(dataRecord.boil_time); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
326 | $("#efficiency").val(dataRecord.efficiency); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
327 | $("#est_og").val(dataRecord.est_og); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
328 | $("#est_fg").val(dataRecord.est_fg); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
329 | $("#est_color").val(dataRecord.est_color); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
330 | $("#color_method").val(dataRecord.color_method); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
331 | $("#est_ibu").val(dataRecord.est_ibu); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
332 | $("#ibu_method").val(dataRecord.ibu_method); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
333 | // editsteps(dataRecord); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
334 | // show the popup window. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
335 | $("#popupWindow").jqxWindow('open'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
336 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
337 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
338 | ], |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
339 | groups: ['style_guide','style_letter' ] |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
340 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
341 | |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
342 | // initialize the popup window and buttons. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
343 | $("#popupWindow").jqxWindow({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
344 | width: 1200, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
345 | height: 620, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
346 | resizable: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
347 | theme: theme, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
348 | isModal: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
349 | autoOpen: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
350 | cancelButton: $("#Cancel"), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
351 | modalOpacity: 0.40 |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
352 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
353 | |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
354 | // Tabs inside the popup window. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
355 | $('#jqxTabs').jqxTabs({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
356 | theme: theme, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
357 | autoHeight: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
358 | height: 580, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
359 | position: 'top' |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
360 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
361 | |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
362 | $("#popupWindow").on('open', function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
363 | $("#name").jqxInput('selectAll'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
364 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
365 | $("#Delete").jqxButton({ width: '90px', theme: theme }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
366 | $("#Delete").click(function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
367 | if (editrow >= 0) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
368 | // Open a popup to confirm this action. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
369 | $('#eventWindow').jqxWindow('open'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
370 | $("#delOk").click(function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
371 | var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
372 | $("#jqxgrid").jqxGrid('deleterow', rowID); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
373 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
374 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
375 | $("#popupWindow").jqxWindow('hide'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
376 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
377 | $("#Cancel").jqxButton({ width: '90px', theme: theme }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
378 | $("#Save").jqxButton({ width: '90px', theme: theme }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
379 | // update the edited row when the user clicks the 'Save' button. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
380 | $("#Save").click(function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
381 | // var steprows = $('#grid').jqxGrid('getrows'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
382 | if (editrow >= 0) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
383 | var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
384 | var row = { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
385 | record: rowID, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
386 | name: $("#name").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
387 | notes: $("#notes").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
388 | style_name: $('#style_name').val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
389 | style_letter: $('#style_letter').val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
390 | style_guide: $('#style_guide').val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
391 | type: $("#type").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
392 | batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
393 | boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
394 | efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
395 | est_og: parseFloat($("#est_og").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
396 | est_fg: parseFloat($("#est_fg").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
397 | est_color: parseFloat($("#est_color").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
398 | color_method: $("#color_method").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
399 | est_ibu: parseFloat($("#est_ibu").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
400 | ibu_method: $("#ibu_method").val() |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
401 | // steps: steprows |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
402 | }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
403 | $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
404 | $("#popupWindow").jqxWindow('hide'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
405 | } else { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
406 | // Insert a record |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
407 | var newrow = { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
408 | record: -1, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
409 | name: $("#name").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
410 | notes: $("#notes").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
411 | style_name: $('#style_name').val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
412 | style_letter: $('#style_letter').val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
413 | style_guide: $('#style_guide').val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
414 | type: $("#type").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
415 | batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
416 | boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
417 | efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
418 | est_og: parseFloat($("#est_og").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
419 | est_fg: parseFloat($("#est_fg").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
420 | est_color: parseFloat($("#est_color").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
421 | color_method: $("#color_method").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
422 | est_ibu: parseFloat($("#est_ibu").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
423 | ibu_method: $("#ibu_method").val() |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
424 | // steps: steprows |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
425 | }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
426 | $('#jqxgrid').jqxGrid('addrow', null, newrow); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
427 | $("#popupWindow").jqxWindow('hide'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
428 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
429 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
430 | createDelElements(); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
431 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
432 |