Sat, 22 Sep 2018 19:14:02 +0200
Added inline yeast 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.' }); |
51 | 50 | $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); |
50
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' }, |
51 | 58 | { name: 'st_name', type: 'string' }, |
59 | { name: 'st_letter', type: 'string' }, | |
60 | { name: 'st_guide', type: 'string' }, | |
61 | { name: 'st_og_min', type: 'float' }, | |
62 | { name: 'st_og_max', type: 'float' }, | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
63 | { name: 'st_fg_min', type: 'float' }, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
64 | { name: 'st_fg_max', type: 'float' }, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
65 | { name: 'st_ibu_min', type: 'float' }, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
66 | { name: 'st_ibu_max', type: 'float' }, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
67 | { name: 'st_color_min', type: 'float' }, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
68 | { name: 'st_color_max', type: 'float' }, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
69 | { name: 'st_carb_min', type: 'float' }, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
70 | { name: 'st_carb_max', type: 'float' }, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
71 | { name: 'st_abv_min', type: 'float' }, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
72 | { name: 'st_abv_max', type: 'float' }, |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | { name: 'name', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | { name: 'notes', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | { name: 'type', type: 'number' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | { name: 'batch_size', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | { name: 'boil_time', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | { name: 'efficiency', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | { name: 'est_og', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | { name: 'est_fg', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | { name: 'est_color', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | { name: 'color_method', type: 'string' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | { name: 'est_ibu', type: 'float' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | { name: 'ibu_method', type: 'string' }, |
51 | 85 | { name: 'mash_sparge_temp', type: 'float' }, |
86 | { name: 'mash_ph', type: 'float' }, | |
87 | { name: 'mash_name', type: 'string' }, | |
88 | { name: 'fermentables', type: 'string' }, | |
89 | { name: 'hops', type: 'string' }, | |
90 | { name: 'miscs', type: 'string' }, | |
91 | { name: 'yeasts', type: 'string' }, | |
92 | { name: 'waters', type: 'array' }, | |
93 | { name: 'mashs', type: 'string' } | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | ], |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | id: 'record', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | url: url, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | deleterow: function (rowid, commit) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | // synchronize with the server - send delete command |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | var data = "delete=true&" + $.param({ record: rowid }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | $.ajax({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | dataType: 'json', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | url: url, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | cache: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | data: data, |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
105 | type: "POST", |
50
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 | // delete command is executed. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | commit(true); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | error: function (jqXHR, textStatus, errorThrown) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
111 | commit(false); |
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 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | addrow: function (rowid, rowdata, position, commit) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | var data = "insert=true&" + $.param(rowdata); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | $.ajax({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | dataType: 'json', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | url: url, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | cache: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
121 | data: data, |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
122 | type: "POST", |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | success: function (data, status, xhr) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | commit(true); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
126 | error: function(jqXHR, textStatus, errorThrown) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
127 | commit(false); |
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 | updaterow: function (rowid, rowdata, commit) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
132 | var data = "update=true&" + $.param(rowdata); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | $.ajax({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | dataType: 'json', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | url: url, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | cache: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | data: data, |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
138 | type: "POST", |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | success: function (data, status, xhr) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | // update command is executed. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | commit(true); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | error: function(jqXHR, textStatus, errorThrown) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | commit(false); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | var dataAdapter = new $.jqx.dataAdapter(source); |
51 | 150 | |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
151 | // Inline fermentables editor |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
152 | var editFermentable = function (data) { |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
153 | var fermentableSource = { |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
154 | localdata: data.fermentables, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
155 | datatype: "local", |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
156 | datafields: [ |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
157 | { name: 'f_name', type: 'string' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
158 | { name: 'f_origin', type: 'string' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
159 | { name: 'f_supplier', type: 'string' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
160 | { name: 'f_amount', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
161 | { name: 'f_cost', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
162 | { name: 'f_type', type: 'string' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
163 | { name: 'f_yield', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
164 | { name: 'f_color', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
165 | { name: 'f_coarse_fine_diff', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
166 | { name: 'f_moisture', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
167 | { name: 'f_diastatic_power', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
168 | { name: 'f_protein', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
169 | { name: 'f_max_in_batch', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
170 | { name: 'f_graintype', type: 'string' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
171 | { name: 'f_added', type: 'string' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
172 | { name: 'f_dissolved_protein', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
173 | { name: 'f_recommend_mash', type: 'bool' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
174 | { name: 'f_add_after_boil', type: 'bool' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
175 | { name: 'f_adjust_to_total_100', type: 'bool' }, |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
176 | { name: 'f_percentage', type: 'float' }, |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
177 | { name: 'f_di_ph', type: 'float' } |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
178 | ], |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
179 | addrow: function (rowid, rowdata, position, commit) { |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
180 | commit(true); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
181 | }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
182 | deleterow: function (rowid, commit) { |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
183 | commit(true); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
184 | } |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
185 | }; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
186 | var fermentableAdapter = new $.jqx.dataAdapter(fermentableSource); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
187 | // dropdownlist datasource from inventory_fermentables |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
188 | var fermentableUrl = "getfermentablesources.php"; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
189 | var fermentableInvSource = { |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
190 | datatype: "json", |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
191 | datafields: [ |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
192 | { name: 'record', type: 'number' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
193 | { name: 'name', type: 'string' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
194 | { name: 'type', type: 'string' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
195 | { name: 'yield', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
196 | { name: 'color', type: 'float' }, |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
197 | { name: 'add_after_boil', type: 'bool' }, |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
198 | { name: 'origin', type: 'string' }, |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
199 | { name: 'supplier', type: 'string' }, |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
200 | { name: 'coarse_fine_diff', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
201 | { name: 'moisture', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
202 | { name: 'diastatic_power', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
203 | { name: 'protein', type: 'float' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
204 | { name: 'max_in_batch', type: 'float' }, |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
205 | { name: 'recommend_mash', type: 'bool' }, |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
206 | { name: 'graintype', type: 'string' }, |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
207 | { name: 'di_ph', type: 'float' }, |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
208 | { name: 'inventory', type: 'float' }, |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
209 | { name: 'cost', type: 'float' } |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
210 | ], |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
211 | url: fermentableUrl, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
212 | async: true |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
213 | }; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
214 | var fermentablelist = new $.jqx.dataAdapter(fermentableInvSource); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
215 | |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
216 | $("#fermentableGrid").jqxGrid({ |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
217 | width: 960, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
218 | height: 400, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
219 | source: fermentableAdapter, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
220 | theme: theme, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
221 | selectionmode: 'singlerow', |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
222 | editmode: 'selectedrow', |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
223 | editable: true, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
224 | localization: getLocalization(), |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
225 | showtoolbar: true, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
226 | rendertoolbar: function (toolbar) { |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
227 | var me = this; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
228 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
229 | toolbar.append(container); |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
230 | container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>'); |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
231 | container.append('<input style="float: left; margin-left: 230px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />'); |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
232 | // add fermentable from dropdownlist. |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
233 | $("#faddrowbutton").jqxDropDownList({ |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
234 | placeHolder: "Kies mout:", |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
235 | theme: theme, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
236 | source: fermentablelist, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
237 | displayMember: "name", |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
238 | width: 150, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
239 | height: 27, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
240 | dropDownWidth: 300 |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
241 | }); |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
242 | $("#faddrowbutton").on('select', function (event) { |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
243 | if (event.args) { |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
244 | var index = event.args.index; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
245 | var datarecord = fermentablelist.records[index]; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
246 | var row = {}; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
247 | row["f_name"] = datarecord.name; |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
248 | row["f_origin"] = datarecord.origin; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
249 | row["f_supplier"] = datarecord.supplier; |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
250 | row["f_amount"] = 0; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
251 | row["f_cost"] = datarecord.cost; |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
252 | row["f_type"] = datarecord.type; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
253 | row["f_yield"] = datarecord.yield; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
254 | row["f_color"] = datarecord.color; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
255 | row["f_coarse_fine_diff"] = datarecord.coarse_fine_diff; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
256 | row["f_moisture"] = datarecord.moisture; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
257 | row["f_diastatic_power"] = datarecord.diastatic_power; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
258 | row["f_protein"] = datarecord.protein; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
259 | row["f_max_in_batch"] = datarecord.max_in_batch; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
260 | row["f_graintype"] = datarecord.graintype; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
261 | if (datarecord.type == "Sugar") { |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
262 | row["f_added"] = "Boil"; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
263 | } else { |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
264 | row["f_added"] = "Mash"; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
265 | } |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
266 | row["f_dissolved_protein"] = 0; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
267 | row["f_recommend_mash"] = datarecord.recommend_mash; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
268 | row["f_add_after_boil"] = datarecord.add_after_boil; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
269 | row["f_adjust_to_total_100"] = 0; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
270 | row["f_percentage"] = 0; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
271 | row["f_di_ph"] = datarecord.di_ph; |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
272 | var commit = $("#fermentableGrid").jqxGrid('addrow', null, row); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
273 | } |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
274 | }); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
275 | |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
276 | // delete selected fermentable. |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
277 | // Precentage aanpassen basis mout. |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
278 | $("#fdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
279 | $("#fdeleterowbutton").on('click', function () { |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
280 | var selectedrowindex = $("#fermentableGrid").jqxGrid('getselectedrowindex'); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
281 | var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
282 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
283 | var id = $("#fermentableGrid").jqxGrid('getrowid', selectedrowindex); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
284 | var commit = $("#fermentableGrid").jqxGrid('deleterow', id); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
285 | } |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
286 | }); |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
287 | }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
288 | columns: [ |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
289 | { text: 'Mout/suiker', editable: false, datafield: 'f_name' }, |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
290 | { text: 'Type', editable: false, width: 100, datafield: 'f_type' }, |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
291 | { text: 'Opbrengst', datafield: 'f_yield', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
292 | { text: 'Gewicht', datafield: 'f_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
293 | columntype: 'numberinput', |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
294 | validation: function (cell, value) { |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
295 | if (value < 0 || value > 100000000000 ) { |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
296 | return { result: false, message: "Volume moet 0-~ zijn" }; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
297 | } |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
298 | return true; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
299 | } |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
300 | }, |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
301 | { text: 'Procent', datafield: 'f_percentage', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'p3', |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
302 | columntype: 'numberinput', |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
303 | validation: function (cell, value) { |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
304 | if (value < 0 || value > 100) { |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
305 | return { result: false, message: "Percentage moet 0-100 zijn" }; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
306 | } |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
307 | return true; |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
308 | } |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
309 | }, |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
310 | { text: '100%', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 80 } |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
311 | ] |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
312 | }) |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
313 | }; |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
314 | |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
315 | // Inline hops editor |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
316 | var editHop = function (data) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
317 | var hopSource = { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
318 | localdata: data.hops, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
319 | datatype: "local", |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
320 | cache: false, |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
321 | datafields: [ |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
322 | { name: 'h_name', type: 'string' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
323 | { name: 'h_origin', type: 'string' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
324 | { name: 'h_amount', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
325 | { name: 'h_cost', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
326 | { name: 'h_type', type: 'string' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
327 | { name: 'h_form', type: 'string' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
328 | { name: 'h_useat', type: 'string' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
329 | { name: 'h_time', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
330 | { name: 'h_alpha', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
331 | { name: 'h_beta', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
332 | { name: 'h_hsi', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
333 | { name: 'h_humulene', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
334 | { name: 'h_carophyllene', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
335 | { name: 'h_cohumulone', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
336 | { name: 'h_myrcene', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
337 | { name: 'h_total_oil', type: 'float' } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
338 | ], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
339 | addrow: function (rowid, rowdata, position, commit) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
340 | commit(true); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
341 | }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
342 | deleterow: function (rowid, commit) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
343 | commit(true); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
344 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
345 | }; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
346 | var hopAdapter = new $.jqx.dataAdapter(hopSource); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
347 | // dropdownlist datasource from inventory_hops |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
348 | var hopUrl = "gethopsources.php"; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
349 | var hopInvSource = { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
350 | datatype: "json", |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
351 | datafields: [ |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
352 | { name: 'record', type: 'number' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
353 | { name: 'name', type: 'string' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
354 | { name: 'origin', type: 'string' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
355 | { name: 'type', type: 'string' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
356 | { name: 'alpha', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
357 | { name: 'beta', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
358 | { name: 'humulene', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
359 | { name: 'caryophyllene', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
360 | { name: 'cohumulone', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
361 | { name: 'myrcene', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
362 | { name: 'hsi', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
363 | { name: 'useat', type: 'string' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
364 | { name: 'form', type: 'string' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
365 | { name: 'total_oil', type: 'float' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
366 | { name: 'cost', type: 'float' } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
367 | ], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
368 | url: hopUrl, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
369 | async: true |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
370 | }; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
371 | var hoplist = new $.jqx.dataAdapter(hopInvSource); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
372 | |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
373 | $("#hopGrid").jqxGrid({ |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
374 | width: 960, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
375 | height: 400, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
376 | source: hopAdapter, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
377 | theme: theme, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
378 | selectionmode: 'singlerow', |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
379 | editmode: 'selectedrow', |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
380 | editable: true, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
381 | localization: getLocalization(), |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
382 | showtoolbar: true, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
383 | rendertoolbar: function (toolbar) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
384 | var me = this; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
385 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
386 | toolbar.append(container); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
387 | container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
388 | container.append('<input style="float: left; margin-left: 230px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />'); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
389 | // add hop from dropdownlist. |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
390 | $("#haddrowbutton").jqxDropDownList({ |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
391 | placeHolder: "Kies hop:", |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
392 | theme: theme, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
393 | source: hoplist, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
394 | displayMember: "name", |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
395 | width: 150, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
396 | height: 27, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
397 | dropDownWidth: 300 |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
398 | }); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
399 | $("#haddrowbutton").on('select', function (event) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
400 | if (event.args) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
401 | var index = event.args.index; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
402 | var datarecord = hoplist.records[index]; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
403 | var row = {}; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
404 | row["h_name"] = datarecord.name; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
405 | row["h_origin"] = datarecord.origin; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
406 | row["h_amount"] = 0; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
407 | row["h_cost"] = datarecord.cost; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
408 | row["h_type"] = datarecord.type; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
409 | row["h_form"] = datarecord.form; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
410 | row["h_useat"] = datarecord.useat; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
411 | row["h_time"] = 0; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
412 | row["h_alpha"] = datarecord.alpha; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
413 | row["h_beta"] = datarecord.beta; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
414 | row["h_hsi"] = datarecord.hsi; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
415 | row["h_humulene"] = datarecord.humulene; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
416 | row["h_carophyllene"] = datarecord.carophyllene; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
417 | row["h_cohumulone"] = datarecord.cohumulone; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
418 | row["h_myrcene"] = datarecord.myrcene; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
419 | row["h_total_oil"] = datarecord.total_oil; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
420 | var commit = $("#hopGrid").jqxGrid('addrow', null, row); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
421 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
422 | }); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
423 | |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
424 | // delete selected hop. |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
425 | $("#hdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
426 | $("#hdeleterowbutton").on('click', function () { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
427 | var selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex'); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
428 | var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
429 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
430 | var id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
431 | var commit = $("#hopGrid").jqxGrid('deleterow', id); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
432 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
433 | }); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
434 | }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
435 | columns: [ |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
436 | { text: 'Hop', editable: false, datafield: 'h_name' }, |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
437 | { text: 'Type', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_type' }, |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
438 | { text: 'Vorm', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_form' }, |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
439 | { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
440 | { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
441 | columntype: 'numberinput', |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
442 | validation: function (cell, value) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
443 | if (value < 0 || value > 100000000000 ) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
444 | return { result: false, message: "Volume moet 0-~ zijn" }; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
445 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
446 | return true; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
447 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
448 | }, |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
449 | { text: 'Gebruik', width: 110, align: 'center', cellsalign: 'center', datafield: 'h_useat' }, |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
450 | { text: 'Tijd', datafield: 'h_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
451 | columntype: 'numberinput', |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
452 | validation: function (cell, value) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
453 | if (value < 0 || value > 100000000000 ) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
454 | return { result: false, message: "De tijd moet 0-~ zijn" }; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
455 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
456 | return true; |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
457 | } // TODO: Only enable editing if Boil, else use fixed values. |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
458 | }, |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
459 | { text: 'IBU', editable: false, datafield: 'ibu', width: 80, align: 'right', |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
460 | cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
461 | var ibu = toIBU(rowdata.h_useat, |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
462 | rowdata.h_form, |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
463 | parseFloat($("#est_og").jqxNumberInput('decimal')), |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
464 | parseFloat($("#batch_size").jqxNumberInput('decimal')), |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
465 | parseFloat(rowdata.h_amount), |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
466 | parseFloat(rowdata.h_time), |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
467 | parseFloat(rowdata.h_alpha), |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
468 | $("#ibu_method").val() |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
469 | ); |
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
470 | return "<div style='margin: 4px;' class='jqx-right-align'>" + dataAdapter.formatNumber(ibu, "f1") + "</div>"; |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
471 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
472 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
473 | ] |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
474 | }) |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
475 | }; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
476 | |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
477 | // Inline miscs editor |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
478 | var editMisc = function (data) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
479 | var miscSource = { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
480 | localdata: data.miscs, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
481 | datatype: "local", |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
482 | cache: false, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
483 | datafields: [ |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
484 | { name: 'm_name', type: 'string' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
485 | { name: 'm_amount', type: 'float' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
486 | { name: 'm_cost', type: 'float' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
487 | { name: 'm_type', type: 'string' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
488 | { name: 'm_use_use', type: 'string' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
489 | { name: 'm_time', type: 'float' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
490 | { name: 'm_amount_is_weight', type: 'bool' } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
491 | ], |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
492 | addrow: function (rowid, rowdata, position, commit) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
493 | commit(true); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
494 | }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
495 | deleterow: function (rowid, commit) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
496 | commit(true); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
497 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
498 | }; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
499 | var miscAdapter = new $.jqx.dataAdapter(miscSource); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
500 | // dropdownlist datasource from inventory_miscs |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
501 | var miscUrl = "getmiscsources.php"; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
502 | var miscInvSource = { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
503 | datatype: "json", |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
504 | datafields: [ |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
505 | { name: 'record', type: 'number' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
506 | { name: 'name', type: 'string' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
507 | { name: 'type', type: 'string' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
508 | { name: 'use_use', type: 'string' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
509 | { name: 'amount_is_weight', type: 'bool' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
510 | { name: 'time', type: 'float' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
511 | { name: 'cost', type: 'float' } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
512 | ], |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
513 | url: miscUrl, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
514 | async: true |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
515 | }; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
516 | var misclist = new $.jqx.dataAdapter(miscInvSource); |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
517 | |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
518 | $("#miscGrid").jqxGrid({ |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
519 | width: 960, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
520 | height: 400, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
521 | source: miscAdapter, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
522 | theme: theme, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
523 | selectionmode: 'singlerow', |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
524 | editmode: 'selectedrow', |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
525 | editable: true, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
526 | localization: getLocalization(), |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
527 | showtoolbar: true, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
528 | rendertoolbar: function (toolbar) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
529 | var me = this; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
530 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
531 | toolbar.append(container); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
532 | container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>'); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
533 | container.append('<input style="float: left; margin-left: 230px;" id="mdeleterowbutton" type="button" value="Verwijder ingredient" />'); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
534 | // add misc from dropdownlist. |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
535 | $("#maddrowbutton").jqxDropDownList({ |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
536 | placeHolder: "Kies ingredient:", |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
537 | theme: theme, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
538 | source: misclist, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
539 | displayMember: "name", |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
540 | width: 150, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
541 | height: 27, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
542 | dropDownWidth: 300 |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
543 | }); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
544 | $("#maddrowbutton").on('select', function (event) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
545 | if (event.args) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
546 | var index = event.args.index; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
547 | var datarecord = misclist.records[index]; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
548 | var row = {}; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
549 | row["m_name"] = datarecord.name; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
550 | row["m_amount"] = 0; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
551 | row["m_cost"] = datarecord.cost; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
552 | row["m_type"] = datarecord.type; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
553 | row["m_use_use"] = datarecord.use_use; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
554 | row["m_time"] = 0; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
555 | row["m_amount_is_weight"] = datarecord.amount_is_weight; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
556 | var commit = $("#miscGrid").jqxGrid('addrow', null, row); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
557 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
558 | }); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
559 | // delete selected misc. |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
560 | $("#mdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
561 | $("#mdeleterowbutton").on('click', function () { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
562 | var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex'); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
563 | var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
564 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
565 | var id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
566 | var commit = $("#miscGrid").jqxGrid('deleterow', id); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
567 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
568 | }); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
569 | }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
570 | columns: [ |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
571 | { text: 'Ingredient', editable: false, datafield: 'm_name' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
572 | { text: 'Type', editable: false, width: 120, align: 'center', cellsalign: 'center', datafield: 'm_type' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
573 | { text: 'Gebruik', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'm_use_use' }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
574 | { text: 'Gewicht', datafield: 'm_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f5', |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
575 | columntype: 'numberinput', |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
576 | validation: function (cell, value) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
577 | if (value < 0 || value > 100000000000 ) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
578 | return { result: false, message: "Volume moet 0-~ zijn" }; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
579 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
580 | return true; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
581 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
582 | }, |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
583 | { text: 'Tijd', datafield: 'm_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
584 | columntype: 'numberinput', |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
585 | validation: function (cell, value) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
586 | if (value < 0 || value > 100000000000 ) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
587 | return { result: false, message: "De tijd moet 0-~ zijn" }; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
588 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
589 | return true; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
590 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
591 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
592 | ] |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
593 | }) |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
594 | }; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
595 | |
61 | 596 | // Inline yeasts editor |
597 | var editYeast = function (data) { | |
598 | var yeastSource = { | |
599 | localdata: data.yeasts, | |
600 | datatype: "local", | |
601 | cache: false, | |
602 | datafields: [ | |
603 | { name: 'y_name', type: 'string' }, | |
604 | { name: 'y_laboratory', type: 'string' }, | |
605 | { name: 'y_product_id', type: 'string' }, | |
606 | { name: 'y_amount', type: 'float' }, | |
607 | { name: 'y_cost', type: 'float' }, | |
608 | { name: 'y_type', type: 'string' }, | |
609 | { name: 'y_form', type: 'string' }, | |
610 | { name: 'y_time', type: 'float' }, | |
611 | { name: 'y_min_temperature', type: 'float' }, | |
612 | { name: 'y_max_temperature', type: 'float' }, | |
613 | { name: 'y_attenuation', type: 'float' }, | |
614 | { name: 'y_amount_is_weight', type: 'bool' }, | |
615 | { name: 'y_use', type: 'string' } | |
616 | ], | |
617 | addrow: function (rowid, rowdata, position, commit) { | |
618 | commit(true); | |
619 | }, | |
620 | deleterow: function (rowid, commit) { | |
621 | commit(true); | |
622 | } | |
623 | }; | |
624 | var yeastAdapter = new $.jqx.dataAdapter(yeastSource); | |
625 | // dropdownlist datasource from inventory_yeasts | |
626 | var yeastUrl = "getyeastsources.php"; | |
627 | var yeastInvSource = { | |
628 | datatype: "json", | |
629 | datafields: [ | |
630 | { name: 'record', type: 'number' }, | |
631 | { name: 'name', type: 'string' }, | |
632 | { name: 'type', type: 'string' }, | |
633 | { name: 'form', type: 'string' }, | |
634 | { name: 'laboratory', type: 'string' }, | |
635 | { name: 'product_id', type: 'string' }, | |
636 | { name: 'min_temperature', type: 'float' }, | |
637 | { name: 'max_temperature', type: 'float' }, | |
638 | { name: 'attenuation', type: 'float' }, | |
639 | { name: 'cost', type: 'float' } | |
640 | ], | |
641 | url: yeastUrl, | |
642 | async: true | |
643 | }; | |
644 | var yeastlist = new $.jqx.dataAdapter(yeastInvSource); | |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
645 | |
61 | 646 | $("#yeastGrid").jqxGrid({ |
647 | width: 1050, | |
648 | height: 300, | |
649 | source: yeastAdapter, | |
650 | theme: theme, | |
651 | selectionmode: 'singlerow', | |
652 | editmode: 'selectedrow', | |
653 | editable: true, | |
654 | localization: getLocalization(), | |
655 | showtoolbar: true, | |
656 | rendertoolbar: function (toolbar) { | |
657 | var me = this; | |
658 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
659 | toolbar.append(container); | |
660 | container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>'); | |
661 | container.append('<input style="float: left; margin-left: 230px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />'); | |
662 | // add yeast from dropdownlist. | |
663 | $("#yaddrowbutton").jqxDropDownList({ | |
664 | placeHolder: "Kies gist:", | |
665 | theme: theme, | |
666 | source: yeastlist, | |
667 | displayMember: "name", | |
668 | width: 150, | |
669 | height: 27, | |
670 | dropDownWidth: 300 | |
671 | }); | |
672 | $("#yaddrowbutton").on('select', function (event) { | |
673 | if (event.args) { | |
674 | var index = event.args.index; | |
675 | var datarecord = yeastlist.records[index]; | |
676 | var row = {}; | |
677 | row["y_name"] = datarecord.name; | |
678 | row["y_laboratory"] = datarecord.laboratory; | |
679 | row["y_product_id"] = datarecord.product_id; | |
680 | row["y_type"] = datarecord.type; | |
681 | row["y_form"] = datarecord.form; | |
682 | row["y_amount"] = 0; | |
683 | row["y_cost"] = datarecord.cost; | |
684 | row["y_use"] = "Primary"; | |
685 | row["y_time"] = 0; | |
686 | if (datarecord.form == "Dry") { | |
687 | row["y_amount_is_weight"] = 1; | |
688 | } else { | |
689 | row["y_amount_is_weight"] = 0; | |
690 | } | |
691 | row["y_min_temperature"] = datarecord.min_temperature; | |
692 | row["y_max_temperature"] = datarecord.max_temperature; | |
693 | row["y_attenuation"] = datarecord.attenuation; | |
694 | var commit = $("#yeastGrid").jqxGrid('addrow', null, row); | |
695 | } | |
696 | }); | |
697 | // delete selected yeast. | |
698 | $("#ydeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); | |
699 | $("#ydeleterowbutton").on('click', function () { | |
700 | var selectedrowindex = $("#yeastGrid").jqxGrid('getselectedrowindex'); | |
701 | var rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount; | |
702 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
703 | var id = $("#yeastGrid").jqxGrid('getrowid', selectedrowindex); | |
704 | var commit = $("#yeastGrid").jqxGrid('deleterow', id); | |
705 | } | |
706 | }); | |
707 | }, | |
708 | columns: [ | |
709 | { text: 'Gist', editable: false, datafield: 'y_name' }, | |
710 | { text: 'Laboratorium', editable: false, width: 150, datafield: 'y_laboratory' }, | |
711 | { text: 'Code', editable: false, width: 90, datafield: 'y_product_id' }, | |
712 | { text: 'Soort', editable: false, width: 80, align: 'center', cellsalign: 'center', datafield: 'y_form' }, | |
713 | { text: 'Min.', editable: false, width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' }, | |
714 | { text: 'Max.', editable: false, width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' }, | |
715 | { text: 'Attn.', editable: false, width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' }, | |
716 | { text: 'Voor', editable: false, width: 80, align: 'center', cellsalign: 'center', datafield: 'y_use' }, | |
717 | { text: 'Hoeveel', datafield: 'y_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f5', | |
718 | columntype: 'numberinput', | |
719 | validation: function (cell, value) { | |
720 | if (value < 0 || value > 100000000000 ) { | |
721 | return { result: false, message: "Volume moet 0-~ zijn" }; | |
722 | } | |
723 | return true; | |
724 | } | |
725 | } | |
726 | ] | |
727 | }) | |
728 | }; | |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
729 | |
51 | 730 | // Inline waters editor |
731 | var editWater = function (data) { | |
732 | var waterSource = { | |
733 | localdata: data.waters, | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
734 | datatype: "local", |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
735 | datafields: [ |
51 | 736 | { name: 'w_name', type: 'string' }, |
737 | { name: 'w_amount', type: 'float' }, | |
738 | { name: 'w_calcium', type: 'float' }, | |
739 | { name: 'w_sulfate', type: 'float' }, | |
740 | { name: 'w_chloride', type: 'float' }, | |
741 | { name: 'w_sodium', type: 'float' }, | |
742 | { name: 'w_magnesium', type: 'float' }, | |
743 | { name: 'w_ph', type: 'float' }, | |
744 | { name: 'w_total_alkalinity', type: 'float' }, | |
745 | { name: 'w_cost', type: 'float' }, | |
746 | { name: 'w_default_water', type: 'bool' } | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
747 | ], |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
748 | addrow: function (rowid, rowdata, position, commit) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
749 | commit(true); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
750 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
751 | deleterow: function (rowid, commit) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
752 | commit(true); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
753 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
754 | }; |
51 | 755 | var waterAdapter = new $.jqx.dataAdapter(waterSource); |
55
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
756 | // dropdownlist datasource from inventory_waters |
54
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
757 | var waterUrl = "getwatersources.php"; |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
758 | var waterInvSource = { |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
759 | datatype: "json", |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
760 | datafields: [ |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
761 | { name: 'record', type: 'number' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
762 | { name: 'name', type: 'string' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
763 | { name: 'unlimited_stock', type: 'bool' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
764 | { name: 'calcium', type: 'float' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
765 | { name: 'sulfate', type: 'float' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
766 | { name: 'chloride', type: 'float' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
767 | { name: 'sodium', type: 'float' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
768 | { name: 'magnesium', type: 'float' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
769 | { name: 'ph', type: 'float' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
770 | { name: 'total_alkalinity', type: 'float' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
771 | { name: 'cost', type: 'float' }, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
772 | { name: 'default_water', type: 'bool' } |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
773 | ], |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
774 | url: waterUrl, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
775 | async: true |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
776 | }; |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
777 | var waterlist = new $.jqx.dataAdapter(waterInvSource); |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
778 | |
51 | 779 | $("#waterGrid").jqxGrid({ |
780 | width: 960, | |
781 | height: 200, | |
782 | source: waterAdapter, | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
783 | theme: theme, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
784 | selectionmode: 'singlerow', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
785 | editmode: 'selectedrow', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
786 | editable: true, |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
787 | localization: getLocalization(), |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
788 | showtoolbar: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
789 | rendertoolbar: function (toolbar) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
790 | var me = this; |
55
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
791 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
792 | toolbar.append(container); |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
793 | container.append('<div style="float: left; margin-left: 165px;" id="waddrowbutton"></div>'); |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
794 | container.append('<input style="float: left; margin-left: 230px;" id="wdeleterowbutton" type="button" value="Verwijder water" />'); |
55
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
795 | // add water from dropdownlist. |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
796 | $("#waddrowbutton").jqxDropDownList({ |
54
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
797 | placeHolder: "Kies water:", |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
798 | theme: theme, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
799 | source: waterlist, |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
800 | displayMember: "name", |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
801 | width: 150, |
55
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
802 | height: 27, |
54
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
803 | dropDownWidth: 300 |
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
804 | }); |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
805 | $("#waddrowbutton").on('select', function (event) { |
55
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
806 | if (event.args) { |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
807 | var index = event.args.index; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
808 | var datarecord = waterlist.records[index]; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
809 | var row = {}; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
810 | row["w_name"] = datarecord.name; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
811 | row["w_amount"] = 0; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
812 | row["w_calcium"] = datarecord.calcium; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
813 | row["w_sulfate"] = datarecord.sulfate; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
814 | row["w_chloride"] = datarecord.chloride; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
815 | row["w_sodium"] = datarecord.sodium; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
816 | row["w_magnesium"] = datarecord.magnesium; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
817 | row["w_ph"] = datarecord.ph; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
818 | row["w_total_alkalinity"] = datarecord.total_alkalinity; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
819 | row["w_default_water"] = datarecord.default_water; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
820 | row["w_cost"] = datarecord.cost; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
821 | var commit = $("#waterGrid").jqxGrid('addrow', null, row); |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
822 | } |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
823 | }); |
54
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
824 | |
55
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
825 | // delete selected water. |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
826 | // Overgebleven waters in volume verhogen met het verwijderde water. |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
827 | $("#wdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
828 | $("#wdeleterowbutton").on('click', function () { |
55
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
829 | var selectedrowindex = $("#waterGrid").jqxGrid('getselectedrowindex'); |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
830 | var rowscount = $("#waterGrid").jqxGrid('getdatainformation').rowscount; |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
831 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
832 | var id = $("#waterGrid").jqxGrid('getrowid', selectedrowindex); |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
833 | var commit = $("#waterGrid").jqxGrid('deleterow', id); |
3e29755638b6
Add and delete water completed.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
834 | } |
54
294dda7f1779
Beginning of water totals and selecting
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
835 | }); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
836 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
837 | columns: [ |
51 | 838 | { text: 'Water bron', editable: false, datafield: 'w_name' }, |
839 | { text: 'Volume', datafield: 'w_amount', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', | |
840 | columntype: 'numberinput', | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
841 | validation: function (cell, value) { |
51 | 842 | if (value < 0 || value > 100000000000 ) { |
843 | return { result: false, message: "Volume moet 0-~ zijn" }; | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
844 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
845 | return true; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
846 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
847 | }, |
51 | 848 | // TODO: validator test max is hoeveelheid maischwater. Dan water verdelen voor totaal. |
849 | { text: 'Ca', editable: false, datafield: 'w_calcium', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
850 | { text: 'Mg', editable: false, datafield: 'w_magnesium', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
851 | { text: 'Na', editable: false, datafield: 'w_sodium', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
852 | { text: 'Tot Alk', editable: false, datafield: 'w_total_alkalinity', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
853 | { text: 'CaSO4', editable: false, datafield: 'w_sulfate', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
854 | { text: 'Cl', editable: false, datafield: 'w_chloride', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
855 | { text: 'pH', editable: false, datafield: 'w_ph', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' } | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
856 | ] |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
857 | }); |
51 | 858 | }; // editWater = function (data) { |
859 | ||
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
860 | // inline mash editor |
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
861 | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
862 | // initialize the input fields. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
863 | var srcType = [ "All Grain", "Partial Mash", "Extract" ]; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
864 | var srcColor = [ "Morey", "Mosher", "Daniels" ]; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
865 | var srcIBU = [ "Tinseth", "Rager", "Garetz", "Daniels", "Mosher", "Noonan" ]; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
866 | $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
867 | $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); |
51 | 868 | $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); |
869 | $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 }); | |
870 | $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 }); | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
871 | $("#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
|
872 | $("#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
|
873 | $("#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
|
874 | $("#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
|
875 | $("#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 }); |
51 | 876 | $("#st_og_min").jqxNumberInput({ disabled: true, inputMode: 'simple', width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
877 | $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
878 | $("#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
|
879 | $("#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
|
880 | $("#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
|
881 | $("#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
|
882 | $("#ibu_method").jqxDropDownList({ theme: theme, source: srcIBU, width: 125, height: 23, dropDownHeight: 180 }); |
51 | 883 | $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
884 | $("#mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 8, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
885 | $("#mash_sparge_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 70, max: 98, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
886 | var editrow = -1; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
887 | // initialize jqxGrid |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
888 | $("#jqxgrid").jqxGrid({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
889 | width: 1280, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
890 | height: 630, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
891 | source: dataAdapter, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
892 | groupable: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
893 | theme: theme, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
894 | showstatusbar: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
895 | localization: getLocalization(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
896 | renderstatusbar: function (statusbar) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
897 | 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
|
898 | 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
|
899 | container.append(addButton); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
900 | statusbar.append(container); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
901 | addButton.jqxButton({ theme: theme, width: 120, height: 20 }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
902 | // add new row. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
903 | addButton.click(function (event) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
904 | editrow = -1; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
905 | $("#popupWindow").jqxWindow({ position: { x: 40, y: 20 } }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
906 | $("#name").val(''); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
907 | $("#notes").val(''); |
51 | 908 | $("#st_name").val(''); |
909 | $("#st_letter").val(''); | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
910 | $("#st_guide").val('BKG 2015'); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
911 | $("#type").val('All Grain'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
912 | $("#batch_size").val(20); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
913 | $("#boil_time").val(90); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
914 | $("#efficiency").val(75); |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
915 | $("#est_og").val(1.052); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
916 | $("#est_fg").val(1.000); |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
917 | $("#est_color").val(20); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
918 | $("#color_method").val('Morey'); |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
919 | $("#est_ibu").val(40); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
920 | $("#ibu_method").val('Tinseth'); |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
921 | $("#mash_sparge_temp").val(78); |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
922 | $("#mash_ph").val(5.4); |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
923 | $("#mash_name").val(''); |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
924 | editFermentable(''); |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
925 | editHop(''); |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
926 | editMisc(''); |
61 | 927 | editYeast(''); |
51 | 928 | editWater(''); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
929 | $("#popupWindow").jqxWindow('open'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
930 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
931 | }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
932 | filterable: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
933 | filtermode: 'excel', |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
934 | columns: [ |
51 | 935 | { text: 'Stijlgids', datafield: 'st_guide', width: 120 }, |
936 | { text: 'Letter', datafield: 'st_letter', width: 60 }, | |
937 | { text: 'Stijl', datafield: 'st_name', width: 150 }, | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
938 | { text: 'Naam', datafield: 'name' }, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
939 | { 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
|
940 | { 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
|
941 | { 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
|
942 | { 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
|
943 | return "Wijzig"; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
944 | }, buttonclick: function (row) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
945 | // 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
|
946 | editrow = row; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
947 | $("#popupWindow").jqxWindow({ position: { x: 40, y: 20 } }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
948 | // 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
|
949 | var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
950 | $("#name").val(dataRecord.name); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
951 | $("#notes").val(dataRecord.notes); |
51 | 952 | $("#st_name").val(dataRecord.st_name); |
953 | $("#st_letter").val(dataRecord.st_letter); | |
954 | $("#st_guide").val(dataRecord.st_guide); | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
955 | $("#type").val(dataRecord.type); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
956 | $("#batch_size").val(dataRecord.batch_size); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
957 | $("#boil_time").val(dataRecord.boil_time); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
958 | $("#efficiency").val(dataRecord.efficiency); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
959 | $("#est_og").val(dataRecord.est_og); |
51 | 960 | $("#st_og_min").val(dataRecord.st_og_min); |
961 | $("#st_og_max").val(dataRecord.st_og_max); | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
962 | $("#est_fg").val(dataRecord.est_fg); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
963 | $("#est_color").val(dataRecord.est_color); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
964 | $("#color_method").val(dataRecord.color_method); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
965 | $("#est_ibu").val(dataRecord.est_ibu); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
966 | $("#ibu_method").val(dataRecord.ibu_method); |
51 | 967 | $("#mash_name").val(dataRecord.mash_name); |
968 | $("#mash_ph").val(dataRecord.mash_ph); | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
969 | $("#mash_sparge_temp").val(dataRecord.mash_sparge_temp); |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
970 | editFermentable(dataRecord); |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
971 | editHop(dataRecord); |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
972 | editMisc(dataRecord); |
61 | 973 | editYeast(dataRecord); |
51 | 974 | editWater(dataRecord); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
975 | // show the popup window. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
976 | $("#popupWindow").jqxWindow('open'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
977 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
978 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
979 | ], |
51 | 980 | groups: ['st_guide','st_letter' ] |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
981 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
982 | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
983 | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
984 | // initialize the popup window and buttons. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
985 | $("#popupWindow").jqxWindow({ |
53 | 986 | width: 1202, |
987 | height: 622, | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
988 | resizable: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
989 | theme: theme, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
990 | isModal: true, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
991 | autoOpen: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
992 | cancelButton: $("#Cancel"), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
993 | modalOpacity: 0.40 |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
994 | }); |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
995 | $("#popupWindow").on('open', function () { |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
996 | $("#name").jqxInput('selectAll'); |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
997 | }); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
998 | |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
999 | // Tabs inside the popup window. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1000 | $('#jqxTabs').jqxTabs({ |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1001 | theme: theme, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1002 | autoHeight: false, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1003 | height: 580, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1004 | position: 'top' |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1005 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1006 | |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1007 | $("#Delete").jqxButton({ width: '90px', theme: theme }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1008 | $("#Delete").click(function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1009 | if (editrow >= 0) { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1010 | // Open a popup to confirm this action. |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1011 | $('#eventWindow').jqxWindow('open'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1012 | $("#delOk").click(function () { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1013 | var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1014 | $("#jqxgrid").jqxGrid('deleterow', rowID); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1015 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1016 | } |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1017 | $("#popupWindow").jqxWindow('hide'); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1018 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1019 | $("#Cancel").jqxButton({ width: '90px', theme: theme }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1020 | $("#Save").jqxButton({ width: '90px', theme: theme }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1021 | // 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
|
1022 | $("#Save").click(function () { |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
1023 | var fermentablerow = $('#fermentableGrid').jqxGrid('getrows'); |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
1024 | var hoprow = $('#hopGrid').jqxGrid('getrows'); |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
1025 | var miscrow = $('#miscGrid').jqxGrid('getrows'); |
61 | 1026 | var yeastrow = $('#yeastGrid').jqxGrid('getrows'); |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1027 | var waterrow = $('#waterGrid').jqxGrid('getrows'); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1028 | if (editrow >= 0) { |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1029 | var rowRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1030 | var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1031 | var row = { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1032 | record: rowID, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1033 | name: $("#name").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1034 | notes: $("#notes").val(), |
51 | 1035 | st_name: $('#st_name').val(), |
1036 | st_letter: $('#st_letter').val(), | |
1037 | st_guide: $('#st_guide').val(), | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1038 | st_og_min: rowRecord.st_og_min, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1039 | st_og_max: rowRecord.st_og_max, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1040 | st_fg_min: rowRecord.st_fg_min, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1041 | st_fg_max: rowRecord.st_fg_max, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1042 | st_ibu_min: rowRecord.st_ibu_min, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1043 | st_ibu_max: rowRecord.st_ibu_max, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1044 | st_color_min: rowRecord.st_color_min, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1045 | st_color_max: rowRecord.st_color_max, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1046 | st_carb_min: rowRecord.st_carb_min, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1047 | st_carb_max: rowRecord.st_carb_max, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1048 | st_abv_min: rowRecord.st_abv_min, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1049 | st_abv_max: rowRecord.st_abv_max, |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1050 | type: $("#type").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1051 | batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1052 | boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1053 | efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1054 | est_og: parseFloat($("#est_og").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1055 | est_fg: parseFloat($("#est_fg").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1056 | est_color: parseFloat($("#est_color").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1057 | color_method: $("#color_method").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1058 | est_ibu: parseFloat($("#est_ibu").jqxNumberInput('decimal')), |
51 | 1059 | ibu_method: $("#ibu_method").val(), |
1060 | mash_name: $("#mash_name").val(), | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1061 | mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1062 | mash_sparge_temp: parseFloat($("#mash_sparge_temp").jqxNumberInput('decimal')), |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
1063 | fermentables: fermentablerow, |
59
ad28e09e3abd
Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
1064 | hops: hoprow, |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
1065 | miscs: miscrow, |
61 | 1066 | yeasts: yeastrow, |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1067 | waters: waterrow |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1068 | }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1069 | $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1070 | } else { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1071 | // Insert a record |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1072 | var newrow = { |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1073 | record: -1, |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1074 | name: $("#name").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1075 | notes: $("#notes").val(), |
51 | 1076 | st_name: $('#st_name').val(), |
1077 | st_letter: $('#st_letter').val(), | |
1078 | st_guide: $('#st_guide').val(), | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1079 | st_og_min: 1.025, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1080 | st_og_max: 1.110, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1081 | st_fg_min: 1.000, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1082 | st_fg_max: 1.025, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1083 | st_ibu_min: 15, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1084 | st_ibu_max: 150, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1085 | st_color_min: 5, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1086 | st_color_max: 50, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1087 | st_carb_min: 1, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1088 | st_carb_max: 3, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1089 | st_abv_min: 2, |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1090 | st_abv_max: 14, |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1091 | type: $("#type").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1092 | batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1093 | boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1094 | efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1095 | est_og: parseFloat($("#est_og").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1096 | est_fg: parseFloat($("#est_fg").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1097 | est_color: parseFloat($("#est_color").jqxNumberInput('decimal')), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1098 | color_method: $("#color_method").val(), |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1099 | est_ibu: parseFloat($("#est_ibu").jqxNumberInput('decimal')), |
51 | 1100 | ibu_method: $("#ibu_method").val(), |
1101 | mash_name: $("#mash_name").val(), | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1102 | mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1103 | mash_sparge_temp: parseFloat($("#mash_sparge_temp").jqxNumberInput('decimal')), |
56
d4f4762e59b3
Start inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
55
diff
changeset
|
1104 | fermentables: fermentablerow, |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
1105 | hops: hoprow, |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
1106 | miscs: miscrow, |
61 | 1107 | yeasts: yeastrow, |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
1108 | waters: waterrow |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1109 | }; |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1110 | $('#jqxgrid').jqxGrid('addrow', null, newrow); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1111 | } |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
59
diff
changeset
|
1112 | $("#popupWindow").jqxWindow('hide'); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1113 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1114 | createDelElements(); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1115 | }); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1116 |