www/js/rec_edit.js

Mon, 11 Feb 2019 16:03:59 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 11 Feb 2019 16:03:59 +0100
changeset 264
24139883b9fa
parent 263
ed22ac46404b
child 265
05f9a0c9ed2d
permissions
-rw-r--r--

Adjust water volumes if mash infusion amount is changed.

68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
2 * Copyright (C) 2018-2019
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BMS
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 function createDelElements() {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 $('#eventWindow').jqxWindow({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 position: { x: 490, y: 210 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 width: 300,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 height: 175,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 resizable: false,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 isModal: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 modalOpacity: 0.4,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 okButton: $('#delOk'),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 cancelButton: $('#delCancel'),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 initContent: function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 $('#delCancel').focus();
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 $('#eventWindow').jqxWindow('hide');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 $(document).ready(function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
47 var to_100 = false; // Fermentables adjust to 100%
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
48 var preboil_sg = 0;
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
49 // var sugarsm = 0; // Sugars after mash
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
50 // var sugarsf = 0; // Sugars after boil
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
51 var psugar = 0; // Percentage real sugars
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
52 var pcara = 0; // Percentage cara/crystal malts
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
53 var svg = 77; // Default attenuation
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
54 var mashkg = 0; // Malt in mash weight
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
55 var hop_flavour = 0;
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
56 var hop_aroma = 0;
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
57 var mash_infuse = 0;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
58 var last_base = '';
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
59 var last_acid = '';
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
60
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
61 var MMCa = 40.048;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
62 var MMMg = 24.305;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
63 var MMNa = 22.98976928;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
64 var MMCl = 35.453;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
65 var MMSO4 = 96.0626;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
66 var MMCO3 = 60.01684;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
67 var MMHCO3 = 61.01684;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
68 var MMCaSO4 = 172.171;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
69 var MMCaCl2 = 147.015;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
70 var MMCaCO3 = 100.087;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
71 var MMMgSO4 = 246.475;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
72 var MMNaHCO3 = 84.007;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
73 var MMNa2CO3 = 105.996;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
74 var MMNaCl = 58.443;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
75 var MMCaOH2 = 74.06268;
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
76
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
77 var fermentableRow = 0;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
78 var fermentableData = {};
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
79 var hopRow = 0;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
80 var hopData = {};
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
81 var miscRow = 0;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
82 var miscData = {};
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
83 var yeastRow = 0;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
84 var yeastData = {};
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
85 var mashRow = 0;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
86 var mashData = {};
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
87
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 console.log("record:" + my_record + " return:" + my_return + " theme:" + theme);
129
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
89 $("#jqxLoader").jqxLoader({
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
90 width: 250,
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
91 height: 150,
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
92 isModal: true,
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
93 text: "Laden recept ...",
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
94 theme: theme
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
95 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
97 function setReadonly(ro) {
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
98 var rw = ! ro;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
99 var w100 = 110;
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
100 var w80 = 80;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
101 if (ro) { // jqxNumberInput width -20 for no spinbuttons
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
102 w100 = 90;
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
103 w80 = 60;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
104 }
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
105 $("#batch_size").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
106 $("#boil_size").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
107 $("#boil_time").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
108 $("#efficiency").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
109 $("#est_og").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
110 // id="st_fg_min" margin-left 15/35 maken
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
111 $("#type").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
112 $("#styleSelect").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
113 $("#color_method").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
114 $("#ibu_method").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
115 $("#Delete").jqxButton({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
116 $("#fermentableGrid").jqxGrid({ editable: rw });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
117 $("#faddrowbutton").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
118 $("#finstockbutton").jqxCheckBox({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
119 $("#fdeleterowbutton").jqxButton({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
120 $("#hopGrid").jqxGrid({ editable: rw });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
121 $("#haddrowbutton").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
122 $("#hinstockbutton").jqxCheckBox({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
123 $("#hdeleterowbutton").jqxButton({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
124 $("#miscGrid").jqxGrid({ editable: rw });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
125 $("#maddrowbutton").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
126 $("#minstockbutton").jqxCheckBox({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
127 $("#mdeleterowbutton").jqxButton({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
128 $("#yeastGrid").jqxGrid({ editable: rw });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
129 $("#yaddrowbutton").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
130 $("#yinstockbutton").jqxCheckBox({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
131 $("#ydeleterowbutton").jqxButton({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
132 $("#mashGrid").jqxGrid({ editable: rw });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
133 $("#saddrowbutton").jqxButton({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
134 $("#sdeleterowbutton").jqxButton({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
135 $("#w1_name").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
136 $("#w2_name").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
137 $("#pr_name").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
138 $("#wa_cacl2").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
139 $("#wa_caso4").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
140 $("#wa_mgso4").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
141 $("#wa_nacl").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
142 $("#mash_ph").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
143 $("#calc_acid").jqxCheckBox({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
144 $("#wa_base_name").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
145 $("#wa_base").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
146 $("#wa_acid_name").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
147 $("#wa_acid").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
148 $("#wa_acid_perc").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w80 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
149 $("#sparge_temp").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
150 $("#sparge_volume").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
151 $("#sparge_ph").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
152 $("#sparge_source").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
153 $("#sparge_acid_type").jqxDropDownList({ disabled: ro });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
154 $("#sparge_acid_perc").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
155 };
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
156
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
157 function calcFermentables() {
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
158 console.log("calcFermentables()");
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
159 sugarsf = 0; // fermentable sugars mash + boil
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
160 sugarsm = 0; // fermentable sugars in mash
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
161 psugar = 0;
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
162 pcara = 0;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
163 mashkg = 0;
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
164 var vol = 0; // Volume sugars after boil
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
165 var addedS = 0; // Added sugars after boil
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
166 var addedmass = 0; // Added mass after boil
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
167 var mvol = 0; // mash volume
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
168 var colort = 0; // Colors srm * vol totals
127
6d5e215d77d2 Added fermentables Moment dropdown list. Added fermentables adjust to 100% logic.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
169 var my_100 = false;
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
170 var mashtime = 0; // Total mash time
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
171 var mashtemp = 0; // Average mash temperature
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
172
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
173 if ((rows = $('#mashGrid').jqxGrid('getrows'))) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
174 for (var i = 0; i < rows.length; i++) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
175 var row = rows[i];
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
176 if (row.step_type == 0) // Infusion
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
177 mvol += parseFloat(row.step_infuse_amount);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
178 if (row.step_temp <= 75) { // Ignore mashout
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
179 mashtime += row.step_time;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
180 mashtemp += row.step_time * row.step_temp;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
181 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
182 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
183 mashtemp = mashtemp / mashtime;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
184 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
185
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
186 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
187 return; // grid not yet loaded.
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
188 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
189
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
190 var s = 0;
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
191 for (var i = 0; i < rows.length; i++) {
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
192 var row = rows[i];
127
6d5e215d77d2 Added fermentables Moment dropdown list. Added fermentables adjust to 100% logic.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
193 if (row.f_adjust_to_total_100)
6d5e215d77d2 Added fermentables Moment dropdown list. Added fermentables adjust to 100% logic.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
194 my_100 = true;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
195 if (row.f_type == 1) // Sugar
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
196 psugar += row.f_percentage;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
197 if (row.f_graintype == 2) // Crystal
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
198 pcara += row.f_percentage;
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
199 var d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
200 if (row.f_added == 0) { // Mash
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
201 if (mvol > 0) { // Only if mash already known
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
202 mvol += row.f_amount * row.f_moisture / 100;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
203 s += d;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
204 }
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
205 d = parseFloat(dataRecord.efficiency) / 100 * d;
97
22c277be7e7e Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
206 sugarsm += d;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
207 mashkg += row.f_amount;
97
22c277be7e7e Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
208 }
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
209 if (row.f_added == 0 || row.f_added == 1) // Mash or Boil
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
210 sugarsf += d;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
211 if (row.f_added == 2 || row.f_added == 3) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
212 var x = (row.f_yield / 100) * (1 - row.f_moisture / 100);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
213 addedS += row.f_amount * x;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
214 addedmass += row.f_amount;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
215 vol += (x * sugardensity + (1 - x) * 1) * row.f_amount;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
216 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
217 colort += row.f_amount * ebc_to_srm(row.f_color);
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
218 }
127
6d5e215d77d2 Added fermentables Moment dropdown list. Added fermentables adjust to 100% logic.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
219 to_100 = my_100;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
220 if (to_100) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
221 $("#wf_amount").jqxNumberInput({ width: 90, readOnly: true, spinButtons: false });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
222 } else {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
223 $("#wf_amount").jqxNumberInput({ width: 110, readOnly: false, spinButtons: true });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
224 }
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
225
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
226 // Estimate total recipe OG.
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
227 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size));
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
228 $('#est_og').val(dataRecord.est_og);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
229 $('#est_og2').val(dataRecord.est_og);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
230
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
231 // Estimate SG in kettle before boil
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
232 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size));
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
233
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
234 // Color of the wort
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
235 var cw = colort / parseFloat(dataRecord.batch_size) * 8.34436;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
236 var color = kw_to_ebc(dataRecord.color_method, cw);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
237 dataRecord.est_color = color;
139
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
238 $('#est_color').val(color);
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
239 $('#est_color2').val(color);
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
240 var scolor = ebc_to_color(color);
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
241 document.getElementById("bcolor").style.background= scolor;
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
242 document.getElementById("bcolor2").style.background= scolor;
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
243
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
244 // Progress bars
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
245 pmalts = mashkg / (dataRecord.boil_size / 3) * 100;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
246 $("#perc_malts").jqxProgressBar('val', pmalts);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
247 $("#perc_sugars").jqxProgressBar('val', psugar);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
248 $("#perc_cara").jqxProgressBar('val', pcara);
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
249
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
250 // Calculate estimated svg.
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
251 svg = 0; // default.
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
252 var rows = $('#yeastGrid').jqxGrid('getrows');
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
253 for (var i = 0; i < rows.length; i++) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
254 var row = rows[i];
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
255 if (row.y_use == 0) { // Primary
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
256 if (parseFloat(row.y_attenuation) > svg)
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
257 svg = parseFloat(row.y_attenuation); // Take the highest if multiple yeasts.
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
258 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
259 // TODO: brett in secondary ??
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
260 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
261 if (svg == 0)
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
262 svg = 77;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
263
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
264 if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
265 dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
266 } else {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
267 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
268 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
269 $('#est_fg').val(dataRecord.est_fg);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
270 $('#est_fg2').val(dataRecord.est_fg);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
271
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
272 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
273 $("#est_abv").val(dataRecord.est_abv);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
274 $("#est_abv2").val(dataRecord.est_abv);
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
275 };
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
276
136
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
277 function hopFlavourContribution(bt, vol, use, amount) {
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
278 var result;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
279
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
280 if (use == 1) { // First wort
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
281 result = 0.15; // assume 15% flavourcontribution for fwh
136
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
282 } else if (bt > 50) {
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
283 result = 0.10; // assume 10% flavourcontribution as a minimum
136
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
284 } else {
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
285 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) /6, 2));
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
286 if (result < 0.10)
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
287 result = 0.10; // assume 10% flavourcontribution as a minimum
136
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
288 }
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
289 result = (result * amount * 1000) / vol;
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
290 // console.log("hopFlavourContribution("+bt+","+vol+","+use+","+amount+"): "+result);
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
291 return result;
136
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
292 }
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
293
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
294 function hopAromaContribution(bt, vol, use, amount) {
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
295 var result = 0;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
296
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
297 if (bt > 20) {
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
298 result = 0;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
299 } else if (bt > 7.5) {
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
300 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) /4, 2));
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
301 } else if (use == 2) { // Boil
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
302 result = 1;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
303 } else if (use == 3) { // Aroma / vlamuit
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
304 result = 1.2;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
305 } else if (use == 4) { // Whirlpool
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
306 result = 1.2;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
307 } else if (use == 5) { // Dry hop
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
308 result = 1.33;
136
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
309 }
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
310 result = (result * amount * 1000) / vol;
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
311 // console.log("hopAromaContribution("+bt+","+vol+","+use+","+amount+"): "+result);
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
312 return result;
136
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
313 }
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
314
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
315 function calcIBUs() {
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
316 var total_ibus = 0;
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
317 hop_aroma = hop_flavour = 0;
125
f2c79ed6423a Fixes and improvements for hops editing and calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 99
diff changeset
318 var rows = $('#hopGrid').jqxGrid('getrows');
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
319 for (var i = 0; i < rows.length; i++) {
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
320 var row = rows[i];
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
321 total_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, parseFloat(dataRecord.batch_size),
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
322 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
323 hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size),
136
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 135
diff changeset
324 row.h_useat, parseFloat(row.h_amount));
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
325 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size),
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
326 row.h_useat, parseFloat(row.h_amount));
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
327 }
137
dfbf43b2797e Store calculated estimate ibu and estimate fg.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
328 total_ibus = Math.round(total_ibus);
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
329 console.log("calcIBUs(): " + total_ibus + " flavour: " + hop_flavour + " aroma: " + hop_aroma);
137
dfbf43b2797e Store calculated estimate ibu and estimate fg.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
330 dataRecord.est_ibu = total_ibus;
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
331 $('#est_ibu').val(total_ibus);
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
332 $('#est_ibu2').val(total_ibus);
139
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
333 $("#hop_flavour").jqxProgressBar('val', hop_flavour * 10);
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
334 $("#hop_aroma").jqxProgressBar('val', hop_aroma * 10);
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
335 };
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
336
263
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
337 function adjustHops(factor) {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
338
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
339 console.log("adjustHops("+factor+")");
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
340
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
341 var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
342 if (rowscount == 0)
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
343 return;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
344
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
345 for (var i = 0; i < rowscount; i++) {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
346 var row = $("#hopGrid").jqxGrid('getrowdata', i);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
347 var amount = row.h_amount * factor;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
348 $("#hopGrid").jqxGrid('setcellvalue', i, "h_amount", amount);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
349 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
350 };
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
351
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
352 function adjustMiscs(factor) {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
353
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
354 console.log("adjustMiscs("+factor+")");
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
355
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
356 var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
357 if (rowscount == 0)
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
358 return;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
359
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
360 for (var i = 0; i < rowscount; i++) {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
361 var row = $("#miscGrid").jqxGrid('getrowdata', i);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
362 var amount = row.m_amount * factor;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
363 $("#miscGrid").jqxGrid('setcellvalue', i, "m_amount", amount);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
364 switch (row.m_name) {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
365 case 'CaCl2': $("#wa_cacl2").val(row.m_amount * 1000);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
366 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
367 case 'CaSO4': $("#wa_caso4").val(row.m_amount * 1000);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
368 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
369 case 'MgSO4': $("#wa_mgso4").val(row.m_amount * 1000);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
370 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
371 case 'NaCl': $("#wa_nacl").val(row.m_amount * 1000);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
372 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
373 case 'Melkzuur':
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
374 case 'Zoutzuur':
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
375 case 'Fosforzuur':
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
376 case 'Zwavelzuur': $("#wa_acid").val(row.m_amount * 1000);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
377 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
378 case 'NaHCO3':
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
379 case 'Na2CO3':
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
380 case 'CaCO3':
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
381 case 'Ca(OH)2': $("#wa_base").val(row.m_amount * 1000);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
382 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
383 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
384 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
385 };
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
386
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
387 function adjustYeasts(factor) {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
388
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
389 console.log("adjustYeasts("+factor+")");
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
390
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
391 var rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
392 if (rowscount == 0)
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
393 return;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
394
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
395 for (var i = 0; i < rowscount; i++) {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
396 var row = $("#yeastGrid").jqxGrid('getrowdata', i);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
397 if (row.y_form == 1) { // Only adjust dry yeast
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
398 var amount = row.y_amount * factor;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
399 $("#yeastGrid").jqxGrid('setcellvalue', i, "y_amount", amount);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
400 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
401 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
402 };
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
403
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
404 function adjustWaters(factor) {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
405
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
406 console.log("adjustWaters("+factor+")");
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
407
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
408 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
409 if (rowscount == 0)
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
410 return;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
411
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
412 mash_infuse = 0;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
413 for (var i = 0; i < rowscount; i++) {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
414 var row = $("#mashGrid").jqxGrid('getrowdata', i);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
415 if (row.step_type == 0) { // Infusion
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
416 var amount = Math.round(row.step_infuse_amount * factor * 10) / 10;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
417 $("#mashGrid").jqxGrid('setcellvalue', i, "step_infuse_amount", amount);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
418 mash_infuse += amount;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
419 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
420 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
421 if (dataRecord.w2_amount == 0) {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
422 dataRecord.w1_amount = mash_infuse;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
423 $("#w1_amount").val(mash_infuse);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
424 } else {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
425 dataRecord.w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
426 dataRecord.w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
427 $("#w1_amount").val(dataRecord.w1_amount);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
428 $("#w2_amount").val(dataRecord.w2_amount);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
429 }
264
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
430 $('#wg_amount').val(mash_infuse);
263
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
431 };
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
432
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
433 /* function GetBUGUMin() {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
434
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
435 var Result = 0;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
436
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
437 if (((dataRecord.st_og_max + dataRecord.st_og_min) > 0) && ((dataRecord.st_ibu_max + dataRecord.st_ibu_min) > 0)) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
438 var G = (dataRecord.st_og_max - dataRecord.st_og_min) / ((dataRecord.st_og_max + dataRecord.st_og_min) / 2);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
439 var B = (dataRecord.st_ibu_max - dataRecord.st_ibu_min) / ((dataRecord.st_ibu_max + dataRecord.st_ibu_min) / 2);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
440 if (G > B)
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
441 Result = ((dataRecord.st_ibu_max + dataRecord.st_ibu_min) / 2) / (1000 * (dataRecord.st_og_max - 1));
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
442 else
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
443 Result = dataRecord.st_ibu_min / (1000 * (((dataRecord.st_og_max + dataRecord.st_og_min) / 2) - 1));
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
444 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
445 console.log("GetBUGUMin(): "+Result);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
446 return Result;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
447 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
448
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
449 function GetBUGUMax() {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
450
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
451 var Result = 0;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
452
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
453 if (((dataRecord.st_og_max + dataRecord.st_og_min) > 0) && ((dataRecord.st_ibu_max + dataRecord.st_ibu_min) > 0) && (dataRecord.st_og_min > 0)) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
454 var G = (dataRecord.st_og_max - dataRecord.st_og_min) / ((dataRecord.st_og_max + dataRecord.st_og_min) / 2);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
455 var B = (dataRecord.st_ibu_max - dataRecord.st_ibu_min) / ((dataRecord.st_ibu_max + dataRecord.st_ibu_min) / 2);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
456 if (G > B)
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
457 Result = ((dataRecord.st_ibu_min + dataRecord.st_ibu_max) / 2) / (1000 * (dataRecord.st_og_min - 1));
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
458 else
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
459 Result = dataRecord.st_ibu_max / (1000 * (((dataRecord.st_og_max + dataRecord.st_og_min) / 2) - 1));
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
460
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
461 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
462 console.log("GetBUGUMax(): "+Result);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
463 return Result;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
464 } */
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
465
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
466 function GetBUGU() {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
467 var gu = (dataRecord.est_og - 1) * 1000;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
468 if (gu > 0)
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
469 return dataRecord.est_ibu / gu;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
470 else
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
471 return 0.5;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
472 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
473
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
474 function GetOptClSO4ratio() {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
475 var BUGU = GetBUGU();
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
476 return (-1.2 * BUGU + 1.4);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
477 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
478
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
479 function setWaterAgent(name, amount) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
480 console.log("setWaterAgent(" + name + ", " + amount + ")");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
481 var rows = $('#miscGrid').jqxGrid('getrows');
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
482 if (amount == 0) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
483 for (var i = 0; i < rows.length; i++) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
484 var row = rows[i];
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
485 if (row.m_name == name) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
486 var id = $("#miscGrid").jqxGrid('getrowid', i);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
487 var commit = $("#miscGrid").jqxGrid('deleterow', id);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
488 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
489 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
490 } else {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
491 var found = false;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
492 for (var i = 0; i < rows.length; i++) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
493 var row = rows[i];
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
494 if (row.m_name == name) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
495 found = true;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
496 $("#miscGrid").jqxGrid('setcellvalue', i, 'm_amount', amount / 1000);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
497 break;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
498 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
499 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
500 if (! found) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
501 var miscs = new $.jqx.dataAdapter(miscInvSource, {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
502 loadComplete: function () {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
503 var records = miscs.records;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
504 for (var i = 0; i < records.length; i++) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
505 var record = records[i];
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
506 if (record.name == name) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
507 var row = {};
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
508 row["m_name"] = record.name;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
509 row["m_amount"] = amount / 1000;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
510 row["m_cost"] = record.cost;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
511 row["m_type"] = record.type;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
512 row["m_use_use"] = record.use_use;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
513 row["m_time"] = 0;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
514 row["m_amount_is_weight"] = record.amount_is_weight;
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
515 row["m_inventory"] = record.inventory;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
516 row["m_avail"] = 1;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
517 var commit = $("#miscGrid").jqxGrid('addrow', null, row);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
518 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
519 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
520 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
521 });
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
522 miscs.dataBind();
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
523 return;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
524 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
525 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
526 }
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
527
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
528 function setRangeIndicator(ion, rangeCode) {
262
36cf32fcd210 Swapped icons
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
529 if (rangeCode == "low")
36cf32fcd210 Swapped icons
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
530 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='font-size: 10px; font-style: italic;'>"+rangeCode + "</span>");
36cf32fcd210 Swapped icons
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
531 else if (rangeCode == "high")
36cf32fcd210 Swapped icons
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
532 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='font-size: 10px; font-style: italic;'>"+rangeCode+"</span>");
36cf32fcd210 Swapped icons
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
533 else
36cf32fcd210 Swapped icons
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
534 $("#wr_"+ion).html("<img src='images/dialog-ok-apply.png'>");
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
535 }
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
536
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
537 function mix(v1, v2, c1, c2) {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
538 if ((v1 + v2) > 0) {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
539 return ((v1 * c1) + (v2 * c2)) / (v1 + v2);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
540 }
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
541 return 0;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
542 }
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
543
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
544 // mg/l as CaCO3
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
545 function ResidualAlkalinity(total_alkalinity, calcium, magnesium) {
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
546 return total_alkalinity - (calcium / 1.4 + magnesium / 1.7);
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
547 }
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
548
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
549 var Ka1 = 0.0000004445;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
550 var Ka2 = 0.0000000000468;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
551
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
552 function PartCO3(pH) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
553 var H = Math.pow(10, -pH);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
554 return 100 * Ka1 * Ka2 / (H*H + H * Ka1 + Ka1 * Ka2);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
555 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
556
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
557 function PartHCO3(pH) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
558 var H = Math.pow(10, -pH);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
559 return 100 * Ka1 * H / (H*H + H * Ka1 + Ka1 * Ka2);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
560 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
561
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
562 function Charge(pH) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
563 return (-2 * PartCO3(pH) - PartHCO3(pH));
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
564 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
565
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
566 //Z alkalinity is the amount of acid (in mEq/l) needed to bring water to the target pH (Z pH)
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
567 function ZAlkalinity(pHZ) {
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
568 var C43 = Charge(4.3);
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
569 var Cw = Charge(parseFloat($("#wg_ph").jqxNumberInput('decimal')));
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
570 var Cz = Charge(pHZ);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
571 var DeltaCNaught = -C43+Cw;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
572 var CT = parseFloat($("#wg_total_alkalinity").jqxNumberInput('decimal')) / 50 / DeltaCNaught;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
573 var DeltaCZ = -Cz+Cw;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
574 return CT * DeltaCZ;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
575 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
576
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
577 //Z Residual alkalinity is the amount of acid (in mEq/l) needed to bring the water in the mash to the target pH (Z pH)
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
578 function ZRA(pHZ) {
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
579
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
580 var Calc = parseFloat($("#wg_calcium").jqxNumberInput('decimal')) / (MMCa / 2);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
581 var Magn = parseFloat($("#wg_magnesium").jqxNumberInput('decimal')) / (MMMg / 2);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
582 var Z = ZAlkalinity(pHZ);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
583 return Z - (Calc / 3.5 + Magn / 7);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
584 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
585
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
586 function ProtonDeficit(pHZ) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
587
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
588 var Result = ZRA(pHZ) * parseFloat($("#wg_amount").jqxNumberInput('decimal'));
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
589 // proton deficit for the grist
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
590 var rows = $('#fermentableGrid').jqxGrid('getrows');
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
591 for (var i = 0; i < rows.length; i++) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
592 var row = rows[i];
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
593 if (row.f_added == 0 && row.f_graintype != 6) { // Added == Mash && graintype != No Malt
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
594 // Check if acid is required
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
595 var C1 = 0;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
596 if ((row.f_di_ph != 5.7) && ((row.f_acid_to_ph_57 < - 0.1) || (row.f_acid_to_ph_57 > 0.1))) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
597 C1 = row.f_acid_to_ph_57 / (row.f_di_ph - 5.7);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
598 } else {
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
599 // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid.
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
600 var ebc = row.f_color;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
601 switch (row.f_graintype) {
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
602 case 0: // Base, Special, Kilned
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
603 case 3:
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
604 case 5: C1 = 0.014 * ebc - 34.192;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
605 break;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
606 case 2: C1 = -0.0597 * ebc - 32.457; // Crystal
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
607 break;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
608 case 1: C1 = 0.0107 * ebc - 54.768; // Roast
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
609 break;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
610 case 4: C1 = -149; // Sour malt
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
611 break;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
612 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
613 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
614 x = C1 * (pHZ - row.f_di_ph); // AcidRequired(ZpH)
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
615 // console.log(row.f_name+" C1: "+C1+" ZpH: "+pHZ+" di_ph: "+row.f_di_ph+" acid rquired: "+x);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
616 Result += x * row.f_amount;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
617 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
618 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
619 // console.log("Final: "+Result);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
620 return Result;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
621 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
622
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
623 function MashpH() {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
624 var n = 0;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
625 var pH = 5.4;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
626 var deltapH = 0.001;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
627 var deltapd = 0.1;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
628 var pd = ProtonDeficit(pH);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
629 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) {
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
630 n++;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
631 if (pd < -deltapd)
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
632 pH -= deltapH;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
633 else if (pd > deltapd)
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
634 pH += deltapH;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
635 pd = ProtonDeficit(pH);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
636 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
637 console.log("MashpH() n: "+n+" pH: "+pH);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
638 return pH;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
639 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
640
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
641 function GetAcidSpecs(AT) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
642 switch(AT) {
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
643 case 0: return { // Melkzuur
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
644 pK1: 3.08,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
645 pK2: 20,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
646 pK3: 20,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
647 MolWt: 90.08,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
648 AcidSG: 1214,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
649 AcidPrc: 0.88
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
650 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
651 case 1: return { // Zoutzuur
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
652 pK1: -10,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
653 pK2: 20,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
654 pK3: 20,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
655 MolWt: 36.46,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
656 AcidSG: 1142,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
657 AcidPrc: 0.28
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
658 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
659 case 2: return { // Fosforzuur
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
660 pK1: 2.12,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
661 pK2: 7.20,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
662 pK3: 12.44,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
663 MolWt: 98.00,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
664 AcidSG: 1170,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
665 AcidPrc: 0.25
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
666 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
667 case 3: return { // Zwavelzuur
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
668 pK1: -10,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
669 pK2: 1.92,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
670 pK3: 20,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
671 MolWt: 98.07,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
672 AcidSG: 1700,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
673 AcidPrc: 0.93
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
674 };
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
675 }
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
676 console.log("Bummer, AT is " + AT);
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
677 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
678
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
679 // Procedure TFrmWaterAdjustment.CalcWater2;
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
680 function calcWater() {
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
681
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
682 console.log("calcWater()");
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
683 var liters = 0;
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
684 var calcium = 0;
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
685 var magnesium = 0;
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
686 var sodium = 0;
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
687 var total_alkalinity = 0;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
688 var bicarbonate = 0;
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
689 var chloride = 0;
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
690 var sulfate = 0;
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
691 var ph = 0;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
692 var RA = 0;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
693 var acid = 0;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
694 var frac = 0;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
695 var TpH = 0;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
696 var protonDeficit = 0;
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
697
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
698 if (dataRecord.w1_name == "") {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
699 return;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
700 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
701 // Check for a recipe too. Fermentables, Mash schedule?
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
702
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
703 // If there is a dillute water source, mix the waters.
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
704 if (dataRecord.w2_name != "") {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
705 liters = dataRecord.w1_amount + dataRecord.w2_amount;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
706 calcium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_calcium, dataRecord.w2_calcium);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
707 magnesium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_magnesium, dataRecord.w2_magnesium);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
708 sodium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sodium, dataRecord.w2_sodium);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
709 chloride = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_chloride, dataRecord.w2_chloride);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
710 sulfate = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sulfate, dataRecord.w2_sulfate);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
711 total_alkalinity = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_total_alkalinity, dataRecord.w2_total_alkalinity);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
712 ph = -Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
713 } else {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
714 liters = dataRecord.w1_amount;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
715 calcium = dataRecord.w1_calcium;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
716 magnesium = dataRecord.w1_magnesium;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
717 sodium = dataRecord.w1_sodium;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
718 chloride = dataRecord.w1_chloride;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
719 sulfate = dataRecord.w1_sulfate;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
720 total_alkalinity = dataRecord.w1_total_alkalinity;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
721 ph = dataRecord.w1_ph;
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
722 }
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
723 $('#wg_amount').val(liters);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
724 var wg_calcium = calcium;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
725 $('#wg_calcium').val(Math.round(calcium * 10) / 10);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
726 var wg_magnesium = magnesium;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
727 $('#wg_magnesium').val(Math.round(magnesium * 10) / 10);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
728 var wg_sodium = sodium;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
729 $('#wg_sodium').val(Math.round(sodium * 10) / 10);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
730 var wg_total_alkalinity = total_alkalinity;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
731 $('#wg_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
732 var wg_chloride = chloride;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
733 $('#wg_chloride').val(Math.round(chloride * 10) / 10);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
734 var wg_sulfate = sulfate;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
735 $('#wg_sulfate').val(Math.round(sulfate * 10) / 10);
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
736 // Note: brouwhulp has the malts included here in the result.
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
737 var wg_ph = ph;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
738 $('#wg_ph').val(Math.round(ph * 10) / 10);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
739 $('#wb_ph').val(Math.round(MashpH() * 10) / 10);
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
740 bicarbonate = total_alkalinity * 1.22;
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
741 var wg_bicarbonate = bicarbonate;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
742
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
743 // Noot: de volgende berekeningen geven bijna gelijke resultaten in Brun'water.
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
744 // Calculate Ca
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
745 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
746 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
747 calcium += 1000 * RA / liters;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
748
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
749 // Calculate Mg
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
750 RA = parseFloat($("#wa_mgso4").jqxNumberInput('decimal')) * MMMg / MMMgSO4;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
751 magnesium += 1000 * RA / liters;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
752
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
753 // Calculate Na
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
754 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
755 sodium += 1000 * RA / liters;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
756
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
757 // Calculate SO4
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
758 RA = parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
759 parseFloat($("#wa_mgso4").jqxNumberInput('decimal')) * MMSO4 / MMMgSO4;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
760 sulfate += 1000 * RA / liters;
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
761
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
762 // Calculate Cl
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
763 RA = 2 * parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
764 parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMCl / MMNaCl;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
765 chloride += 1000 * RA / liters;
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
766 // Einde noot.
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
767
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
768 if ($("#wa_acid_name").val() < 0 || $("#wa_acid_name").val() > 3) {
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
769 console.log("fix wa_acid_name");
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
770 $("#wa_acid_name").val(0);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
771 dataRecord.wa_acid_name = 0;
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
772 }
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
773 if (last_acid == '')
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
774 last_acid = AcidTypeData[$("#wa_acid_name").val()].nl;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
775
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
776 if ($("#wa_base_name").val() < 0 || $("#wa_base_name").val() > 3) {
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
777 console.log("fix wa_base_name");
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
778 $("#wa_base_name").val(0);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
779 dataRecord.wa_base_name = 0;
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
780 }
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
781 if (last_base == '')
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
782 last_base = BaseTypeData[$("#wa_base_name").val()].nl;
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
783
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
784 var AT = dataRecord.wa_acid_name; // parseFloat($("#wa_acid_name").jqxNumberInput('decimal'));
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
785 var BT = dataRecord.wa_base_name; //parseFloat($("#wa_base_name").jqxNumberInput('decimal'));
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
786
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
787 var result = GetAcidSpecs(AT);
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
788 var pK1 = result.pK1;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
789 var pK2 = result.pK2;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
790 var pK3 = result.pK3;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
791 var MolWt = result.MolWt;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
792 var AcidSG = result.AcidSG;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
793 var AcidPrc = result.AcidPrc;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
794
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
795 if (dataRecord.calc_acid) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
796 TpH = parseFloat(dataRecord.mash_ph);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
797 protonDeficit = ProtonDeficit(TpH);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
798 console.log("calc_acid tgt: "+TpH+" protonDeficit: "+protonDeficit);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
799 if (protonDeficit > 0) { // Add acid
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
800 $("#wa_base").val(0);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
801 setWaterAgent(last_base, 0);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
802 frac = CalcFrac(TpH, pK1, pK2, pK3);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
803 Acid = protonDeficit / frac;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
804 Acid *= MolWt; // mg
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
805 Acidmg = Acid;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
806 Acid = Acid / AcidSG; // ml
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
807
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
808 if (parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')) == 0)
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
809 $("#wa_acid_perc").val(AcidPrc);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
810 Acid = Acid * AcidPrc / (parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')) / 100); // ml
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
811 console.log("Final ml: "+Acid);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
812 $("#wa_acid").val(Math.round(Acid * 100) / 100);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
813 setWaterAgent(AcidTypeData[AT].nl, Math.round(Acid * 100) / 100);
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
814
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
815 bicarbonate = bicarbonate - protonDeficit * frac / liters;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
816 total_alkalinity = bicarbonate * 50 / 61;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
817 } else if (protonDeficit < 0) { //Add base
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
818 $("#wa_acid").val(0);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
819 setWaterAgent(last_acid, 0);
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
820 var r1d = Math.pow(10, (TpH - 6.38));
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
821 var r2d = Math.pow(10, (TpH - 10.38));
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
822 var f1d = 1 / (1 + r1d + r1d * r2d);
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
823 var f2d = f1d * r1d;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
824 var f3d = f2d * r2d;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
825 switch (BT) {
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
826 case 0: RA = -protonDeficit / (f1d - f3d); //Sodiumbicarbonate, mmol totaal
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
827 RA = RA * MMNaHCO3/1000; //gram
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
828 $("#wa_base").val(Math.round(RA * 100) / 100);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
829 setWaterAgent('NaHCO3', Math.round(RA * 100) / 100);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
830 if (liters > 0) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
831 // Na
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
832 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl +
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
833 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
834 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
835 sodium = wg_sodium + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
836 // HCO3
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
837 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
838 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
839 bicarbonate = wg_bicarbonate + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
840 total_alkalinity = bicarbonate * 50 / 61;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
841 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
842 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
843 break;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
844 case 1: RA = -protonDeficit / (2 * f1d + f2d); // Sodiumcarbonate, mmol totaal
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
845 RA = RA * MMNa2CO3/1000; //gram
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
846 $("#wa_base").val(Math.round(RA * 100) / 100);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
847 setWaterAgent('Na2CO3', Math.round(RA * 100) / 100);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
848 if (liters > 0) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
849 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl +
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
850 parseFloat($("#wa_base").jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
851 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
852 sodium = wg_sodium + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
853 // HCO3
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
854 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
855 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
856 bicarbonate = wg_bicarbonate + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
857 total_alkalinity = bicarbonate * 50 / 61;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
858 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
859 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
860 break;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
861 case 2: RA = -protonDeficit * (f1d - f3d); // Calciumcarbonate, mmol totaal
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
862 RA = RA * MMCaCO3/1000; //gram
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
863 //but only 1/3 is effective, so add 3 times as much
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
864 RA = 3 * RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
865 $("#wa_base").val(Math.round(RA * 100) / 100);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
866 setWaterAgent('CaCO3', Math.round(RA * 100) / 100);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
867 if (liters > 0) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
868 //Bicarbonate
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
869 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
870 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
871 bicarbonate = wg_bicarbonate + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
872 total_alkalinity = bicarbonate * 50 / 61;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
873 //Ca precipitates out as Ca10(PO4)6(OH)2
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
874 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
875 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 +
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
876 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaCO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
877 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
878 calcium = wg_calcium + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
879 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
880 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
881 break;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
882 case 3: RA = -protonDeficit / 19.3; // Calciumhydroxide
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
883 $("#wa_base").val(Math.round(RA * 100) / 100);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
884 setWaterAgent('Ca(OH)2', Math.round(RA * 100) / 100);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
885 if (liters > 0) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
886 // Bicarbonate
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
887 RA = -protonDeficit / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
888 total_alkalinity = wg_total_alkalinity + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
889 bicarbonate = total_alkalinity * 61 / 50;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
890 // Calcium
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
891 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
892 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 +
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
893 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaOH2;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
894 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
895 calcium = wg_calcium + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
896 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
897 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
898 break;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
899 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
900 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
901 ph = TpH;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
902 $('#wb_ph').val(Math.round(ph * 10) / 10);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
903 } else { // Manual
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
904 console.log("calc_acid no");
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
905 // First add base salts
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
906 if (parseFloat($("#wa_base").jqxNumberInput('decimal')) > 0) {
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
907 if (liters > 0) {
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
908 switch (BT) {
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
909 case 0: // Sodiumbicarbonate, Na
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
910 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl +
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
911 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
912 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
913 sodium = wg_sodium + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
914 // HCO3
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
915 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
916 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
917 bicarbonate = wg_bicarbonate + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
918 total_alkalinity = bicarbonate * 50 / 61;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
919 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
920 break;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
921 case 1: // Sodiumcarbonate
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
922 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl +
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
923 parseFloat($("#wa_base").jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
924 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
925 sodium = wg_sodium + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
926 // HCO3
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
927 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
928 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
929 bicarbonate = wg_bicarbonate + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
930 total_alkalinity = bicarbonate * 50 / 61;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
931 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
932 break;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
933 case 2: // Calciumcarbonate: Bicarbonate
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
934 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
935 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
936 bicarbonate = wg_bicarbonate + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
937 total_alkalinity = bicarbonate * 50 / 61;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
938 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
939 // Ca
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
940 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
941 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 +
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
942 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaCO3;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
943 RA = 1000 * RA / liters;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
944 calcium = wg_calcium + RA;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
945 break;
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
946 }
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
947 }
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
948 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
949
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
950 TpH = parseFloat(dataRecord.mash_ph);
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
951 pHa = MashpH(); // This one is in demi water, should be in adjusted water???
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
952 // Then calculate the new pH with added acids
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
953 if (parseFloat($("#wa_acid").jqxNumberInput('decimal')) > 0) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
954 console.log("TpH: "+TpH+" water: "+pHa);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
955 Acid = parseFloat($("#wa_acid").jqxNumberInput('decimal'));
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
956 if (parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')) == 0)
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
957 $("#wa_acid_perc").val(AcidPrc);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
958 Acid = Acid / AcidPrc * (parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')) / 100); // ml
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
959 Acid *= AcidSG; // ml
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
960 Acid /= MolWt; // mg
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
961 Acidmg = Acid;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
962
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
963 //find the pH where the protondeficit = protondeficit by the acid
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
964 frac = CalcFrac(pHa, pK1, pK2, pK3);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
965 protonDeficit = Acid * frac;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
966
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
967 var deltapH = 0.001;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
968 var deltapd = 0.1;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
969 var pd = ProtonDeficit(pHa);
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
970 var n = 0;
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
971 // console.log("n: "+n+" pd: "+pd+" protonDeficit: "+protonDeficit+" frac: "+frac+" pHa: "+pHa);
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
972
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
973 while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 2000)) {
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
974 n++;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
975 if (pd < (protonDeficit-deltapd))
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
976 pHa -= deltapH;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
977 else if (pd > (protonDeficit+deltapd))
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
978 pHa += deltapH;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
979 frac = CalcFrac(pHa, pK1, pK2, pK3);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
980 protonDeficit = Acid * frac;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
981 pd = ProtonDeficit(pHa);
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
982 }
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
983 console.log("n: "+n+" pd: "+pd+" protonDeficit: "+protonDeficit+" frac: "+frac+" pHa: "+pHa);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
984 RA = wg_bicarbonate - protonDeficit * frac / liters;
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
985 bicarbonate = RA;
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
986 total_alkalinity = RA * 50 / 61;
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
987 ph = pHa;
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
988 $('#wb_ph').val(Math.round(ph * 10) / 10);
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
989 }
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
990 }
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
991
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
992 if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
993 RA = parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
994 parseFloat($("#wa_mgso4").jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 +
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
995 Acidmg / 1000 * MMSO4 / (MMSO4 + 2);
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
996 RA = 1000 * RA / liters;
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
997 sulfate = wg_sulfate + RA; // Not add to sulfate??
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
998 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
999 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
1000 parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMCl / MMNaCl +
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1001 Acidmg / 1000 * MMCl / (MMCl + 1);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
1002 RA = 1000 * RA / liters;
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
1003 chloride = wg_chloride + RA;
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
1004 }
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1005
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1006 // 2:1 Sulfate to Chroride IPA's, Pale Ales.
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1007 // 1:1 Sulfate to Chloride Balanced
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1008 // 1:2 Sulfate to Chloride Malty
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1009 $('#tgt_bu').val(Math.round(GetBUGU() * 100) / 100);
155
041af8a82d77 Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
1010 $('#tgt_cl_so4').val(Math.round(GetOptClSO4ratio() * 10) / 10); // Show real value too
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1011 if (sulfate > 0)
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1012 RA = chloride / sulfate;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1013 else
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1014 RA = 10;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1015 var piCLSO4_low = 0.8 * GetOptClSO4ratio();
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1016 var piCLSO4_high = 1.2 * GetOptClSO4ratio();
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1017 console.log("low: "+piCLSO4_low+" val: "+RA+" high: "+piCLSO4_high);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1018
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1019 $('#wb_calcium').val(Math.round(calcium * 10) / 10);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1020 $('#wb_magnesium').val(Math.round(magnesium * 10) / 10);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1021 $('#wb_sodium').val(Math.round(sodium * 10) / 10);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1022 $('#wb_sulfate').val(Math.round(sulfate * 10) / 10);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1023 $('#wb_chloride').val(Math.round(chloride * 10) / 10);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1024 $('#wb_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10);
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1025
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1026 if (calcium < 40) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1027 setRangeIndicator("calcium", "low");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1028 } else if (calcium > 150) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1029 setRangeIndicator("calcium", "high");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1030 } else {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1031 setRangeIndicator("calcium", "normal");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1032 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1033 if (magnesium >= 0 && magnesium <= 30) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1034 setRangeIndicator("magnesium", "normal");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1035 } else {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1036 setRangeIndicator("magnesium", "high");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1037 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1038 if (sodium <= 150) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1039 setRangeIndicator("sodium", "normal");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1040 } else {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1041 setRangeIndicator("sodium", "high");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1042 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1043 if (chloride <= 100) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1044 setRangeIndicator("chloride", "normal");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1045 } else {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1046 setRangeIndicator("chloride", "high");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1047 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1048 if (sulfate <= 350) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1049 setRangeIndicator("sulfate", "normal");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1050 } else {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1051 setRangeIndicator("sulfate", "high");
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1052 }
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1053 if (ph < 5.2) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1054 setRangeIndicator("ph", "low");
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1055 } else if (ph > 5.6) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1056 setRangeIndicator("ph", "high");
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1057 } else {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1058 setRangeIndicator("ph", "normal");
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1059 }
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1060 calcSparge();
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1061 }
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1062
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1063 function calcSparge() {
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1064
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1065 // Code from BrewBuddy/Brouwhulp, who got it from http://www.brewery.org/brewery/library/Acidi0,00fWaterAJD0497.html
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1066 var TargetpH = dataRecord.sparge_ph;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1067 var Source_pH = dataRecord.w1_ph;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1068 var Source_alkalinity = dataRecord.w1_total_alkalinity;
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
1069 // Select watersource or fallback to the first source.
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1070 if (dataRecord.sparge_source == 1) { // Source 2
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1071 if (dataRecord.w2_ph > 0.0) {
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1072 Source_pH = dataRecord.w2_ph;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1073 Source_alkalinity = dataRecord.w2_total_alkalinity;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1074 } else {
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1075 dataRecord.sparge_source = 0; // Source 1
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1076 $("#sparge_source").val(0);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1077 }
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1078 } else if (dataRecord.sparge_source == 2) { // Mixed
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1079 if (dataRecord.w2_ph > 0.0) {
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1080 Source_pH = parseFloat($("#wg_ph").jqxNumberInput('decimal'));
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1081 Source_alkalinity = parseFloat($("#wg_total_alkalinity").jqxNumberInput('decimal'));
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1082 } else {
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1083 dataRecord.sparge_source = 0;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1084 $("#sparge_source").val(0);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1085 }
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1086 }
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1087
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1088 console.log("calcSparge() target pH: "+TargetpH+" Source: "+Source_pH+" alkalinity: "+Source_alkalinity);
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1089
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1090 // Step 1: Compute the mole fractions of carbonic (f1o), bicarbonate (f2o) and carbonate(f3o) at the water pH
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1091 var r1 = Math.pow(10, Source_pH - 6.38);
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1092 var r2 = Math.pow(10, Source_pH - 10.33);
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1093 var d = 1 + r1 + r1*r2;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1094 var f1 = 1/d;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1095 var f2 = r1/d;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1096 var f3 = r1 * r2 / d;
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1097
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1098 //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity)
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1099 var r143 = Math.pow(10, 4.3 - 6.38);
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1100 var r243 = Math.pow(10, 4.3 - 10.33);
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1101 var d43 = 1 + r143 + r143*r243;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1102 var f143 = 1/d43;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1103 var f243 = r143 / d43;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1104 var f343 = r143 * r243 / d43;
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1105
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1106 //Step 3. Convert the sample alkalinity to milliequivalents/L
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1107 var alkalinity = Source_alkalinity / 50;
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1108 //Step 4. Solve
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1109 alkalinity = alkalinity / ((f143-f1)+(f3-f343));
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1110
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1111 //Step 5. Compute mole fractions at desired pH
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1112 var r1g = Math.pow(10, TargetpH - 6.38);
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1113 var r2g = Math.pow(10, TargetpH - 10.33);
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1114 var dg = 1 + r1g + r1g*r2g;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1115 var f1g = 1/dg;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1116 var f2g = r1g / dg;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1117 var f3g = r1g * r2g / dg;
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1118
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1119 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L)
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1120 var Acid = alkalinity * ((f1g-f1)+(f3-f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1121 if (dataRecord.sparge_acid_type < 0 || dataRecord.sparge_acid_type > 3) {
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1122 dataRecord.sparge_acid_type = 0;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1123 $("#sparge_acid_type").val(0);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1124 }
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1125 var AT = dataRecord.sparge_acid_type;
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1126 var result = GetAcidSpecs(AT);
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1127 var pK1 = result.pK1;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1128 var pK2 = result.pK2;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1129 var pK3 = result.pK3;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1130 var MolWt = result.MolWt;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1131 var AcidSG = result.AcidSG;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1132 var AcidPrc = result.AcidPrc;
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1133 var fract = CalcFrac(TargetpH, pK1, pK2, pK3);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1134
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1135 //Step 9. Now divide the mEq required by the "fraction". This is the required number of moles of acid.
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1136 Acid /= fract;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1137
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1138 //Step 10. Multiply by molecular weight of the acid
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1139 Acid *= MolWt; //mg
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1140
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1141 Acid = Acid / AcidSG; //ml ; 88% lactic solution
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1142 f1 = dataRecord.sparge_acid_perc;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1143 if (f1 <= 0.1)
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1144 f1 = AcidPrc;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1145 Acid = Acid * AcidPrc / (f1 / 100);
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1146
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1147 Acid *= dataRecord.sparge_volume; //ml lactic acid total
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1148 Acid = Math.round(Acid * 100) / 100;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1149 dataRecord.sparge_acid_amount = Acid / 1000;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1150 $("#sparge_acid_amount").val(Acid);
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1151 }
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1152
254
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1153 /*
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1154 * Change OG of recipe but keep the water volumes.
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1155 */
133
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1156 function calcFermentablesFromOG(OG) {
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1157
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1158 console.log("calcFermentablesFromOG("+OG+")");
254
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1159 var efficiency = parseFloat($("#efficiency").jqxNumberInput('decimal'));
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1160 var sug = sg_to_plato(OG) * parseFloat($("#batch_size").jqxNumberInput('decimal')) * OG / 100; //total amount of sugars in kg
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1161 var tot = 0;
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1162 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1163
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1164 for (var i = 0; i < rowscount; i++) {
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1165 var row = $("#fermentableGrid").jqxGrid('getrowdata', i);
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1166 var d = row.f_percentage / 100 * (row.f_yield / 100) * (1 - row.f_moisture / 100);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1167 if (row.f_added == 0) // Mash
133
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1168 d = efficiency / 100 * d;
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1169 tot += d;
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1170 }
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1171 var totmass = 0;
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1172 if (tot)
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1173 totmass = sug / tot;
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1174
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1175 if (totmass) {
254
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1176 for (i = 0; i < rowscount; i++) {
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1177 var row = $("#fermentableGrid").jqxGrid('getrowdata', i);
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1178 var amount = row.f_percentage / 100 * totmass;
3d61397fe9cd Rework the volume to the fermenter and things that depend on that. New layout on the brewday tab. The calculation model is simpler then the brouwhulp version.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1179 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_amount", amount);
133
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1180 }
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1181 }
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1182 };
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 132
diff changeset
1183
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1184 function calcInit () {
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1185 console.log("calc.init()");
135
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1186
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1187 $("#calc_acid").on('checked', function (event) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1188 dataRecord.calc_acid = true;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1189 calcWater();
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1190 });
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1191 $("#calc_acid").on('unchecked', function (event) {
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1192 dataRecord.calc_acid = false;
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1193 calcWater();
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1194 });
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1195 $("#w1_name").jqxDropDownList('selectItem', dataRecord.w1_name);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1196 $("#w2_name").jqxDropDownList('selectItem', dataRecord.w2_name);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1197 // Fix tap water if zero using mash infuse amount.
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1198 if (parseFloat($("#wg_amount").jqxNumberInput('decimal')) == 0 && mash_infuse > 0) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1199 $("#w1_amount").val(mash_infuse);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1200 dataRecord.w1_amount = mash_infuse;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1201 $("#wg_amount").val(mash_infuse);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1202 $("#w2_amount").val(0);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1203 dataRecord.w2_amount = 0;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1204 }
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1205 calcWater();
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1206 $("#w2_amount").on('change', function (event) {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1207 var newval = parseFloat(event.args.value);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1208
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1209 if (newval > mash_infuse) {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1210 $("#w2_amount").val(dataRecord.w2_amount);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1211 return;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1212 }
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1213 dataRecord.w1_amount = parseFloat($("#wg_amount").jqxNumberInput('decimal')) - newval;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1214 $("#w1_amount").val(dataRecord.w1_amount);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1215 dataRecord.w2_amount = newval;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1216 console.log("new: "+event.args.value+" w1: "+dataRecord.w1_amount+" w2: "+dataRecord.w2_amount);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1217 calcWater();
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1218 });
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1219 $('#wa_cacl2').on('change', function (event) {
232
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1220 if (event.args) {
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1221 setWaterAgent('CaCl2', 0); // This can prevent double entries.
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1222 setWaterAgent('CaCl2', event.args.value);
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1223 calcWater();
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1224 }
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1225 });
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1226 $('#wa_caso4').on('change', function (event) {
232
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1227 if (event.args) {
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1228 setWaterAgent('CaSO4', 0);
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1229 setWaterAgent('CaSO4', event.args.value);
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1230 calcWater();
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1231 }
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1232 });
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1233 $('#wa_mgso4').on('change', function (event) {
232
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1234 if (event.args) {
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1235 setWaterAgent('MgSO4', 0);
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1236 setWaterAgent('MgSO4', event.args.value);
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1237 calcWater();
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1238 }
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1239 });
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1240 $('#wa_nacl').on('change', function (event) {
232
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1241 if (event.args) {
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1242 setWaterAgent('NaCl', 0);
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1243 setWaterAgent('NaCl', event.args.value);
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1244 calcWater();
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
1245 }
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1246 });
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1247 $('#wa_base_name').on('change', function (event) {
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1248 if (event.args) {
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1249 var index = event.args.index;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1250 console.log("wa_base_name "+index);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1251 setWaterAgent(last_base, 0);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1252 last_base = BaseTypeData[index].nl;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1253 setWaterAgent(last_base, parseFloat($("#wa_base").jqxNumberInput('decimal')));
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1254 dataRecord.wa_base_name = index;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1255 calcWater();
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1256 }
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1257 });
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1258 $('#wa_base').on('change', function (event) {
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1259 var name = BaseTypeData[$("#wa_base_name").val()].nl;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1260 setWaterAgent(name, parseFloat(event.args.value));
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1261 calcWater();
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1262 });
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1263 $('#wa_acid_name').on('change', function (event) {
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1264 if (event.args) {
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1265 var index = event.args.index;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1266 console.log("wa_acid_name "+index);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1267 setWaterAgent(last_acid, 0);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1268 last_acid = AcidTypeData[index].nl;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1269 setWaterAgent(last_acid, parseFloat($("#wa_acid").jqxNumberInput('decimal')));
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1270 dataRecord.wa_acid_name = index;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1271 calcWater();
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1272 }
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1273 });
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1274 $('#wa_acid').on('change', function (event) {
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1275 var name = AcidTypeData[$("#wa_acid_name").val()].nl;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1276 setWaterAgent(name, parseFloat(event.args.value));
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1277 calcWater();
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1278 });
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1279 $('#wa_acid_perc').on('change', function (event) { calcWater(); });
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1280
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1281 $('#color_method').on('change', function (event) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1282 dataRecord.color_method = event.args.index;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1283 calcFermentables();
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1284 });
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
1285 $('#ibu_method').on('change', function (event) {
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1286 dataRecord.ibu_method = event.args.index;
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
1287 calcFermentables();
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
1288 calcIBUs();
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
1289 });
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1290 $('#batch_size').on('change', function (event) {
135
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1291 console.log("batch_size change:"+event.args.value+" old:"+dataRecord.batch_size);
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1292 var new_boil = parseFloat(event.args.value) + dataRecord.boil_size - dataRecord.batch_size;
263
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1293 var factor = parseFloat(event.args.value) / dataRecord.batch_size;
135
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1294 dataRecord.boil_size = new_boil;
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1295 $("#boil_size").val(Math.round(new_boil * 100) / 100);
263
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1296 dataRecord.sparge_volume *= factor;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1297 $("#sparge_volume").val(dataRecord.sparge_volume);
135
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1298 dataRecord.batch_size = parseFloat(event.args.value);
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1299 calcFermentablesFromOG(parseFloat($("#est_og").jqxNumberInput('decimal'))); // Keep the OG
263
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1300 adjustWaters(factor);
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1301 calcFermentables();
263
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1302 adjustHops(factor);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1303 adjustMiscs(factor);
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1304 adjustYeasts(factor);
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1305 calcIBUs();
263
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1306 calcWater();
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1307 calcSparge();
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1308 });
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1309 $('#boil_time').on('change', function (event) {
135
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1310 console.log("boil_time change:"+parseFloat(event.args.value)+" old:"+dataRecord.boil_time);
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1311 var old_evap = parseFloat(dataRecord.boil_size) - parseFloat(dataRecord.batch_size);
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1312 var new_evap = old_evap * (parseFloat(event.args.value) / dataRecord.boil_time);
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1313 var new_boil = parseFloat(dataRecord.batch_size) + new_evap;
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1314 // console.log("old_evap:"+old_evap+" new_evap:"+new_evap+" new_boil:"+new_boil);
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1315 dataRecord.boil_time = parseFloat(event.args.value);
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1316 dataRecord.boil_size = new_boil;
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1317 $("#boil_size").val(Math.round(new_boil * 100) / 100);
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1318 calcFermentables();
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1319 // TODO: adjust the hops, miscs, yeast, water.
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1320 calcIBUs();
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1321 });
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1322 $('#efficiency').on('change', function (event) {
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1323 console.log("efficiency change:"+event.args.value);
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1324 calcFermentables();
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1325 calcIBUs();
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1326 });
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1327 $('#est_og').on('change', function (event) {
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1328 console.log("est_og change:"+event.args.value);
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1329 calcFermentablesFromOG(event.args.value); // Adjust fermentables amounts
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1330 calcFermentables(); // Update the recipe details
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1331 calcIBUs(); // and the IBU's.
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1332 });
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1333 $('#mash_ph').on('change', function (event) {
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
1334 dataRecord.mash_ph = parseFloat(event.args.value);
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1335 calcWater();
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1336 });
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1337
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1338 $('#sparge_ph').on('change', function (event) {
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1339 dataRecord.sparge_ph = parseFloat(event.args.value);
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1340 calcSparge();
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1341 });
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1342 $('#sparge_volume').on('change', function (event) {
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1343 dataRecord.sparge_volume = parseFloat(event.args.value);
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1344 calcSparge();
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1345 });
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1346 $('#sparge_source').on('change', function (event) {
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1347 if (event.args) {
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1348 var index = event.args.index;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1349 dataRecord.sparge_source= index;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1350 calcSparge();
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1351 }
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1352 });
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1353 $('#sparge_acid_type').on('change', function (event) {
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1354 if (event.args) {
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1355 var index = event.args.index;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1356 dataRecord.sparge_acid_type = index;
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1357 console.log("new sparge_acid_type: "+dataRecord.sparge_acid_type);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1358 calcSparge();
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1359 }
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1360 });
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1361 $('#sparge_acid_perc').on('change', function (event) {
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1362 dataRecord.sparge_acid_perc = parseFloat(event.args.value);
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1363 calcSparge();
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1364 });
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1365 $('#locked').on('checked', function (event) {
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1366 setReadonly(true);
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1367 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1368 $('#locked').on('unchecked', function (event) {
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1369 setReadonly(false);
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1370 });
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1371 // setReadonly(false);
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1372 };
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1373
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1374 $("#styleSelect").jqxDropDownList({
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1375 placeHolder: "Kies bierstijl:",
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1376 theme: theme,
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1377 source: styleslist,
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1378 displayMember: "name",
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1379 width: 180,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1380 height: 23,
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1381 dropDownVerticalAlignment: 'top',
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1382 dropDownWidth: 500,
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1383 dropDownHeight: 380,
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1384 renderer: function (index, label, value) {
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1385 var datarecord = styleslist.records[index];
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1386 return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name;
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1387 }
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1388 });
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1389 $("#styleSelect").on('select', function (event) {
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1390 if (event.args) {
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1391 var index = event.args.index;
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1392 var datarecord = styleslist.records[index];
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1393 $("#st_name").val(datarecord.name);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1394 $("#st_category").val(datarecord.category);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1395 $("#st_category_number").val(datarecord.category_number);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1396 $("#st_letter").val(datarecord.style_letter);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1397 $("#st_guide").val(datarecord.style_guide);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1398 $("#st_type").val(StyleTypeData[datarecord.type].nl);
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1399 $("#st_og_min").val(datarecord.og_min);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1400 $("#st_og_max").val(datarecord.og_max);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1401 $("#st_fg_min").val(datarecord.fg_min);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1402 $("#st_fg_max").val(datarecord.fg_max);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1403 $("#st_ibu_min").val(datarecord.ibu_min);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1404 $("#st_ibu_max").val(datarecord.ibu_max);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1405 $("#st_color_min").val(datarecord.color_min);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1406 $("#st_color_max").val(datarecord.color_max);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1407 $("#st_carb_min").val(datarecord.carb_min);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1408 $("#st_carb_max").val(datarecord.carb_max);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1409 $("#st_abv_min").val(datarecord.abv_min);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1410 $("#st_abv_max").val(datarecord.abv_max);
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1411 }
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1412 });
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1413
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1414 var dataRecord = {};
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1415 var url = "includes/db_recipes.php";
150
159d7a89fcef Better stage detection during product import from brouwhulp. Added tooltips for treated water.
Michiel Broek <mbroek@mbse.eu>
parents: 149
diff changeset
1416
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1417 // prepare the data
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1418 var source = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1419 datatype: "json",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1420 cache: false,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1421 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1422 { name: 'record', type: 'number' },
166
635033a29c48 Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1423 { name: 'uuid', type: 'string' },
635033a29c48 Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1424 { name: 'locked', type: 'bool' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1425 { name: 'st_name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1426 { name: 'st_letter', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1427 { name: 'st_guide', type: 'string' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1428 { name: 'st_type', type: 'int' },
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1429 { name: 'st_category', type: 'string' },
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1430 { name: 'st_category_number', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1431 { name: 'st_og_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1432 { name: 'st_og_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1433 { name: 'st_fg_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1434 { name: 'st_fg_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1435 { name: 'st_ibu_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1436 { name: 'st_ibu_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1437 { name: 'st_color_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1438 { name: 'st_color_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1439 { name: 'st_carb_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1440 { name: 'st_carb_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1441 { name: 'st_abv_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1442 { name: 'st_abv_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1443 { name: 'name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1444 { name: 'notes', type: 'string' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1445 { name: 'type', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1446 { name: 'batch_size', type: 'float' },
95
8dc0a00b1db4 Boil_size volume toegevoegd.
Michiel Broek <mbroek@mbse.eu>
parents: 85
diff changeset
1447 { name: 'boil_size', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1448 { name: 'boil_time', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1449 { name: 'efficiency', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1450 { name: 'est_og', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1451 { name: 'est_fg', type: 'float' },
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1452 { name: 'est_abv', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1453 { name: 'est_color', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1454 { name: 'color_method', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1455 { name: 'est_ibu', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1456 { name: 'ibu_method', type: 'int' },
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1457 { name: 'est_carb', type: 'float' },
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1458 { name: 'sparge_temp', type: 'float' },
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1459 { name: 'sparge_ph', type: 'float' },
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1460 { name: 'sparge_volume', type: 'float' },
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
1461 { name: 'sparge_source', type: 'int' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1462 { name: 'sparge_acid_type', type: 'int' },
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1463 { name: 'sparge_acid_perc', type: 'float' },
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1464 { name: 'sparge_acid_amount', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1465 { name: 'mash_ph', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1466 { name: 'mash_name', type: 'string' },
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1467 { name: 'calc_acid', type: 'bool' },
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1468 { name: 'w1_name', type: 'string' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1469 { name: 'w1_amount', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1470 { name: 'w1_calcium', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1471 { name: 'w1_sulfate', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1472 { name: 'w1_chloride', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1473 { name: 'w1_sodium', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1474 { name: 'w1_magnesium', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1475 { name: 'w1_total_alkalinity', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1476 { name: 'w1_ph', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1477 { name: 'w1_cost', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1478 { name: 'w2_name', type: 'string' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1479 { name: 'w2_amount', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1480 { name: 'w2_calcium', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1481 { name: 'w2_sulfate', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1482 { name: 'w2_chloride', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1483 { name: 'w2_sodium', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1484 { name: 'w2_magnesium', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1485 { name: 'w2_total_alkalinity', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1486 { name: 'w2_ph', type: 'float' },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1487 { name: 'w2_cost', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1488 { name: 'wa_acid_name', type: 'int' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1489 { name: 'wa_acid_perc', type: 'int' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1490 { name: 'wa_base_name', type: 'int' },
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
1491 { name: 'fermentables', type: 'array' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1492 { name: 'hops', type: 'array' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1493 { name: 'miscs', type: 'array' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1494 { name: 'yeasts', type: 'array' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1495 { name: 'mashs', type: 'array' }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1496 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1497 id: 'record',
130
601920b902e5 Load a single recipe from the database instead of client side select.
Michiel Broek <mbroek@mbse.eu>
parents: 129
diff changeset
1498 url: url + '?record=' + my_record
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1499 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1500 // Load data and select one record.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1501 var dataAdapter = new $.jqx.dataAdapter(source, {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1502 loadComplete: function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1503 var records = dataAdapter.records;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1504 dataRecord = records[0];
166
635033a29c48 Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1505 // Hidden record uuid
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1506 $("#name").val(dataRecord.name);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1507 $("#notes").val(dataRecord.notes);
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1508 $("#locked").val(dataRecord.locked);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1509 $("#st_name").val(dataRecord.st_name);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1510 $("#st_letter").val(dataRecord.st_letter);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1511 $("#st_guide").val(dataRecord.st_guide);
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1512 $("#st_category").val(dataRecord.st_category);
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1513 $("#st_category_number").val(dataRecord.st_category_number);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1514 $("#st_type").val(StyleTypeData[dataRecord.st_type].nl);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1515 $("#type").val(dataRecord.type);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1516 $("#batch_size").val(dataRecord.batch_size);
95
8dc0a00b1db4 Boil_size volume toegevoegd.
Michiel Broek <mbroek@mbse.eu>
parents: 85
diff changeset
1517 $("#boil_size").val(dataRecord.boil_size);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1518 $("#boil_time").val(dataRecord.boil_time);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1519 $("#efficiency").val(dataRecord.efficiency);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1520 $("#est_og").val(dataRecord.est_og);
139
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
1521 $("#est_og2").val(dataRecord.est_og);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1522 $("#st_og_min").val(dataRecord.st_og_min);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1523 $("#st_og_max").val(dataRecord.st_og_max);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1524 $("#est_fg").val(dataRecord.est_fg);
227
fd6d87d1c9ed Recalculate FG, SVG and ABV when changing the primary yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 226
diff changeset
1525 $("#est_fg2").val(dataRecord.est_fg);
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1526 $("#st_fg_min").val(dataRecord.st_fg_min);
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1527 $("#st_fg_max").val(dataRecord.st_fg_max);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1528 $("#est_color").val(dataRecord.est_color);
139
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
1529 $("#est_color2").val(dataRecord.est_color);
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1530 $("#est_abv").val(dataRecord.est_abv);
227
fd6d87d1c9ed Recalculate FG, SVG and ABV when changing the primary yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 226
diff changeset
1531 $("#est_abv2").val(dataRecord.est_abv);
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1532 $("#st_abv_min").val(dataRecord.st_abv_min);
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1533 $("#st_abv_max").val(dataRecord.st_abv_max);
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1534 $("#st_color_min").val(dataRecord.st_color_min);
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1535 $("#st_color_max").val(dataRecord.st_color_max);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1536 $("#color_method").val(dataRecord.color_method);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1537 $("#est_ibu").val(dataRecord.est_ibu);
138
59874681fc13 Hop flavour and aroma sets global values. On the hop tab, show IBU and make room for the flavour and aroma presentation.
Michiel Broek <mbroek@mbse.eu>
parents: 137
diff changeset
1538 $("#est_ibu2").val(dataRecord.est_ibu);
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1539 $("#st_ibu_min").val(dataRecord.st_ibu_min);
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1540 $("#st_ibu_max").val(dataRecord.st_ibu_max);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1541 $("#ibu_method").val(dataRecord.ibu_method);
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1542 $("#est_carb").val(dataRecord.est_carb);
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1543 $("#st_carb_min").val(dataRecord.st_carb_min);
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1544 $("#st_carb_max").val(dataRecord.st_carb_max);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1545 $("#mash_name").val(dataRecord.mash_name);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1546 $("#mash_ph").val(dataRecord.mash_ph);
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1547 $("#sparge_temp").val(dataRecord.sparge_temp);
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1548 $("#sparge_ph").val(dataRecord.sparge_ph);
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1549 $("#sparge_volume").val(dataRecord.sparge_volume);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1550 $("#sparge_source").val(dataRecord.sparge_source);
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1551 $("#sparge_acid_type").val(dataRecord.sparge_acid_type);
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1552 $("#sparge_acid_perc").val(dataRecord.sparge_acid_perc);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1553 $("#sparge_acid_amount").val(dataRecord.sparge_acid_amount * 1000);
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1554 $("#calc_acid").val(dataRecord.calc_acid);
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1555 $("#w1_name").val(dataRecord.w1_name);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1556 $("#w1_amount").val(dataRecord.w1_amount);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1557 $("#w1_calcium").val(dataRecord.w1_calcium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1558 $("#w1_sulfate").val(dataRecord.w1_sulfate);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1559 $("#w1_chloride").val(dataRecord.w1_chloride);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1560 $("#w1_sodium").val(dataRecord.w1_sodium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1561 $("#w1_magnesium").val(dataRecord.w1_magnesium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1562 $("#w1_total_alkalinity").val(dataRecord.w1_total_alkalinity);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1563 $("#w1_ph").val(dataRecord.w1_ph);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1564 $("#w1_cost").val(dataRecord.w1_cost);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1565 $("#w2_name").val(dataRecord.w2_name);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1566 $("#w2_amount").val(dataRecord.w2_amount);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1567 $("#w2_calcium").val(dataRecord.w2_calcium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1568 $("#w2_sulfate").val(dataRecord.w2_sulfate);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1569 $("#w2_chloride").val(dataRecord.w2_chloride);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1570 $("#w2_sodium").val(dataRecord.w2_sodium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1571 $("#w2_magnesium").val(dataRecord.w2_magnesium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1572 $("#w2_total_alkalinity").val(dataRecord.w2_total_alkalinity);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1573 $("#w2_ph").val(dataRecord.w2_ph);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1574 $("#w2_cost").val(dataRecord.w2_cost);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1575 $("#wa_acid_name").val(dataRecord.wa_acid_name);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1576 $("#wa_acid_perc").val(dataRecord.wa_acid_perc);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1577 $("#wa_base_name").val(dataRecord.wa_base_name);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1578 editFermentable(dataRecord);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1579 editHop(dataRecord);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1580 editMisc(dataRecord);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1581 editYeast(dataRecord);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1582 editMash(dataRecord);
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
1583 $('#jqxTabs').jqxTabs('next');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1584 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1585 loadError: function (jqXHR, status, error) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1586 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1587 beforeLoadComplete: function (records) {
129
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1588 $('#jqxLoader').jqxLoader('open');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1589 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1590 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1591 dataAdapter.dataBind();
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1592
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1593 // Inline fermentables editor
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1594 var editFermentable = function (data) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1595 var fermentableSource = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1596 localdata: data.fermentables,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1597 datatype: "local",
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1598 cache: false,
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1599 async: false,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1600 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1601 { name: 'f_name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1602 { name: 'f_origin', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1603 { name: 'f_supplier', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1604 { name: 'f_amount', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1605 { name: 'f_cost', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1606 { name: 'f_type', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1607 { name: 'f_yield', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1608 { name: 'f_color', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1609 { name: 'f_coarse_fine_diff', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1610 { name: 'f_moisture', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1611 { name: 'f_diastatic_power', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1612 { name: 'f_protein', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1613 { name: 'f_max_in_batch', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1614 { name: 'f_graintype', type: 'int' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1615 { name: 'f_added', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1616 { name: 'f_dissolved_protein', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1617 { name: 'f_recommend_mash', type: 'int' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1618 { name: 'f_add_after_boil', type: 'int' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1619 { name: 'f_adjust_to_total_100', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1620 { name: 'f_percentage', type: 'float' },
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1621 { name: 'f_di_ph', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1622 { name: 'f_acid_to_ph_57', type: 'float' },
221
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
1623 { name: 'f_inventory', type: 'float' },
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
1624 { name: 'f_avail', type: 'int' }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1625 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1626 addrow: function (rowid, rowdata, position, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1627 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1628 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1629 deleterow: function (rowid, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1630 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1631 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1632 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1633 var fermentableAdapter = new $.jqx.dataAdapter(fermentableSource);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1634 $("#fermentableGrid").jqxGrid({
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1635 width: 1240,
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
1636 height: 450,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1637 source: fermentableAdapter,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1638 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1639 selectionmode: 'singlerow',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1640 localization: getLocalization(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1641 showtoolbar: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1642 rendertoolbar: function (toolbar) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1643 var me = this;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1644 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1645 toolbar.append(container);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1646 container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>');
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1647 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1648 container.append('<div style="float: left; margin-left: 10px;" id="finstockbutton"></div>');
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1649 container.append('<input style="float: left; margin-left: 400px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1650 // add fermentable from dropdownlist.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1651 $("#faddrowbutton").jqxDropDownList({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1652 placeHolder: "Kies mout:",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1653 theme: theme,
221
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
1654 template: "primary",
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1655 source: fermentablelist,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1656 displayMember: "name",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1657 width: 150,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1658 height: 27,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1659 dropDownWidth: 500,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1660 dropDownHeight: 500,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1661 renderer: function (index, label, value) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1662 var datarecord = fermentablelist.records[index];
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1663 return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)";
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1664 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1665 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1666 $("#faddrowbutton").on('select', function (event) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1667 if (event.args) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1668 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1669 var index = event.args.index;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1670 var datarecord = fermentablelist.records[index];
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1671 var row = {};
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1672 row["f_name"] = datarecord.name;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1673 row["f_origin"] = datarecord.origin;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1674 row["f_supplier"] = datarecord.supplier;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1675 row["f_amount"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1676 row["f_cost"] = datarecord.cost;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1677 row["f_type"] = datarecord.type;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1678 row["f_yield"] = datarecord.yield;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1679 row["f_color"] = datarecord.color;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1680 row["f_coarse_fine_diff"] = datarecord.coarse_fine_diff;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1681 row["f_moisture"] = datarecord.moisture;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1682 row["f_diastatic_power"] = datarecord.diastatic_power;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1683 row["f_protein"] = datarecord.protein;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1684 row["f_max_in_batch"] = datarecord.max_in_batch;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1685 row["f_graintype"] = datarecord.graintype;
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1686 if (datarecord.add_after_boil) {
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1687 row["f_added"] = 2; // Fermentation
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1688 } else if ((datarecord.type == 1) || (datarecord.type == 4)) { // Sugar or Adjunct
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1689 row["f_added"] = 1; // Boil
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1690 } else {
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1691 row["f_added"] = 0; // Mash
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1692 }
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1693 row["f_dissolved_protein"] = datarecord.dissolved_protein;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1694 row["f_recommend_mash"] = datarecord.recommend_mash;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1695 row["f_add_after_boil"] = datarecord.add_after_boil;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1696 if (rowscount == 0) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1697 // The first fermentable
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1698 row["f_adjust_to_total_100"] = 1;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1699 row["f_percentage"] = 100;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1700 } else {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1701 row["f_adjust_to_total_100"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1702 row["f_percentage"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1703 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1704 row["f_di_ph"] = datarecord.di_ph;
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
1705 row["f_acid_to_ph_57"] = datarecord.acid_to_ph_57;
221
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
1706 row["f_inventory"] = datarecord.inventory;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1707 var commit = $("#fermentableGrid").jqxGrid('addrow', null, row);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1708 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1709 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1710
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1711 $("#finstockbutton").jqxCheckBox({ theme: theme, height: 27 });
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1712 $("#finstockbutton").on('change', function (event) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1713 fermentableinstock = event.args.checked;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1714 fermentablelist.dataBind();
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1715 });
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1716
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1717 // delete selected fermentable.
221
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
1718 $("#fdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1719 $("#fdeleterowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1720 var selectedrowindex = $("#fermentableGrid").jqxGrid('getselectedrowindex');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1721 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1722 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1723 var id = $("#fermentableGrid").jqxGrid('getrowid', selectedrowindex);
129
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1724 var percent = $('#fermentableGrid').jqxGrid('getcellvalue', id, "f_percentage");
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1725 var amount = $('#fermentableGrid').jqxGrid('getcellvalue', id, "f_amount");
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1726 var commit = $("#fermentableGrid").jqxGrid('deleterow', id);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1727 }
129
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1728 rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1729 if (rowscount > 1) {
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1730 if (to_100) {
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1731 for (var i = 0; i < rowscount; i++) {
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1732 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1733 if (rowdata.f_adjust_to_total_100) {
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1734 rowdata.f_percentage += percent;
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1735 rowdata.f_amount += amount;
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1736 }
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1737 }
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1738 } else {
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1739 var tw = 0;
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1740 for (i = 0; i < rowscount; i++) {
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1741 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1742 tw += rowdata.f_amount;
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1743 };
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1744 for (i = 0; i < rowscount; i++) {
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1745 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1746 var percentage = Math.round(rowdata.f_amount / tw * 1000) / 10.0;
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1747 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_percentage", percentage);
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1748 };
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1749 }
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1750 } else {
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1751 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100);
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1752 }
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1753 calcFermentables();
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
1754 calcIBUs();
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1755 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1756 },
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
1757 ready: function() {
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
1758 calcFermentables();
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
1759 $('#jqxTabs').jqxTabs('next');
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
1760 },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1761 columns: [
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1762 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name',
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1763 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1764 var rowData = $("#fermentableGrid").jqxGrid('getrowdata', row);
139
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
1765 return "<span style='margin: 3px; margin-top: 6px; float: "+
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 138
diff changeset
1766 columnproperties.cellsalign+"'>" +rowData.f_supplier+" / "+rowData.f_name+" ("+rowData.f_color+" EBC)</span>";
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1767 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1768 },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1769 { text: 'Type', width: 100, datafield: 'f_type',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1770 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1771 return "<div style='margin: 4px;'>" + FermentableTypeData[value].nl + "</div>";
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1772 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1773 },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1774 { text: 'Moment', width: 110, datafield: 'f_added',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1775 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1776 return "<div style='margin: 4px;'>" + AddedData[value].nl + "</div>";
127
6d5e215d77d2 Added fermentables Moment dropdown list. Added fermentables adjust to 100% logic.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1777 }
6d5e215d77d2 Added fermentables Moment dropdown list. Added fermentables adjust to 100% logic.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1778 },
128
4d188d216c88 Layout changes in fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
1779 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1780 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
221
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
1781 { text: 'Voorr. Kg', datafield: 'f_inventory', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1782 { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1783 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1784 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1785 return "Wijzig";
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1786 }, buttonclick: function (row) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1787 fermentableRow = row;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1788 fermentableData = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1789 $("#wf_name").val(fermentableData.f_name);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1790 $("#wf_amount").val(fermentableData.f_amount);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1791 $("#wf_percentage").val(fermentableData.f_percentage);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1792 $("#wf_adjust_to_total_100").val(fermentableData.f_adjust_to_total_100);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1793 $("#wf_added").val(fermentableData.f_added);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1794 // show the popup window.
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1795 $("#popupFermentable").jqxWindow('open');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1796 }
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1797 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1798 ]
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1799 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1800 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1801
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1802 // Inline hops editor
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1803 var editHop = function (data) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1804 var hopSource = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1805 localdata: data.hops,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1806 datatype: "local",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1807 cache: false,
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1808 async: false,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1809 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1810 { name: 'h_name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1811 { name: 'h_origin', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1812 { name: 'h_amount', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1813 { name: 'h_cost', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1814 { name: 'h_type', type: 'int' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1815 { name: 'h_form', type: 'int' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1816 { name: 'h_useat', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1817 { name: 'h_time', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1818 { name: 'h_alpha', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1819 { name: 'h_beta', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1820 { name: 'h_hsi', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1821 { name: 'h_humulene', type: 'float' },
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1822 { name: 'h_caryophyllene', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1823 { name: 'h_cohumulone', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1824 { name: 'h_myrcene', type: 'float' },
142
793af7691a5e During hops load an extra weight in grams field is generated for the grid. Edit the amount is done on the weight field and the amount field is updated too. During save to the database the extra field is removed.
Michiel Broek <mbroek@mbse.eu>
parents: 141
diff changeset
1825 { name: 'h_total_oil', type: 'float' },
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1826 { name: 'h_inventory', type: 'float' },
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1827 { name: 'h_avail', type: 'int' }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1828 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1829 addrow: function (rowid, rowdata, position, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1830 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1831 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1832 deleterow: function (rowid, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1833 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1834 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1835 };
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1836 var hopAdapter = new $.jqx.dataAdapter(hopSource);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1837 $("#hopGrid").jqxGrid({
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1838 width: 1240,
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
1839 height: 510,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1840 source: hopAdapter,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1841 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1842 selectionmode: 'singlerow',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1843 localization: getLocalization(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1844 showtoolbar: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1845 rendertoolbar: function (toolbar) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1846 var me = this;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1847 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1848 toolbar.append(container);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1849 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>');
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1850 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1851 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>');
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1852 container.append('<input style="float: left; margin-left: 400px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1853 // add hop from dropdownlist.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1854 $("#haddrowbutton").jqxDropDownList({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1855 placeHolder: "Kies hop:",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1856 theme: theme,
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1857 template: "primary",
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1858 source: hoplist,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1859 displayMember: "name",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1860 width: 150,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1861 height: 27,
69
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
1862 dropDownWidth: 500,
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
1863 dropDownHeight: 500,
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
1864 renderer: function (index, label, value) {
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
1865 var datarecord = hoplist.records[index];
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
1866 return datarecord.origin+ " / " + datarecord.name + " (" + datarecord.alpha + "% &alpha;)";
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
1867 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1868 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1869 $("#haddrowbutton").on('select', function (event) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1870 if (event.args) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1871 var index = event.args.index;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1872 var datarecord = hoplist.records[index];
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1873 var row = {};
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1874 row["h_name"] = datarecord.name;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1875 row["h_origin"] = datarecord.origin;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1876 row["h_amount"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1877 row["h_cost"] = datarecord.cost;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1878 row["h_type"] = datarecord.type;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1879 row["h_form"] = datarecord.form;
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1880 row["h_useat"] = 2; // Boil
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1881 row["h_time"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1882 row["h_alpha"] = datarecord.alpha;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1883 row["h_beta"] = datarecord.beta;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1884 row["h_hsi"] = datarecord.hsi;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1885 row["h_humulene"] = datarecord.humulene;
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1886 row["h_caryophyllene"] = datarecord.caryophyllene;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1887 row["h_cohumulone"] = datarecord.cohumulone;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1888 row["h_myrcene"] = datarecord.myrcene;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1889 row["h_total_oil"] = datarecord.total_oil;
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1890 row["h_inventory"] = datarecord.inventory;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1891 var commit = $("#hopGrid").jqxGrid('addrow', null, row);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1892 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1893 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1894
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1895 $("#hinstockbutton").jqxCheckBox({ theme: theme, height: 27 });
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1896 $("#hinstockbutton").on('change', function (event) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1897 hopinstock = event.args.checked;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1898 hoplist.dataBind();
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1899 });
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1900
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1901 // delete selected hop.
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1902 $("#hdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1903 $("#hdeleterowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1904 var selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1905 var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1906 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1907 var id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1908 var commit = $("#hopGrid").jqxGrid('deleterow', id);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1909 }
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1910 calcIBUs();
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1911 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1912 },
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
1913 ready: function() {
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1914 calcIBUs();
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
1915 $('#jqxTabs').jqxTabs('next');
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
1916 },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1917 columns: [
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1918 { text: 'Hop', datafield: 'h_name',
143
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
1919 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) {
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
1920 var rowData = $("#hopGrid").jqxGrid('getrowdata', row);
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
1921 return "<span style='margin: 3px; margin-top: 6px; float: "+
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
1922 columnproperties.cellsalign+"'>" +rowData.h_origin+" / "+rowData.h_name+"</span>";
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
1923 },
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
1924 },
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1925 { text: 'Type', width: 90, datafield: 'h_type',
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1926 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1927 return "<div style='margin: 4px;'>" + HopTypeData[value].nl + "</div>";
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1928 }
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1929 },
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1930 { text: 'Vorm', width: 90, datafield: 'h_form',
140
93c64d7ac79c Hops grid editor amount is now in grams.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
1931 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1932 return "<div style='margin: 4px;'>" + HopFormData[value].nl + "</div>";
140
93c64d7ac79c Hops grid editor amount is now in grams.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
1933 }
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1934 },
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1935 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1936 { text: 'Gebruik', width: 110, datafield: 'h_useat',
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1937 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1938 return "<div style='margin: 4px;'>" + HopUseData[value].nl + "</div>";
126
9999b3ce98cb Row editors are now per cell. Added fermentable percentages editor.
Michiel Broek <mbroek@mbse.eu>
parents: 125
diff changeset
1939 }
9999b3ce98cb Row editors are now per cell. Added fermentable percentages editor.
Michiel Broek <mbroek@mbse.eu>
parents: 125
diff changeset
1940 },
224
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
1941 { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right',
142
793af7691a5e During hops load an extra weight in grams field is generated for the grid. Edit the amount is done on the weight field and the amount field is updated too. During save to the database the extra field is removed.
Michiel Broek <mbroek@mbse.eu>
parents: 141
diff changeset
1942 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
224
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
1943 if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
1944 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" min.</div>";
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
1945 if (rowdata.h_useat == 5) // Dry hop
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
1946 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value/1440, "f0")+" dagen</div>";
142
793af7691a5e During hops load an extra weight in grams field is generated for the grid. Edit the amount is done on the weight field and the amount field is updated too. During save to the database the extra field is removed.
Michiel Broek <mbroek@mbse.eu>
parents: 141
diff changeset
1947 else
224
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
1948 return "<div style='margin: 4px;'></div>";
132
aaefac2d08a3 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
1949 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1950 },
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1951 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right',
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1952 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
142
793af7691a5e During hops load an extra weight in grams field is generated for the grid. Edit the amount is done on the weight field and the amount field is updated too. During save to the database the extra field is removed.
Michiel Broek <mbroek@mbse.eu>
parents: 141
diff changeset
1953 var ibu = toIBU(rowdata.h_useat,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1954 rowdata.h_form,
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
1955 preboil_sg,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1956 parseFloat($("#batch_size").jqxNumberInput('decimal')),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1957 parseFloat(rowdata.h_amount),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1958 parseFloat(rowdata.h_time),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1959 parseFloat(rowdata.h_alpha),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1960 $("#ibu_method").val()
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1961 );
142
793af7691a5e During hops load an extra weight in grams field is generated for the grid. Edit the amount is done on the weight field and the amount field is updated too. During save to the database the extra field is removed.
Michiel Broek <mbroek@mbse.eu>
parents: 141
diff changeset
1962 return "<div style='margin: 4px;' class='jqx-right-align'>" + dataAdapter.formatNumber(ibu, "f1") + "</div>";
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1963 }
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1964 },
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1965 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', cellsalign: 'right',
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1966 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1967 if (value < 1)
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1968 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value * 1000, "f1")+" gr</div>";
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1969 else
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1970 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f1")+" kg</div>";
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1971 }
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1972 },
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1973 { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right', cellsalign: 'right',
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1974 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1975 if (value < 1)
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1976 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value * 1000, "f1")+" gr</div>";
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1977 else
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1978 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f1")+" kg</div>";
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1979 }
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1980 },
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1981 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1982 return "Wijzig";
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1983 }, buttonclick: function (row) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1984 hopRow = row;
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1985 hopData = $("#hopGrid").jqxGrid('getrowdata', hopRow);
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1986 $("#wh_name").val(hopData.h_name);
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1987 $("#wh_amount").val(hopData.h_amount * 1000);
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1988 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1989 parseFloat($("#batch_size").jqxNumberInput('decimal')),
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1990 parseFloat(hopData.h_amount), parseFloat(hopData.h_time),
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1991 parseFloat(hopData.h_alpha), $("#ibu_method").val()
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1992 );
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1993 $("#wh_ibu").val(ibu);
224
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
1994 if (hopData.h_useat == 5) // Dry hop
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
1995 $("#wh_time").val(hopData.h_time / 1440);
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
1996 else
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
1997 $("#wh_time").val(hopData.h_time);
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1998 $("#wh_useat").val(hopData.h_useat);
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
1999 // show the popup window.
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2000 $("#popupHop").jqxWindow('open');
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2001 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2002 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2003 ]
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
2004 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2005 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2006
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2007 // Inline miscs editor
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2008 var editMisc = function (data) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2009 var miscSource = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2010 localdata: data.miscs,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2011 datatype: "local",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2012 cache: false,
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
2013 async: false,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2014 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2015 { name: 'm_name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2016 { name: 'm_amount', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2017 { name: 'm_cost', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2018 { name: 'm_type', type: 'int' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2019 { name: 'm_use_use', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2020 { name: 'm_time', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2021 { name: 'm_amount_is_weight', type: 'int' },
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2022 { name: 'm_inventory', type: 'float' },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2023 { name: 'm_avail', type: 'int' }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2024 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2025 addrow: function (rowid, rowdata, position, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2026 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2027 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2028 deleterow: function (rowid, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2029 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2030 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2031 };
143
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2032 var miscAdapter = new $.jqx.dataAdapter(miscSource, {
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2033 beforeLoadComplete: function (records) {
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2034 var data = new Array();
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2035 for (var i = 0; i < records.length; i++) {
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2036 var row = records[i];
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2037 data.push(row);
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
2038 // Initial set water agent values.
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2039 switch (row.m_name) {
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2040 case 'CaCl2': $("#wa_cacl2").val(row.m_amount * 1000);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2041 break;
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2042 case 'CaSO4': $("#wa_caso4").val(row.m_amount * 1000);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2043 break;
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2044 case 'MgSO4': $("#wa_mgso4").val(row.m_amount * 1000);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2045 break;
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2046 case 'NaCl': $("#wa_nacl").val(row.m_amount * 1000);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2047 break;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2048 case 'Melkzuur': $("#wa_acid_name").val(0);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2049 $("#wa_acid").val(row.m_amount * 1000);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2050 $("#wa_acid_perc").val(80);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2051 last_acid = 'Melkzuur';
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2052 break;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2053 case 'Zoutzuur': $("#wa_acid_name").val(1);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2054 $("#wa_acid").val(row.m_amount * 1000);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2055 $("#wa_acid_perc").val(80);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2056 last_acid = 'Zoutzuur';
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2057 break;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2058 case 'Fosforzuur': $("#wa_acid_name").val(2);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2059 $("#wa_acid").val(row.m_amount * 1000);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2060 $("#wa_acid_perc").val(80);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2061 last_acid = 'Fosforzuur';
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2062 break;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2063 case 'Zwavelzuur': $("#wa_acid_name").val(3);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2064 $("#wa_acid").val(row.m_amount * 1000);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2065 $("#wa_acid_perc").val(80);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2066 last_acid = 'Zwavelzuur';
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2067 break;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2068 case 'NaHCO3': $("#wa_base_name").val(0);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2069 $("#wa_base").val(row.m_amount * 1000);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2070 last_base = 'NaHCO3';
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2071 break;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2072 case 'Na2CO3': $("#wa_base_name").val(1);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2073 $("#wa_base").val(row.m_amount * 1000);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2074 last_base = 'Na2CO3';
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2075 break;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2076 case 'CaCO3': $("#wa_base_name").val(2);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2077 $("#wa_base").val(row.m_amount * 1000);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2078 last_base = 'CaCO3';
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2079 break;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2080 case 'Ca(OH)2': $("#wa_base_name").val(3);
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2081 $("#wa_base").val(row.m_amount * 1000);
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
2082 last_base = 'Ca(OH)2';
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2083 break;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
2084 }
143
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2085 }
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2086 return data;
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2087 },
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2088 loadError: function(jqXHR, status, error) {
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2089 $('#err').text(status + ' ' + error);
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2090 },
122f64716161 During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents: 142
diff changeset
2091 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2092 $("#miscGrid").jqxGrid({
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2093 width: 1240,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2094 height: 525,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2095 source: miscAdapter,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2096 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2097 selectionmode: 'singlerow',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2098 localization: getLocalization(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2099 showtoolbar: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2100 rendertoolbar: function (toolbar) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2101 var me = this;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2102 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2103 toolbar.append(container);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2104 container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>');
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2105 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2106 container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>');
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2107 container.append('<input style="float: left; margin-left: 400px;" id="mdeleterowbutton" type="button" value="Verwijder ingredi&euml;nt" />');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2108 // add misc from dropdownlist.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2109 $("#maddrowbutton").jqxDropDownList({
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2110 placeHolder: "Kies ingredi&euml;nt:",
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2111 theme: theme,
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2112 template: "primary",
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2113 source: misclist,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2114 displayMember: "name",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2115 width: 150,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2116 height: 27,
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2117 dropDownWidth: 500,
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2118 dropDownHeight: 500
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2119 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2120 $("#maddrowbutton").on('select', function (event) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2121 if (event.args) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2122 var index = event.args.index;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2123 var datarecord = misclist.records[index];
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2124 var row = {};
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2125 row["m_name"] = datarecord.name;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2126 row["m_amount"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2127 row["m_cost"] = datarecord.cost;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2128 row["m_type"] = datarecord.type;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2129 row["m_use_use"] = datarecord.use_use;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2130 row["m_time"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2131 row["m_amount_is_weight"] = datarecord.amount_is_weight;
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2132 row["m_inventory"] = datarecord.inventory;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2133 var commit = $("#miscGrid").jqxGrid('addrow', null, row);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2134 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2135 });
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2136 $("#minstockbutton").jqxCheckBox({ theme: theme, height: 27 });
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2137 $("#minstockbutton").on('change', function (event) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2138 miscinstock = event.args.checked;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2139 misclist.dataBind();
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2140 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2141 // delete selected misc.
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2142 $("#mdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2143 $("#mdeleterowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2144 var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2145 var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount;
145
2662720e1949 Protect misc Water agent ingredients against delete and changing from the miscs editor.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
2146 var type = $("#miscGrid").jqxGrid('getcellvalue', selectedrowindex, "m_type");
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2147 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2148 var id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2149 var commit = $("#miscGrid").jqxGrid('deleterow', id);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2150 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2151 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2152 },
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
2153 ready: function() {
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
2154 $('#jqxTabs').jqxTabs('next');
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
2155 },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2156 columns: [
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2157 { text: 'Ingredient', datafield: 'm_name' },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2158 { text: 'Type', width: 140, datafield: 'm_type',
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2159 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2160 return "<div style='margin: 4px;'>" + MiscTypeData[value].nl + "</div>";
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2161 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2162 },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2163 { text: 'Gebruik', width: 140, datafield: 'm_use_use',
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2164 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2165 return "<div style='margin: 4px;'>" + MiscUseData[value].nl + "</div>";
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2166 }
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2167 },
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2168 { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right',
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2169 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2170 if (rowdata.m_use_use == 2) { // Boil
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2171 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" min.</div>";
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2172 } else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) { // Primary or Secondary
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2173 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value/1440, "f0")+" dagen</div>";
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2174 } else {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2175 var tijd = 0;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2176 return "<div style='margin: 4px;'> </div>";
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2177 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2178 },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2179 },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2180 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right',
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2181 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2182 var vstr = rowdata.m_amount_is_weight ? "gr":"ml";
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2183 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value * 1000,"f2")+" "+vstr+"</div>";
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2184 },
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2185 },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2186 { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right',
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2187 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2188 var vstr = rowdata.m_amount_is_weight ? "gr":"ml";
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2189 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value * 1000,"f2")+" "+vstr+"</div>";
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2190 },
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2191 },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2192 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2193 return "Wijzig";
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2194 }, buttonclick: function (row) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2195 miscRow = row;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2196 miscData = $("#miscGrid").jqxGrid('getrowdata', miscRow);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2197 if (miscData.m_amount_is_weight)
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2198 $("#wm_pmpt_amount").html("Gewicht gram:");
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2199 else
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2200 $("#wm_pmpt_amount").html("Volume ml:");
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2201 $("#wm_name").val(miscData.m_name);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2202 $("#wm_amount").val(miscData.m_amount * 1000);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2203 if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2204 $("#wm_time").val(miscData.m_time / 1440);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2205 else
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2206 $("#wm_time").val(miscData.m_time);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2207 $("#wm_use_use").val(miscData.m_use_use);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2208 // show the popup window.
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2209 if (miscData.m_type != 4)
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2210 $("#popupMisc").jqxWindow('open');
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2211 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2212 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2213 ]
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2214 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2215 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2216
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2217 // Inline yeasts editor
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2218 var editYeast = function (data) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2219 var yeastSource = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2220 localdata: data.yeasts,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2221 datatype: "local",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2222 cache: false,
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
2223 async: false,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2224 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2225 { name: 'y_name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2226 { name: 'y_laboratory', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2227 { name: 'y_product_id', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2228 { name: 'y_amount', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2229 { name: 'y_cost', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2230 { name: 'y_type', type: 'int' },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2231 { name: 'y_form', type: 'int' },
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2232 { name: 'y_flocculation', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2233 { name: 'y_min_temperature', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2234 { name: 'y_max_temperature', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2235 { name: 'y_attenuation', type: 'float' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2236 { name: 'y_use', type: 'int' },
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2237 { name: 'y_cells', type: 'float' },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2238 { name: 'y_inventory', type: 'float' },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2239 { name: 'y_avail', type: 'int' }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2240 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2241 addrow: function (rowid, rowdata, position, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2242 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2243 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2244 deleterow: function (rowid, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2245 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2246 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2247 };
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2248 var yeastAdapter = new $.jqx.dataAdapter(yeastSource);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2249 $("#yeastGrid").jqxGrid({
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2250 width: 1240,
227
fd6d87d1c9ed Recalculate FG, SVG and ABV when changing the primary yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 226
diff changeset
2251 height: 400,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2252 source: yeastAdapter,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2253 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2254 selectionmode: 'singlerow',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2255 localization: getLocalization(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2256 showtoolbar: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2257 rendertoolbar: function (toolbar) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2258 var me = this;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2259 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2260 toolbar.append(container);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2261 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>');
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2262 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2263 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>');
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2264 container.append('<input style="float: left; margin-left: 400px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2265 // add yeast from dropdownlist.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2266 $("#yaddrowbutton").jqxDropDownList({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2267 placeHolder: "Kies gist:",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2268 theme: theme,
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2269 template: "primary",
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2270 source: yeastlist,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2271 displayMember: "name",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2272 width: 150,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2273 height: 27,
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2274 dropDownWidth: 500,
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2275 dropDownHeight: 500,
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2276 renderer: function (index, label, value) {
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2277 var datarecord = yeastlist.records[index];
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2278 return datarecord.laboratory+" "+datarecord.product_id+" "+datarecord.name;
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2279 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2280 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2281 $("#yaddrowbutton").on('select', function (event) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2282 if (event.args) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2283 var index = event.args.index;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2284 var datarecord = yeastlist.records[index];
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2285 var row = {};
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2286 row["y_name"] = datarecord.name;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2287 row["y_laboratory"] = datarecord.laboratory;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2288 row["y_product_id"] = datarecord.product_id;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2289 row["y_type"] = datarecord.type;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2290 row["y_form"] = datarecord.form;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2291 row["y_amount"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2292 row["y_cost"] = datarecord.cost;
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2293 row["y_use"] = 0;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2294 row["y_min_temperature"] = datarecord.min_temperature;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2295 row["y_max_temperature"] = datarecord.max_temperature;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2296 row["y_attenuation"] = datarecord.attenuation;
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2297 row["y_flocculation"] = datarecord.flocculation;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2298 row["y_cells"] = datarecord.cells;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2299 row["y_inventory"] = datarecord.inventory;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2300 var commit = $("#yeastGrid").jqxGrid('addrow', null, row);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2301 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2302 });
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2303 $("#yinstockbutton").jqxCheckBox({ theme: theme, height: 27 });
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2304 $("#yinstockbutton").on('change', function (event) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2305 yeastinstock = event.args.checked;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2306 yeastlist.dataBind();
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2307 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2308 // delete selected yeast.
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2309 $("#ydeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2310 $("#ydeleterowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2311 var selectedrowindex = $("#yeastGrid").jqxGrid('getselectedrowindex');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2312 var rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2313 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2314 var id = $("#yeastGrid").jqxGrid('getrowid', selectedrowindex);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2315 var commit = $("#yeastGrid").jqxGrid('deleterow', id);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2316 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2317 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2318 },
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
2319 ready: function() {
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2320 calcFermentables();
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
2321 $('#jqxTabs').jqxTabs('next');
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
2322 },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2323 columns: [
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2324 { text: 'Gist', datafield: 'y_name' },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2325 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2326 { text: 'Code', width: 90, datafield: 'y_product_id' },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2327 { text: 'Soort', width: 100, datafield: 'y_form',
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2328 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2329 return "<div style='margin: 4px;'>" + YeastFormData[value].nl + "</div>";
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2330 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2331 },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2332 { text: 'Min. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2333 { text: 'Max. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2334 { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2335 { text: 'Voor', width: 120, datafield: 'y_use',
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2336 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2337 return "<div style='margin: 4px;'>" + YeastUseData[value].nl + "</div>";
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2338 }
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2339 },
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2340 { text: 'Hoeveel', datafield: 'y_amount', width: 100, align: 'right',
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2341 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2342 if (rowdata.y_form == 0) { // Liquid
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
2343 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" pk</div>";
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2344 } else if (rowdata.y_form == 1) { // Dry
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2345 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value*1000, "f1")+" gr</div>";
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2346 } else {
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2347 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value*1000, "f0")+" ml</div>";
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2348 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2349 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2350 },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2351 { text: 'Voorraad', datafield: 'y_inventory', width: 100, align: 'right',
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2352 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2353 if (rowdata.y_form == 0) { // Liquid
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2354 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value, "f0")+" pk</div>";
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2355 } else if (rowdata.y_form == 1) { // Dry
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2356 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value*1000, "f1")+" gr</div>";
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2357 } else {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2358 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value*1000, "f0")+" ml</div>";
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2359 }
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2360 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2361 },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2362 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2363 return "Wijzig";
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2364 }, buttonclick: function (row) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2365 yeastRow = row;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2366 yeastData = $("#yeastGrid").jqxGrid('getrowdata', yeastRow);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2367 if (yeastData.y_form == 0) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2368 $("#wy_pmpt_amount").html("Pak(ken):");
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2369 $("#wy_amount").val(yeastData.y_amount);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2370 $("#wy_amount").jqxNumberInput({ decimalDigits: 0, spinButtonsStep: 1 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2371 } else if (yeastData.y_form == 1) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2372 $("#wy_pmpt_amount").html("Gewicht gram:");
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2373 $("#wy_amount").val(yeastData.y_amount * 1000);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2374 $("#wy_amount").jqxNumberInput({ decimalDigits: 1, spinButtonsStep: 0.5 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2375 } else {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2376 $("#wy_pmpt_amount").html("Volume ml:");
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2377 $("#wy_amount").val(yeastData.y_amount * 1000);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2378 $("#wy_amount").jqxNumberInput({ decimalDigits: 0, spinButtonsStep: 1 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2379 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2380 $("#wy_name").val(yeastData.y_name);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2381 $("#wy_laboratory").val(yeastData.y_laboratory);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2382 $("#wy_product_id").val(yeastData.y_product_id);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2383 $("#wy_use").val(yeastData.y_use);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2384 // show the popup window.
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2385 $("#popupYeast").jqxWindow('open');
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2386 }
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2387 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2388 ]
141
fe9e2a677611 The yeast droplist sorting order changed. Misc ingredients time editor uses minutes or days depending on the use of the ingredient. The yeast editor can now use grams, ml or packs.
Michiel Broek <mbroek@mbse.eu>
parents: 140
diff changeset
2389 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2390 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2391
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2392 // inline mash editor
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2393 var editMash = function (data) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2394 var generaterow = function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2395 var row = {};
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2396 row["step_name"] = "Stap 1";
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2397 row["step_type"] = 0;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2398 row["step_infuse_amount"] = 15;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2399 row["step_temp"] = 62.0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2400 row['step_time'] = 20.0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2401 row['ramp_time'] = 1.0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2402 row['end_temp'] = 62.0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2403 return row;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2404 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2405 var mashSource = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2406 localdata: data.mashs,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2407 datatype: "local",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2408 cache: false,
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
2409 async: false,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2410 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2411 { name: 'step_name', type: 'string' },
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2412 { name: 'step_type', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2413 { name: 'step_infuse_amount', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2414 { name: 'step_temp', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2415 { name: 'step_time', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2416 { name: 'ramp_time', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2417 { name: 'end_temp', type: 'float' }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2418 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2419 addrow: function (rowid, rowdata, position, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2420 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2421 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2422 deleterow: function (rowid, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2423 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2424 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2425 };
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
2426 var mashAdapter = new $.jqx.dataAdapter(mashSource, {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
2427 beforeLoadComplete: function (records) {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
2428 mash_infuse = 0;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
2429 var data = new Array();
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
2430 for (var i = 0; i < records.length; i++) {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
2431 var row = records[i];
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2432 if (row.step_type == 0) // Infusion
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
2433 mash_infuse += parseFloat(row.step_infuse_amount);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
2434 }
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
2435 },
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
2436 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2437 $("#mashGrid").jqxGrid({
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2438 width: 1240,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2439 height: 400,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2440 source: mashAdapter,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2441 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2442 selectionmode: 'singlerow',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2443 localization: getLocalization(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2444 showtoolbar: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2445 rendertoolbar: function (toolbar) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2446 var me = this;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2447 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2448 toolbar.append(container);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2449 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />');
229
cfd87d51a33c Reset infuse amount if not an infusion step
Michiel Broek <mbroek@mbse.eu>
parents: 228
diff changeset
2450 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />');
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2451 $("#saddrowbutton").jqxButton({ template: "primary", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2452 $("#saddrowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2453 var datarow = generaterow();
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2454 var commit = $("#mashGrid").jqxGrid('addrow', null, datarow);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2455 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2456 // delete selected yeast.
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2457 $("#sdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2458 $("#sdeleterowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2459 var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2460 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2461 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2462 var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2463 var commit = $("#mashGrid").jqxGrid('deleterow', id);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2464 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2465 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2466 },
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
2467 ready: function() {
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2468 calcFermentables();
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 97
diff changeset
2469 calcInit();
129
7f41b61c3faf Added a loader during recipe load. Recalculate percentages if a fermentable row is deleted. Don't edit amounts if using weight percentages. Update grid percentages if a fermentable amount is changed. Recalculate IBU's after changes with fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 128
diff changeset
2470 $('#jqxLoader').jqxLoader('close');
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
2471 $('#jqxTabs').jqxTabs('first');
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
2472 // setReadonly(dataRecord.locked);
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 95
diff changeset
2473 },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2474 columns: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2475 { text: 'Stap naam', datafield: 'step_name' },
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2476 { text: 'Stap type', datafield: 'step_type', width: 175,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2477 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2478 return "<div style='margin: 4px;'>" + MashStepTypeData[value].nl + "</div>";
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2479 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2480 },
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2481 { text: 'Start &deg;C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2482 { text: 'Eind &deg;C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2483 { text: 'Tijd', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' },
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2484 { text: 'Stap', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' },
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2485 { text: 'Infuse', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right' },
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2486 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2487 return "Wijzig";
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2488 }, buttonclick: function (row) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2489 mashRow = row;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2490 mashData = $("#mashGrid").jqxGrid('getrowdata', mashRow);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2491 $("#wstep_name").val(mashData.step_name);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2492 $("#wstep_type").val(mashData.step_type);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2493 $("#wstep_infuse_amount").val(mashData.step_infuse_amount);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2494 $("#wstep_temp").val(mashData.step_temp);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2495 $("#wend_temp").val(mashData.end_temp);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2496 $("#wstep_time").val(mashData.step_time);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2497 $("#wramp_time").val(mashData.ramp_time);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2498 if (mashData.step_type == 0) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2499 $("#wstep_infuse_amount").show();
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2500 $("#wstep_pmpt").show();
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2501 } else {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2502 $("#wstep_infuse_amount").hide();
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2503 $("#wstep_pmpt").hide();
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2504 }
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2505 // show the popup window.
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
2506 $("#popupMash").jqxWindow('open');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2507 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2508 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2509 ]
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2510 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2511 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2512
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2513 // initialize the input fields.
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2514 // Tab 1, Algemeen
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2515 $("#name").jqxTooltip({ content: 'De naam voor dit recept.' });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2516 $("#name").jqxInput({ theme: theme, width: 640, height: 23 });
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
2517 $("#locked").jqxCheckBox({ theme: theme, width: 120, height: 23 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2518 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2519 $("#notes").jqxInput({ theme: theme, width: 960, height: 200 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2520 $("#type").jqxTooltip({ content: 'Het brouw type van dit recept.' });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2521 $("#type").jqxDropDownList({
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2522 theme: theme,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2523 source: RecipeTypeAdapter,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2524 valueMember: 'id',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2525 displayMember: 'nl',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2526 width: 180,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2527 height: 23,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2528 autoDropDownHeight: true
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2529 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2530 $("#efficiency").jqxTooltip({ content: 'Het rendement van maischen en koken.' });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
2531 $("#efficiency").jqxNumberInput( Perc1dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2532 $("#batch_size").jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
2533 $("#batch_size").jqxNumberInput( Spin1dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2534 $("#batch_size").jqxNumberInput({ min: 4 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2535 $("#boil_size").jqxTooltip({ content: 'Het volume van het wort voor het koken.' });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2536 $("#boil_size").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2537 $("#boil_time").jqxTooltip({ content: 'De kooktijd in minuten.' });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2538 $("#boil_time").jqxNumberInput( PosInt );
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2539 $("#boil_time").jqxNumberInput({ min: 4, max: 360 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2540
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2541 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2542 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2543 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2544 $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2545 $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'});
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2546 $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2547 $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2548 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2549 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2550 $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2551 $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'});
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2552 $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2553
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2554 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2555 $("#est_og").jqxNumberInput( SGopts );
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2556 $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2557 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2558 $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'});
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2559 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2560
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2561 $("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2562 $("#est_fg").jqxNumberInput( Show3dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2563 $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2564 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2565 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2566 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2567
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2568 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2569 $("#est_abv").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2570 $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2571 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2572 $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2573 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2574
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2575 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2576 $("#est_color").jqxNumberInput( Show0dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2577 $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2578 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2579 $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2580 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2581 $("#color_method").jqxDropDownList({
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2582 theme: theme,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2583 source: ColorMethodAdapter,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2584 valueMember: 'id',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2585 displayMember: 'nl',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2586 width: 180,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2587 height: 23,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2588 autoDropDownHeight: true
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2589 });
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2590
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2591 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2592 $("#est_ibu").jqxNumberInput( Show0dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2593 $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2594 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2595 $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2596 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2597 $("#ibu_method").jqxDropDownList({
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2598 theme: theme,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2599 source: IBUmethodAdapter,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2600 valueMember: 'id',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2601 displayMember: 'nl',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2602 width: 180,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2603 height: 23,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2604 autoDropDownHeight: true,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2605 dropDownVerticalAlignment: 'top'
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2606 });
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2607
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2608 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' });
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2609 $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2610 $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2611 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2612 $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'});
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2613 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
2614
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2615 // Tab 2, Vergistbaar
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2616 $("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2617 $("#est_color2").jqxNumberInput( Show0dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2618 $("#est_og2").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2619 $("#est_og2").jqxNumberInput( Show3dec );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2620 $("#perc_malts").jqxProgressBar({
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2621 width: 300,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2622 height: 23,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2623 theme: theme,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2624 showText: true,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2625 animationDuration: 0,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2626 colorRanges: [
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2627 { stop: 90, color: '#008C00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2628 { stop: 95, color: '#EB7331' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2629 { stop: 100, color: '#FF0000' }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2630 ]
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2631 });
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2632 $("#perc_sugars").jqxProgressBar({
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2633 width: 300,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2634 height: 23,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2635 theme: theme,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2636 showText: true,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2637 animationDuration: 0,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2638 colorRanges: [
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2639 { stop: 20, color: '#008C00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2640 { stop: 100, color: '#FF0000' }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2641 ]
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2642 });
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2643 $("#perc_cara").jqxProgressBar({
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2644 width: 300,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2645 height: 23,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2646 theme: theme,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2647 showText: true,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2648 animationDuration: 0,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2649 colorRanges: [
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2650 { stop: 25, color: '#008C00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2651 { stop: 100, color: '#FF0000' }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2652 ]
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2653 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2654 $("#popupFermentable").jqxWindow({
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2655 width: 800,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2656 height: 300,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2657 position: { x: 230, y: 100 },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2658 resizable: false,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2659 theme: theme,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2660 isModal: true,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2661 autoOpen: false,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2662 cancelButton: $("#FermentableReady"),
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2663 modalOpacity: 0.40
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2664 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2665 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2666 $("#FermentableReady").click(function () {
221
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2667 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2668 // Recalc percentages
221
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2669 calcFermentables();
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2670 calcIBUs();
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2671 // Waters: yes there is impact.
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2672 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2673 $("#wf_name").jqxInput({ theme: theme, width: 320, height: 23 });
221
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2674 $("#wf_instock").jqxCheckBox({ theme: theme, height: 23 });
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2675 $("#wf_instock").on('change', function (event) {
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2676 fermentableinstock = event.args.checked;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2677 fermentablelist.dataBind();
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2678 });
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2679 $("#wf_select").jqxDropDownList({
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2680 placeHolder: "Kies mout:",
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2681 theme: theme,
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2682 source: fermentablelist,
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2683 displayMember: "name",
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2684 width: 150,
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2685 height: 23,
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2686 dropDownWidth: 500,
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2687 dropDownHeight: 500,
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2688 renderer: function (index, label, value) {
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2689 var datarecord = fermentablelist.records[index];
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2690 return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)";
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2691 }
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2692 });
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2693 $("#wf_select").on('select', function (event) {
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2694 if (event.args) {
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2695 var index = event.args.index;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2696 var datarecord = fermentablelist.records[index];
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2697 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow);
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2698 $("#wf_name").val(datarecord.name);
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2699 rowdata.f_name = datarecord.name;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2700 rowdata.f_origin = datarecord.origin;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2701 rowdata.f_supplier = datarecord.supplier;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2702 rowdata.f_type = datarecord.type;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2703 rowdata.f_cost = datarecord.cost;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2704 rowdata.f_yield = datarecord.yield;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2705 rowdata.f_color = datarecord.color;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2706 rowdata.f_coarse_fine_diff = datarecord.coarse_fine_diff;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2707 rowdata.f_moisture = datarecord.moisture;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2708 rowdata.f_diastatic_power = datarecord.diastatic_power;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2709 rowdata.f_protein = datarecord.protein;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2710 rowdata.f_max_in_batch = datarecord.max_in_batch;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2711 rowdata.f_graintype = datarecord.graintype;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2712 rowdata.f_dissolved_protein = datarecord.dissolved_protein;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2713 rowdata.f_recommend_mash = datarecord.recommend_mash;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2714 rowdata.f_add_after_boil = datarecord.add_after_boil;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2715 rowdata.f_di_ph = datarecord.di_ph;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2716 rowdata.f_acid_to_ph_57 = datarecord.acid_to_ph_57;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2717 rowdata.f_inventory = datarecord.inventory;
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2718 }
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 220
diff changeset
2719 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
2720 $("#wf_amount").jqxNumberInput( Spin3dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2721 $('#wf_amount').on('change', function (event) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2722 console.log("amount changed: "+event.args.value);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2723 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2724 if (! to_100) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2725 // Recalculate percentages
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2726 console.log("adjust percentages");
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2727 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2728 if (rowscount > 1) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2729 var tw = 0;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2730 for (i = 0; i < rowscount; i++) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2731 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2732 tw += rowdata.f_amount;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2733 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2734 for (i = 0; i < rowscount; i++) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2735 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2736 var percentage = Math.round(rowdata.f_amount / tw * 1000) / 10.0;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2737 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_percentage", percentage);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2738 // if (i == fermentableRow) // Will crash the script.
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2739 // $("#wf_percentage").val(percentage);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2740 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2741 } else {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2742 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2743 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2744 calcFermentables();
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2745 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2746 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
2747 $("#wf_percentage").jqxNumberInput( Perc1dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2748 $("#wf_percentage").on('change', function (event) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2749 var oldvalue = Math.round(fermentableData.f_percentage * 10) / 10.0;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2750 var newvalue = event.args.value;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2751 console.log("percentage changed: "+newvalue+" old: "+oldvalue);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2752 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2753 if ((oldvalue != newvalue) && (rowscount > 1)) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2754 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2755 if (rowdata.f_adjust_to_total_100) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2756 $("#wf_percentage").val(oldvalue);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2757 } else {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2758 var diff = newvalue - oldvalue;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2759 var tw = 0; // total weight
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2760 for (i = 0; i < rowscount; i++) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2761 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2762 tw += rowdata.f_amount;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2763 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2764 if (to_100) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2765 // Adjust this row and the 100% row.
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2766 var damount = tw * diff / 100;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2767 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2768 var namount = rowdata.f_amount + damount;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2769 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', namount);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2770 $("#wf_amount").val(namount);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2771 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_percentage', rowdata.f_percentage + diff);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2772 for (i = 0; i < rowscount; i++) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2773 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2774 if (rowdata.f_adjust_to_total_100) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2775 namount = rowdata.f_amount - damount;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2776 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2777 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2778 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2779 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2780 calcFermentables();
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2781 } else {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2782 // Adjust all the rows.
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2783 var nw = tw * diff / 100;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2784 for (i = 0; i < rowscount; i++) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2785 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2786 if (i == fermentableRow) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2787 var namount = rowdata.f_amount + nw;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2788 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2789 // $("#wf_amount").val(namount); // Will crash the script.
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2790 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', newvalue);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2791 } else {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2792 var namount = rowdata.f_amount - (nw / (rowscount - 1));
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2793 var newperc = Math.round((namount / tw) * 1000) / 10.0;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2794 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2795 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', newperc);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2796 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2797 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2798 calcFermentables();
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2799 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2800 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2801 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2802
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2803 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2804 $("#wf_adjust_to_total_100").jqxCheckBox({ theme: theme, width: 120, height: 23 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2805 $("#wf_adjust_to_total_100").on('checked', function (event) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2806 if (fermentableData.f_adjust_to_total_100 == 0) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2807 if (to_100) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2808 // Reset other flag first.
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2809 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2810 for (var i = 0; i < rowscount; i++) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2811 if (i != fermentableRow) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2812 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_adjust_to_total_100', 0);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2813 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2814 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2815 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2816 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 1);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2817 calcFermentables();
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2818 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2819 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2820 $("#wf_adjust_to_total_100").on('unchecked', function (event) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2821 if (fermentableData.f_adjust_to_total_100 != 0) {
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2822 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 0);
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2823 calcFermentables();
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2824 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2825 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2826 $("#wf_added").jqxDropDownList({
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2827 theme: theme,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2828 source: AddedAdapter,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2829 valueMember: 'id',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2830 displayMember: 'nl',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2831 width: 180,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2832 height: 23,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2833 autoDropDownHeight: true,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2834 dropDownVerticalAlignment: 'top'
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2835 });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2836 $("#wf_added").on('select', function (event) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2837 if (event.args) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2838 var index = event.args.index;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2839 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_added', index);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2840 calcFermentables();
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2841 calcIBUs();
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2842 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2843 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2844
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2845 // Tab 3, Hoppen
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2846 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2847 $("#est_ibu2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2848 $("#hop_flavour").jqxProgressBar({
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2849 width: 300,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2850 height: 23,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2851 theme: theme,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2852 showText: true,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2853 animationDuration: 0,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2854 colorRanges: [
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2855 { stop: 20, color: '#004D00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2856 { stop: 40, color: '#008C00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2857 { stop: 60, color: '#00BF00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2858 { stop: 80, color: '#00FF00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2859 { stop: 100, color: '#80FF80' }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2860 ]
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2861 });
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2862 $("#hop_aroma").jqxProgressBar({
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2863 width: 300,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2864 height: 23,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2865 theme: theme,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2866 showText: true,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2867 animationDuration: 0,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2868 colorRanges: [
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2869 { stop: 20, color: '#004D00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2870 { stop: 40, color: '#008C00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2871 { stop: 60, color: '#00BF00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2872 { stop: 80, color: '#00FF00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2873 { stop: 100, color: '#80FF80' }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2874 ]
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2875 });
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2876 $("#popupHop").jqxWindow({
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2877 width: 800,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2878 height: 300,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2879 position: { x: 230, y: 100 },
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2880 resizable: false,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2881 theme: theme,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2882 isModal: true,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2883 autoOpen: false,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2884 cancelButton: $("#HopReady"),
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2885 modalOpacity: 0.40
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2886 });
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2887 $("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme });
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2888 $("#HopReady").click(function () {
224
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2889 $("#hopGrid").jqxGrid('sortby', 'h_amount', 'asc');
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2890 calcIBUs();
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2891 });
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2892 $("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 });
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2893 $("#wh_instock").jqxCheckBox({ theme: theme, height: 23 });
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2894 $("#wh_instock").on('change', function (event) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2895 hopinstock = event.args.checked;
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2896 hoplist.dataBind();
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2897 });
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2898 $("#wh_select").jqxDropDownList({
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2899 placeHolder: "Kies hop:",
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2900 theme: theme,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2901 source: hoplist,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2902 displayMember: "name",
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2903 width: 150,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2904 height: 23,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2905 dropDownWidth: 500,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2906 dropDownHeight: 500,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2907 renderer: function (index, label, value) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2908 var datarecord = hoplist.records[index];
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2909 return datarecord.origin+ " / " + datarecord.name + " (" + datarecord.alpha + " % &alpha;)";
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2910 }
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2911 });
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2912 $("#wh_select").on('select', function (event) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2913 if (event.args) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2914 var index = event.args.index;
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2915 var datarecord = hoplist.records[index];
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2916 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow);
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2917 $("#wh_name").val(datarecord.name);
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2918 rowdata.h_name = datarecord.name;
224
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2919 rowdata.h_origin = datarecord.origin;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2920 rowdata.h_cost = datarecord.cost;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2921 rowdata.h_type = datarecord.type;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2922 rowdata.h_form = datarecord.form;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2923 rowdata.h_alpha = datarecord.alpha;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2924 rowdata.h_beta = datarecord.beta;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2925 rowdata.h_hsi = datarecord.hsi;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2926 rowdata.h_humulene = datarecord.humulene;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2927 rowdata.h_caryophyllene = datarecord.caryophyllene;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2928 rowdata.h_cohumulone = datarecord.cohumulone;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2929 rowdata.h_myrcene = datarecord.myrcene;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2930 rowdata.h_total_oil = datarecord.total_oil;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2931 rowdata.h_inventory = datarecord.inventory;
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2932 }
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2933 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
2934 $("#wh_amount").jqxNumberInput( Spin1dec );
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2935 $('#wh_amount').on('change', function (event) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2936 console.log("amount changed: "+event.args.value);
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2937 var amount = parseFloat(event.args.value) / 1000;
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2938 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow);
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2939
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2940 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2941 parseFloat($("#batch_size").jqxNumberInput('decimal')),
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2942 amount, parseFloat(rowdata.h_time),
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2943 parseFloat(rowdata.h_alpha), $("#ibu_method").val()
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2944 );
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2945 rowdata.h_amount = amount;
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2946 calcIBUs();
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2947 });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2948 $("#wh_ibu").jqxNumberInput( Show1dec );
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2949 $("#wh_time").jqxNumberInput( PosInt );
224
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2950 $("#wh_time").on('change', function (event) {
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2951 console.log("time changed: "+event.args.value);
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2952 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow);
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2953 var newtime = parseFloat(event.args.value);
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2954 // Check limits and correct
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2955 if (rowdata.h_useat == 2) { // Boil
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2956 if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) {
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2957 newtime = parseFloat($("#boil_time").jqxNumberInput('decimal'));
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2958 $("#wh_time").val(newtime);
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2959 }
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2960 rowdata.h_time = newtime;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2961 } else if (rowdata.h_useat == 4) { // Whirlpool
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2962 if (newtime > 120) {
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2963 newtime = 120;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2964 $("#wh_time").val(newtime);
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2965 }
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2966 rowdata.h_time = newtime;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2967 } else if (rowdata.h_useat == 5) { // Dry hop
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2968 if (newtime > 21) {
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2969 newtime = 21;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2970 $("#wh_time").val(newtime);
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2971 }
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2972 rowdata.h_time = newtime * 1440;
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2973 }
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2974 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')),
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2975 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), $("#ibu_method").val());
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2976 $("#wh_ibu").val(ibu);
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2977 calcIBUs();
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2978 });
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2979 $("#wh_useat").jqxDropDownList({
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2980 theme: theme,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2981 source: HopUseAdapter,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2982 valueMember: 'id',
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2983 displayMember: 'nl',
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2984 width: 180,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2985 height: 23,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2986 autoDropDownHeight: true,
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2987 dropDownVerticalAlignment: 'top'
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2988 });
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2989 $("#wh_useat").on('select', function (event) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2990 if (event.args) {
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2991 var index = event.args.index;
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2992 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow);
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2993 rowdata.h_useat = index;
224
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2994 if ((index == 0) || (index == 1)) { // Mashhop or First wort hop
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2995 rowdata.h_time = parseFloat(dataRecord.boil_time);
224
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2996 $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2997 $("#wh_time").val(rowdata.h_time);
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
2998 } else if (index == 3) { // Aroma
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
2999 rowdata.h_time = 0;
224
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
3000 $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
3001 $("#wh_time").val(0);
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
3002 } else { // Boil, Whirlpool or Dry hop
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
3003 $("#wh_time").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
3004 }
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
3005 if (index == 5) // Dry hop
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
3006 $("#wh_pmpt_time").html("Tijd in dagen");
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
3007 else
d3cdcfac81cb In hop grid friendly show duration. Finished hops popup editor. Made the IBU display readonly.
Michiel Broek <mbroek@mbse.eu>
parents: 223
diff changeset
3008 $("#wh_pmpt_time").html("Tijd in minuten");
223
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
3009 }
0de4455bd2a1 Fixed spelling area in all programs for caryophyllene. This is still wrong in brouwhulp, we correct it during database import. Also mycrene was spelled myrcene, my fault. The hops grid now uses a popup editor, this is not yet complete. Friendly weight display in the hop grid and added the inventory comlumn.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
3010 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3011
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3012 // Tab 4, Diversen
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3013 $("#popupMisc").jqxWindow({
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3014 width: 800,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3015 height: 275,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3016 position: { x: 230, y: 100 },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3017 resizable: false,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3018 theme: theme,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3019 isModal: true,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3020 autoOpen: false,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3021 cancelButton: $("#MiscReady"),
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3022 modalOpacity: 0.40
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3023 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3024 $("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3025 $("#MiscReady").click(function () {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3026 $("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3027 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3028 $("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3029 $("#wm_instock").jqxCheckBox({ theme: theme, height: 23 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3030 $("#wm_instock").on('change', function (event) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3031 miscinstock = event.args.checked;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3032 misclist.dataBind();
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3033 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3034 $("#wm_select").jqxDropDownList({
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3035 placeHolder: "Kies ingredi&euml;nt:",
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3036 theme: theme,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3037 source: misclist,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3038 displayMember: "name",
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3039 width: 150,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3040 height: 23,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3041 dropDownWidth: 500,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3042 dropDownHeight: 500
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3043 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3044 $("#wm_select").on('select', function (event) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3045 if (event.args) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3046 var index = event.args.index;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3047 var datarecord = misclist.records[index];
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3048 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3049 $("#wm_name").val(datarecord.name);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3050 rowdata.m_name = datarecord.name;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3051 rowdata.m_cost = datarecord.cost;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3052 rowdata.m_type = datarecord.type;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3053 rowdata.m_use_use = datarecord.use_use;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3054 rowdata.m_amount_is_weight = datarecord.amount_is_weight;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3055 rowdata.m_inventory = datarecord.inventory;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3056 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3057 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3058 $("#wm_amount").jqxNumberInput( Spin1dec );
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3059 $('#wm_amount').on('change', function (event) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3060 console.log("amount changed: "+event.args.value);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3061 var amount = parseFloat(event.args.value) / 1000;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3062 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3063 rowdata.m_amount = amount;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3064 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3065 $("#wm_time").jqxNumberInput( PosInt );
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3066 $("#wm_time").on('change', function (event) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3067 console.log("time changed: "+event.args.value);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3068 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3069 var newtime = parseFloat(event.args.value);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3070
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3071 if (rowdata.m_use_use == 2) { // Boil
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3072 if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3073 newtime = parseFloat($("#boil_time").jqxNumberInput('decimal'));
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3074 $("#wm_time").val(newtime);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3075 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3076 rowdata.m_time = newtime;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3077 } else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) { // Primary or Secondary
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3078 if (newtime > 21) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3079 newtime = 21;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3080 $("#wm_time").val(newtime);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3081 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3082 rowdata.m_time = newtime * 1440;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3083 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3084 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3085 $("#wm_use_use").jqxDropDownList({
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3086 theme: theme,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3087 source: MiscUseAdapter,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3088 valueMember: 'id',
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3089 displayMember: 'nl',
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3090 width: 180,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3091 height: 23,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3092 autoDropDownHeight: true,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3093 dropDownVerticalAlignment: 'top'
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3094 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3095 $("#wm_use_use").on('select', function (event) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3096 if (event.args) {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3097 var index = event.args.index;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3098 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3099 rowdata.m_use_use = index;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3100 if ((index == 2) || (index == 3) || (index == 4)) { // Boil, Primary or Secondary
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3101 $("#wm_time").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3102 } else {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3103 rowdata.m_time = 0;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3104 $("#wm_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3105 $("#wm_time").val(0);
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3106 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3107 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3108 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3109
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3110 // Tab 5, Gist
227
fd6d87d1c9ed Recalculate FG, SVG and ABV when changing the primary yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 226
diff changeset
3111 $("#est_fg2").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3112 $("#est_fg2").jqxNumberInput( Show3dec );
227
fd6d87d1c9ed Recalculate FG, SVG and ABV when changing the primary yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 226
diff changeset
3113 $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
fd6d87d1c9ed Recalculate FG, SVG and ABV when changing the primary yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 226
diff changeset
3114 $("#est_abv2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3115 $("#popupYeast").jqxWindow({
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3116 width: 800,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3117 height: 300,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3118 position: { x: 230, y: 100 },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3119 resizable: false,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3120 theme: theme,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3121 isModal: true,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3122 autoOpen: false,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3123 cancelButton: $("#YeastReady"),
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3124 modalOpacity: 0.40
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3125 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3126 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3127 $("#YeastReady").click(function () {
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3128 calcFermentables();
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3129 $("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3130 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3131 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3132 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3133 $("#wy_product_id").jqxInput({ theme: theme, width: 320, height: 23 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3134 $("#wy_instock").jqxCheckBox({ theme: theme, height: 23 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3135 $("#wy_instock").on('change', function (event) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3136 yeastinstock = event.args.checked;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3137 yeastlist.dataBind();
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3138 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3139 $("#wy_select").jqxDropDownList({
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3140 placeHolder: "Kies gist:",
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3141 theme: theme,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3142 source: yeastlist,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3143 displayMember: "name",
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3144 width: 150,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3145 height: 23,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3146 dropDownWidth: 500,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3147 dropDownHeight: 500,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3148 renderer: function (index, label, value) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3149 var datarecord = yeastlist.records[index];
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3150 return datarecord.laboratory+" "+datarecord.product_id+" "+datarecord.name;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3151 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3152 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3153 $("#wy_select").on('select', function (event) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3154 if (event.args) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3155 var index = event.args.index;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3156 var datarecord = yeastlist.records[index];
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3157 var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3158 $("#wy_name").val(datarecord.name);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3159 $("#wy_laboratory").val(datarecord.laboratory);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3160 $("#wy_product_id").val(datarecord.product_id);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3161 rowdata.y_name = datarecord.name;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3162 rowdata.y_cost = datarecord.cost;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3163 rowdata.y_type = datarecord.type;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3164 rowdata.y_form = datarecord.form;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3165 rowdata.y_laboratory = datarecord.laboratory;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3166 rowdata.y_product_id = datarecord.product_id;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3167 rowdata.y_min_temperature = datarecord.min_temperature;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3168 rowdata.y_max_temperature = datarecord.max_temperature;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3169 rowdata.y_flocculation = datarecord.flocculation;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3170 rowdata.y_attenuation = datarecord.attenuation;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3171 rowdata.y_cells = datarecord.cells;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3172 rowdata.y_inventory = datarecord.inventory;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3173 if (rowdata.y_form == 0) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3174 $("#wy_pmpt_amount").html("Pak(ken):");
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3175 } else if (rowdata.y_form == 1) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3176 $("#wy_pmpt_amount").html("Gewicht gram:");
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3177 } else {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3178 $("#wy_pmpt_amount").html("Volume ml:");
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3179 }
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3180 calcFermentables();
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3181 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3182 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3183 $("#wy_amount").jqxNumberInput( Spin1dec );
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3184 $('#wy_amount').on('change', function (event) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3185 console.log("amount changed: "+event.args.value);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3186 var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3187 if (rowdata.y_form == 0) // Liquid
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3188 var amount = parseFloat(event.args.value);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3189 else
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3190 var amount = parseFloat(event.args.value) / 1000;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3191 rowdata.y_amount = amount;
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3192 calcFermentables();
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3193 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3194 $("#wy_use").jqxDropDownList({
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3195 theme: theme,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3196 source: YeastUseAdapter,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3197 valueMember: 'id',
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3198 displayMember: 'nl',
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3199 width: 180,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3200 height: 23,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3201 autoDropDownHeight: true,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3202 dropDownVerticalAlignment: 'top'
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3203 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3204 $("#wy_use").on('select', function (event) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3205 if (event.args) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3206 var index = event.args.index;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3207 var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3208 rowdata.y_use = index;
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3209 calcFermentabes();
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3210 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3211 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3212
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3213 // Tab 6, Maischen
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3214 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 });
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3215 $("#mash_select").jqxDropDownList({
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3216 placeHolder: "Kies schema:",
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3217 theme: theme,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3218 source: mashlist,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3219 displayMember: "name",
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3220 width: 250,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3221 height: 23,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3222 dropDownWidth: 500,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3223 dropDownHeight: 500,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3224 dropDownHorizontalAlignment: 'right'
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3225 });
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3226 $("#mash_select").on('select', function (event) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3227 if (event.args) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3228 var index = event.args.index;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3229 // First delete all current steps
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3230 var rowIDs = new Array();
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3231 var rows = $("#mashGrid").jqxGrid('getdisplayrows');
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3232 for (var i = 0; i < rows.length; i++) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3233 var row = rows[i];
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3234 rowIDs.push(row.uid);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3235 }
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3236 $("#mashGrid").jqxGrid('deleterow', rowIDs);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3237 // Then add the new steps
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3238 var datarecord = mashlist.records[index];
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3239 $("#mash_name").val(datarecord.name);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3240 for (var i = 0; i < datarecord.steps.length; i++) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3241 var data = datarecord.steps[i];
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3242 var row = {};
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3243 row["step_name"] = data.step_name;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3244 row["step_type"] = data.step_type;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3245 // For now, but this must be smarter.
232
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
3246 if (mash_infuse == 0 && dataRecord.w1_amount > 0)
daf2d9d6fa18 When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.
Michiel Broek <mbroek@mbse.eu>
parents: 230
diff changeset
3247 mash_infuse = dataRecord.w1_amount;
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3248 if (i == 0)
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3249 row["step_infuse_amount"] = mash_infuse;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3250 else
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3251 row["step_infuse_amount"] = 0;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3252 row["step_temp"] = data.step_temp;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3253 row["end_temp"] = data.end_temp;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3254 row["step_time"] = data.step_time;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3255 row["ramp_time"] = data.ramp_time;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3256 var commit = $("#mashGrid").jqxGrid('addrow', null, row);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3257 }
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3258 }
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3259 });
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3260 $("#popupMash").jqxWindow({
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3261 width: 800,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3262 height: 350,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3263 position: { x: 230, y: 100 },
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3264 resizable: false,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3265 theme: theme,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3266 isModal: true,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3267 autoOpen: false,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3268 cancelButton: $("#MashReady"),
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3269 modalOpacity: 0.40
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3270 });
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3271 $("#MashReady").jqxButton({ template: "success", width: '90px', theme: theme });
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3272 $("#MashReady").click(function () {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3273 $("#mashGrid").jqxGrid('sortby', 'step_temp', 'asc');
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3274 });
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3275 $("#wstep_name").jqxInput({ theme: theme, width: 320, height: 23 });
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3276 $("#wstep_type").jqxDropDownList({
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3277 theme: theme,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3278 source: MashStepTypeAdapter,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3279 valueMember: 'id',
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3280 displayMember: 'nl',
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3281 width: 180,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3282 height: 23,
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3283 autoDropDownHeight: true
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3284 });
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3285 $("#wstep_type").on('select', function (event) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3286 if (event.args) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3287 var index = event.args.index;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3288 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3289 rowdata.step_type = index;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3290 if (index == 0) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3291 $("#wstep_infuse_amount").show();
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3292 $("#wstep_pmpt").show();
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3293 } else {
229
cfd87d51a33c Reset infuse amount if not an infusion step
Michiel Broek <mbroek@mbse.eu>
parents: 228
diff changeset
3294 rowdata.step_infuse_amount = 0;
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3295 $("#wstep_infuse_amount").hide();
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3296 $("#wstep_pmpt").hide();
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3297 }
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3298 mash_infuse = 0;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3299 var rows = $('#mashGrid').jqxGrid('getrows');
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3300 for (var i = 0; i < rows.length; i++) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3301 var row = rows[i];
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3302 if (row.step_type == 0) // Infusion
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3303 mash_infuse += parseFloat(row.step_infuse_amount);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3304 }
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3305 }
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3306 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3307 $("#wstep_temp").jqxNumberInput( Spin1dec );
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3308 $('#wstep_temp').on('change', function (event) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3309 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3310 rowdata.step_temp = parseFloat(event.args.value);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3311 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3312 $("#wend_temp").jqxNumberInput( Spin1dec );
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3313 $('#wend_temp').on('change', function (event) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3314 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3315 rowdata.end_temp = parseFloat(event.args.value);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3316 });
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3317 $("#wstep_time").jqxNumberInput( PosInt );
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3318 $('#wstep_time').on('change', function (event) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3319 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3320 rowdata.step_time = parseFloat(event.args.value);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3321 });
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3322 $("#wramp_time").jqxNumberInput( PosInt );
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3323 $('#wramp_time').on('change', function (event) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3324 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3325 rowdata.ramp_time = parseFloat(event.args.value);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3326 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3327 $("#wstep_infuse_amount").jqxNumberInput( Spin1dec );
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3328 $('#wstep_infuse_amount').on('change', function (event) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3329 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3330 rowdata.step_infuse_amount = parseFloat(event.args.value);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3331 mash_infuse = 0;
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3332 var rows = $('#mashGrid').jqxGrid('getrows');
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3333 for (var i = 0; i < rows.length; i++) {
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3334 var row = rows[i];
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3335 if (row.step_type == 0) // Infusion
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3336 mash_infuse += parseFloat(row.step_infuse_amount);
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3337 }
264
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3338 if (dataRecord.w2_amount == 0) {
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3339 dataRecord.w1_amount = mash_infuse;
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3340 $("#w1_amount").val(mash_infuse);
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3341 } else {
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3342 dataRecord.w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3343 dataRecord.w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3344 $("#w1_amount").val(dataRecord.w1_amount);
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3345 $("#w2_amount").val(dataRecord.w2_amount);
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3346 }
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3347 $('#wg_amount').val(mash_infuse);
228
98536f6539ee The mash grid now uses a popup editor. There is now a dropdown mash selector to replace the mash scheme.
Michiel Broek <mbroek@mbse.eu>
parents: 227
diff changeset
3348 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3349
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3350 // Tab 7, Water
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3351 $("#tgt_bu").jqxNumberInput( Show2wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3352 $("#tgt_cl_so4").jqxNumberInput( Show1wat );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3353
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3354 // Water source 1
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3355 $("#w1_name").jqxDropDownList({
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3356 placeHolder: "Kies hoofd water:",
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3357 theme: theme,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3358 source: waterlist,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3359 displayMember: "name",
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3360 width: 250,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3361 height: 27,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3362 dropDownWidth: 400,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3363 dropDownHeight: 400
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3364 });
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3365 $("#w1_name").on('select', function (event) {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3366 if (event.args) {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3367 var index = event.args.index;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3368 var datarecord = waterlist.records[index];
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3369 dataRecord.w1_name = datarecord.name;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3370 $("#w1_calcium").val(datarecord.calcium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3371 dataRecord.w1_calcium = datarecord.calcium;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3372 $("#w1_sulfate").val(datarecord.sulfate);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3373 dataRecord.w1_sulfate = datarecord.sulfate;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3374 $("#w1_chloride").val(datarecord.chloride);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3375 dataRecord.w1_chloride = datarecord.chloride;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3376 $("#w1_sodium").val(datarecord.sodium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3377 dataRecord.w1_sodium = datarecord.sodium;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3378 $("#w1_magnesium").val(datarecord.magnesium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3379 dataRecord.w1_magnesium = datarecord.magnesium;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3380 $("#w1_total_alkalinity").val(datarecord.total_alkalinity);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3381 dataRecord.w1_total_alkalinity = datarecord.total_alkalinity;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3382 $("#w1_ph").val(datarecord.ph);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3383 dataRecord.w1_ph = datarecord.ph;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3384 $("#w1_cost").val(datarecord.cost);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3385 dataRecord.w1_cost = datarecord.cost;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3386 calcWater();
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3387 }
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3388 });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3389 $("#w1_amount").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3390 $("#w1_calcium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3391 $("#w1_magnesium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3392 $("#w1_sodium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3393 $("#w1_total_alkalinity").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3394 $("#w1_chloride").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3395 $("#w1_sulfate").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3396 $("#w1_ph").jqxNumberInput( Show1wat );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3397 // Water source 2
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3398 $("#w2_name").jqxDropDownList({
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3399 placeHolder: "Kies meng water:",
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3400 theme: theme,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3401 source: waterlist,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3402 displayMember: "name",
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3403 width: 250,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3404 height: 27,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3405 dropDownWidth: 400,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3406 dropDownHeight: 400
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3407 });
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3408 $("#w2_name").on('select', function (event) {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3409 if (event.args) {
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3410 var index = event.args.index;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3411 var datarecord = waterlist.records[index];
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3412 dataRecord.w2_name = datarecord.name;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3413 $("#w2_calcium").val(datarecord.calcium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3414 dataRecord.w2_calcium = datarecord.calcium;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3415 $("#w2_sulfate").val(datarecord.sulfate);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3416 dataRecord.w2_sulfate = datarecord.sulfate;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3417 $("#w2_chloride").val(datarecord.chloride);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3418 dataRecord.w2_chloride = datarecord.chloride;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3419 $("#w2_sodium").val(datarecord.sodium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3420 dataRecord.w2_sodium = datarecord.sodium;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3421 $("#w2_magnesium").val(datarecord.magnesium);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3422 dataRecord.w2_magnesium = datarecord.magnesium;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3423 $("#w2_total_alkalinity").val(datarecord.total_alkalinity);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3424 dataRecord.w2_total_alkalinity = datarecord.total_alkalinity;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3425 $("#w2_ph").val(datarecord.ph);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3426 dataRecord.w2_ph = datarecord.ph;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3427 $("#w2_cost").val(datarecord.cost);
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3428 dataRecord.w2_cost = datarecord.cost;
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3429 $("#w2_amount").jqxNumberInput({ max: 100000, readOnly: false }); // Set high max to enable the spinbuttons.
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3430 calcWater();
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3431 }
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3432 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3433 $("#w2_amount").jqxTooltip({ content: 'De verdeling van het hoofd en meng water. Het totale maisch water volume blijft gelijk.'});
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3434 $("#w2_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1, spinButtons: true, readOnly: true });
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3435 $("#w2_calcium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3436 $("#w2_magnesium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3437 $("#w2_sodium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3438 $("#w2_total_alkalinity").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3439 $("#w2_chloride").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3440 $("#w2_sulfate").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3441 $("#w2_ph").jqxNumberInput( Show1wat );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3442 // Water mixed
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3443 $("#wg_amount").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3444 $("#wg_calcium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3445 $("#wg_magnesium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3446 $("#wg_sodium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3447 $("#wg_total_alkalinity").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3448 $("#wg_chloride").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3449 $("#wg_sulfate").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3450 $("#wg_ph").jqxNumberInput( Show1wat );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3451 // Water treated
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3452 $("#wb_calcium").jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'});
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3453 $("#wb_calcium").jqxNumberInput( Show1wat );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3454 $("#wb_magnesium").jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is lager dan 30.'});
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3455 $("#wb_magnesium").jqxNumberInput( Show1wat );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3456 $("#wb_sodium").jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3457 $("#wb_sodium").jqxNumberInput( Show1wat );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3458 $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is lager dan 100.'});
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3459 $("#wb_chloride").jqxNumberInput( Show1wat );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3460 $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is lager dan 350.'});
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3461 $("#wb_sulfate").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3462 $("#wb_total_alkalinity").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3463 $("#wb_ph").jqxNumberInput( Show1wat );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3464 // Water target profile
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3465 $("#pr_name").jqxDropDownList({
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3466 placeHolder: "Kies doel profiel:",
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3467 theme: theme,
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3468 source: waterprofiles,
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3469 displayMember: "name",
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3470 width: 250,
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3471 height: 27,
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3472 dropDownWidth: 400,
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3473 dropDownHeight: 300
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3474 });
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3475 $("#pr_name").on('select', function (event) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3476 if (event.args) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3477 var index = event.args.index;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3478 var datarecord = waterprofiles.records[index];
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3479 $("#pr_calcium").val(datarecord.calcium);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3480 $("#pr_sulfate").val(datarecord.sulfate);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3481 $("#pr_chloride").val(datarecord.chloride);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3482 $("#pr_sodium").val(datarecord.sodium);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3483 $("#pr_magnesium").val(datarecord.magnesium);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3484 $("#pr_total_alkalinity").val(datarecord.total_alkalinity);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3485 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
3486 });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3487 $("#pr_calcium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3488 $("#pr_magnesium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3489 $("#pr_sodium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3490 $("#pr_total_alkalinity").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3491 $("#pr_chloride").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3492 $("#pr_sulfate").jqxNumberInput( Show1wat );
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
3493
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3494 // Water agents
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3495 $("#wa_cacl2").jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.'});
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3496 $("#wa_cacl2").jqxNumberInput( Spin1dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3497 $("#wa_caso4").jqxTooltip({ content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.'});
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3498 $("#wa_caso4").jqxNumberInput( Spin1dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3499 $("#wa_mgso4").jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!'});
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3500 $("#wa_mgso4").jqxNumberInput( Spin1dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3501 $("#wa_nacl").jqxTooltip({ content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.'});
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3502 $("#wa_nacl").jqxNumberInput( Spin1dec );
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3503 $("#mash_ph").jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'});
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3504 $("#mash_ph").jqxNumberInput( SpinpH );
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
3505 $("#calc_acid").jqxCheckBox({ theme: theme, width: 120, height: 23 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3506 $("#wa_base_name").jqxDropDownList({
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3507 theme: theme,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3508 source: BaseTypeAdapter,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3509 valueMember: 'id',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3510 displayMember: 'nl',
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3511 width: 170,
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3512 height: 23,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3513 autoDropDownHeight: true
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3514 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3515 $("#wa_base").jqxNumberInput( Spin2dec );
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3516 $("#wa_base").jqxNumberInput({ symbol: ' gr', symbolPosition: 'right' });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3517 $("#wa_acid_name").jqxDropDownList({
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3518 theme: theme,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3519 source: AcidTypeAdapter,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3520 valueMember: 'id',
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3521 displayMember: 'nl',
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3522 width: 170,
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3523 height: 23,
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3524 autoDropDownHeight: true
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3525 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3526 $("#wa_acid").jqxNumberInput( Spin2dec );
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3527 $("#wa_acid").jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' });
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3528 $("#wa_acid_perc").jqxNumberInput( Perc0 );
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3529 $("#wa_acid_perc").jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3530 // Sparge water
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3531 $("#sparge_temp").jqxNumberInput( Spin1dec );
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3532 $("#sparge_volume").jqxNumberInput( Spin1dec );
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3533 $("#sparge_ph").jqxNumberInput( SpinpH );
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3534 $("#sparge_source").jqxDropDownList({
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3535 theme: theme,
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3536 source: SpargeSourceAdapter,
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3537 valueMember: 'id',
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3538 displayMember: 'nl',
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3539 width: 110,
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3540 height: 23,
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3541 autoDropDownHeight: true
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3542 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 241
diff changeset
3543 $("#sparge_acid_amount").jqxNumberInput( Spin2dec );
230
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3544 $("#sparge_acid_amount").jqxNumberInput({ spinButtons: false, readOnly: true, symbol: ' ml', symbolPosition: 'right' });
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3545 $("#sparge_acid_type").jqxDropDownList({
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3546 theme: theme,
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3547 source: AcidTypeAdapter,
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3548 valueMember: 'id',
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3549 displayMember: 'nl',
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3550 width: 110,
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3551 height: 23,
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3552 autoDropDownHeight: true
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3553 });
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3554 $("#sparge_acid_perc").jqxNumberInput( Perc0 );
8edca0488e65 Finished the water treatment in the recipes editor. It seems that the recipes editor is ready.
Michiel Broek <mbroek@mbse.eu>
parents: 229
diff changeset
3555 $("#sparge_acid_perc").jqxNumberInput({ symbol: '%', symbolPosition: 'right' });
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
3556
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3557 // Tabs inside the popup window.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3558 $('#jqxTabs').jqxTabs({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3559 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3560 width: 1280,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3561 height: 630,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3562 autoHeight: false,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3563 position: 'top'
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3564 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3565
79
f3adf543f698 Added recipe print button.
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
3566 $("#Print").jqxButton({ template: "info", width: '80px', theme: theme });
f3adf543f698 Added recipe print button.
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
3567 $("#Print").click(function () {
f3adf543f698 Added recipe print button.
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
3568 // Open print in a new tab.
f3adf543f698 Added recipe print button.
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
3569 var url="rec_print.php?record=" + my_record;
f3adf543f698 Added recipe print button.
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
3570 window.open(url);
f3adf543f698 Added recipe print button.
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
3571 });
f3adf543f698 Added recipe print button.
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
3572
175
da16371538c3 When importing from brouwhulp use 0 and 1 instead of false and true for boolean variables. Added Export button to the recipe editor. Added beerxml recipe export.
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
3573 $("#Export").jqxButton({ template: "info", width: '80px', theme: theme });
da16371538c3 When importing from brouwhulp use 0 and 1 instead of false and true for boolean variables. Added Export button to the recipe editor. Added beerxml recipe export.
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
3574 $("#Export").click(function () {
da16371538c3 When importing from brouwhulp use 0 and 1 instead of false and true for boolean variables. Added Export button to the recipe editor. Added beerxml recipe export.
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
3575 // Open print in a new tab.
da16371538c3 When importing from brouwhulp use 0 and 1 instead of false and true for boolean variables. Added Export button to the recipe editor. Added beerxml recipe export.
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
3576 var url="rec_export.php?record=" + my_record;
da16371538c3 When importing from brouwhulp use 0 and 1 instead of false and true for boolean variables. Added Export button to the recipe editor. Added beerxml recipe export.
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
3577 window.open(url);
da16371538c3 When importing from brouwhulp use 0 and 1 instead of false and true for boolean variables. Added Export button to the recipe editor. Added beerxml recipe export.
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
3578 });
da16371538c3 When importing from brouwhulp use 0 and 1 instead of false and true for boolean variables. Added Export button to the recipe editor. Added beerxml recipe export.
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
3579
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3580 $("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3581 $("#Delete").click(function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3582 // Open a popup to confirm this action.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3583 $('#eventWindow').jqxWindow('open');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3584 $("#delOk").click(function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3585 var data = "delete=true&" + $.param({ record: my_record });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3586 $.ajax({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3587 dataType: 'json',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3588 url: url,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3589 cache: false,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3590 data: data,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3591 type: "POST",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3592 success: function (data, status, xhr) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3593 // delete command is executed.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3594 window.location.href = my_return;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3595 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3596 error: function (jqXHR, textStatus, errorThrown) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3597 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3598 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3599 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3600 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3601
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3602 $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3603 $("#Cancel").click(function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3604 window.location.href = my_return;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3605 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3606
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3607 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3608 $("#Save").click(function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3609 var fermentablerow = $('#fermentableGrid').jqxGrid('getrows');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3610 var hoprow = $('#hopGrid').jqxGrid('getrows');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3611 var miscrow = $('#miscGrid').jqxGrid('getrows');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3612 var yeastrow = $('#yeastGrid').jqxGrid('getrows');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3613 var mashrow = $('#mashGrid').jqxGrid('getrows');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3614 var row = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3615 record: my_record,
166
635033a29c48 Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
3616 uuid: dataRecord.uuid,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3617 name: $("#name").val(),
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
3618 locked: $("#locked").val(),
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3619 notes: $("#notes").val(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3620 st_name: $('#st_name').val(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3621 st_letter: $('#st_letter').val(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3622 st_guide: $('#st_guide').val(),
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3623 st_type: dataRecord.st_type,
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
3624 st_category: $('#st_category').val(),
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
3625 st_category_number: parseFloat($("#st_category_number").jqxNumberInput('decimal')),
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3626 st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3627 st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3628 st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3629 st_fg_max: parseFloat($("#st_fg_max").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3630 st_ibu_min: parseFloat($("#st_ibu_min").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3631 st_ibu_max: parseFloat($("#st_ibu_max").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3632 st_color_min: parseFloat($("#st_color_min").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3633 st_color_max: parseFloat($("#st_color_max").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3634 st_carb_min: parseFloat($("#st_carb_min").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3635 st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3636 st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')),
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
3637 st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')),
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3638 type: $("#type").val(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3639 batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')),
95
8dc0a00b1db4 Boil_size volume toegevoegd.
Michiel Broek <mbroek@mbse.eu>
parents: 85
diff changeset
3640 boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')),
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3641 boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3642 efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3643 est_og: parseFloat($("#est_og").jqxNumberInput('decimal')),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3644 est_fg: parseFloat($("#est_fg").jqxNumberInput('decimal')),
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
3645 est_abv: parseFloat($("#est_abv").jqxNumberInput('decimal')),
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3646 est_color: parseFloat($("#est_color").jqxNumberInput('decimal')),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3647 color_method: $("#color_method").val(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3648 est_ibu: parseFloat($("#est_ibu").jqxNumberInput('decimal')),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3649 ibu_method: $("#ibu_method").val(),
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
3650 est_carb: parseFloat($("#est_carb").jqxNumberInput('decimal')),
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3651 mash_name: $("#mash_name").val(),
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3652 mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')),
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
3653 sparge_temp: parseFloat($("#sparge_temp").jqxNumberInput('decimal')),
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
3654 sparge_ph: parseFloat($("#sparge_ph").jqxNumberInput('decimal')),
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
3655 sparge_volume: parseFloat($("#sparge_volume").jqxNumberInput('decimal')),
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
3656 sparge_source: $("#sparge_source").val(),
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
3657 sparge_acid_type: $("#sparge_acid_type").val(),
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
3658 sparge_acid_perc: parseFloat($("#sparge_acid_perc").jqxNumberInput('decimal')),
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
3659 sparge_acid_amount: dataRecord.sparge_acid_amount,
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
3660 calc_acid: $("#calc_acid").val(),
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3661 w1_name: $("#w1_name").val(),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3662 w1_amount: parseFloat($("#w1_amount").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3663 w1_calcium: parseFloat($("#w1_calcium").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3664 w1_sulfate: parseFloat($("#w1_sulfate").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3665 w1_chloride: parseFloat($("#w1_chloride").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3666 w1_sodium: parseFloat($("#w1_sodium").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3667 w1_magnesium: parseFloat($("#w1_magnesium").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3668 w1_total_alkalinity: parseFloat($("#w1_total_alkalinity").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3669 w1_ph: parseFloat($("#w1_ph").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3670 w1_cost: dataRecord.w1_cost,
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3671 w2_name: $("#w2_name").val(),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3672 w2_amount: parseFloat($("#w2_amount").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3673 w2_calcium: parseFloat($("#w2_calcium").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3674 w2_sulfate: parseFloat($("#w2_sulfate").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3675 w2_chloride: parseFloat($("#w2_chloride").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3676 w2_sodium: parseFloat($("#w2_sodium").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3677 w2_magnesium: parseFloat($("#w2_magnesium").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3678 w2_total_alkalinity: parseFloat($("#w2_total_alkalinity").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3679 w2_ph: parseFloat($("#w2_ph").jqxNumberInput('decimal')),
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
3680 w2_cost: dataRecord.w2_cost,
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3681 wa_acid_name: $("#wa_acid_name").val(),
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3682 wa_acid_perc: parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')),
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3683 wa_base_name: $("#wa_base_name").val(),
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3684 fermentables: fermentablerow,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3685 hops: hoprow,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3686 miscs: miscrow,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3687 yeasts: yeastrow,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3688 mashs: mashrow
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3689 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3690 var data = "update=true&" + $.param(row);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3691 $.ajax({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3692 dataType: 'json',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3693 url: url,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3694 cache: false,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3695 data: data,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3696 type: "POST",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3697 success: function (data, status, xhr) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3698 // update command is executed.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3699 window.location.href = my_return;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3700 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3701 error: function(jqXHR, textStatus, errorThrown) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3702 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3703 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3704 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3705 createDelElements();
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3706 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3707

mercurial