www/js/rec_edit.js

Sun, 26 May 2019 20:37:28 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 26 May 2019 20:37:28 +0200
changeset 376
1de1623e1760
parent 373
ee16d9b844d8
child 380
2242521067a7
permissions
-rw-r--r--

Inventory fermentables convert diastatic power between kolbach and lintner. In recipe and product editors calculate the recipe lintner value. For now a raw presentation of the outcome.

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;
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
49 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
50 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
51 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
52 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
53 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
54 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
55 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
56 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
57 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
58
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 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
60 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
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 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
69 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
70 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
71 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
72 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
73 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
74
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
75 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
76 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
77 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
78 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
79 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
80 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
81 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
82 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
83 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
84 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
85
283
879b81864e4e The product and recipe editors disable the top menu so the user is forced to exit using the buttons on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents: 271
diff changeset
86 /*
879b81864e4e The product and recipe editors disable the top menu so the user is forced to exit using the buttons on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents: 271
diff changeset
87 * Remove the top menu so that we MUST use the buttons to leave the editor.
879b81864e4e The product and recipe editors disable the top menu so the user is forced to exit using the buttons on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents: 271
diff changeset
88 */
879b81864e4e The product and recipe editors disable the top menu so the user is forced to exit using the buttons on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents: 271
diff changeset
89 $('#jqxMenu').jqxMenu('destroy');
879b81864e4e The product and recipe editors disable the top menu so the user is forced to exit using the buttons on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents: 271
diff changeset
90
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 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
92 $("#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
93 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
94 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
95 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
96 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
97 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
98 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99
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 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
101 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
102 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
103 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
104 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
105 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
106 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
107 }
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 $("#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
109 $("#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
110 $("#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
111 $("#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
112 $("#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
113 // 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
114 $("#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
115 $("#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
116 $("#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
117 $("#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
118 $("#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
119 $("#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
120 $("#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
121 $("#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
122 $("#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
123 $("#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
124 $("#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
125 $("#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
126 $("#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
127 $("#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
128 $("#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
129 $("#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
130 $("#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
131 $("#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
132 $("#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
133 $("#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
134 $("#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
135 $("#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
136 $("#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
137 $("#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
138 $("#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
139 $("#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
140 $("#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
141 $("#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
142 $("#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
143 $("#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
144 $("#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
145 $("#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
146 $("#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
147 $("#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
148 $("#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
149 $("#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
150 $("#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
151 $("#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
152 $("#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
153 $("#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
154 $("#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
155 $("#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
156 $("#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
157 $("#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
158 };
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
159
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
160 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
161 console.log("calcFermentables()");
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
162 sugarsf = 0; // fermentable sugars mash + boil
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
163 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
164 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
165 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
166 mashkg = 0;
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
167 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
168 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
169 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
170 var mvol = 0; // mash volume
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
171 var colort = 0; // Colors srm * vol totals
372
1365b5e47130 Added color method written by Hans Halberstadt.
Michiel Broek <mbroek@mbse.eu>
parents: 359
diff changeset
172 var colorh = 0; // Colors ebc * vol * kt
373
ee16d9b844d8 Added some info yo the about screen. Added calculating beer color using the method documented by Dirk Naudt. This looks like originated from a European Brewing Convention in 1948.
Michiel Broek <mbroek@mbse.eu>
parents: 372
diff changeset
173 var colorn = 0; // Colors ebc * pt * pct
127
6d5e215d77d2 Added fermentables Moment dropdown list. Added fermentables adjust to 100% logic.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
174 var my_100 = false;
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
175 var mashtime = 0; // Total mash time
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
176 var mashtemp = 0; // Average mash temperature
372
1365b5e47130 Added color method written by Hans Halberstadt.
Michiel Broek <mbroek@mbse.eu>
parents: 359
diff changeset
177 var bv = 0.925; // Bierverlies rendement
1365b5e47130 Added color method written by Hans Halberstadt.
Michiel Broek <mbroek@mbse.eu>
parents: 359
diff changeset
178 var sr = 0.95; // Mash en spoel rendement
376
1de1623e1760 Inventory fermentables convert diastatic power between kolbach and lintner. In recipe and product editors calculate the recipe lintner value. For now a raw presentation of the outcome.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
179 var lintner = 0; // Total recipe lintner
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
180
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
181 if ((rows = $('#mashGrid').jqxGrid('getrows'))) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
182 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
183 var row = rows[i];
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
184 if (row.step_type == 0) // Infusion
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
185 mvol += parseFloat(row.step_infuse_amount);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
186 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
187 mashtime += row.step_time;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
188 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
189 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
190 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
191 mashtemp = mashtemp / mashtime;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
192 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
193
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
194 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
195 return; // grid not yet loaded.
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
196 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
197
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
198 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
199 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
200 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
201 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
202 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
203 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
204 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
205 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
206 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
207 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
208 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
209 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
210 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
211 s += d;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
212 }
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
213 d = parseFloat(dataRecord.efficiency) / 100 * d;
97
22c277be7e7e Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
214 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
215 mashkg += row.f_amount;
97
22c277be7e7e Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
216 }
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
217 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
218 sugarsf += d;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
219 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
220 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
221 addedS += row.f_amount * x;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
222 addedmass += row.f_amount;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
223 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
224 }
376
1de1623e1760 Inventory fermentables convert diastatic power between kolbach and lintner. In recipe and product editors calculate the recipe lintner value. For now a raw presentation of the outcome.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
225 if (row.f_added == 0 && (row.f_type == 0 || row.f_type == 4) && row.f_color < 50) { // Mash and Grain/Adjunct and Color < 50
1de1623e1760 Inventory fermentables convert diastatic power between kolbach and lintner. In recipe and product editors calculate the recipe lintner value. For now a raw presentation of the outcome.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
226 lintner += row.f_diastatic_power * row.f_amount;
1de1623e1760 Inventory fermentables convert diastatic power between kolbach and lintner. In recipe and product editors calculate the recipe lintner value. For now a raw presentation of the outcome.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
227 }
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
228 colort += row.f_amount * ebc_to_srm(row.f_color);
372
1365b5e47130 Added color method written by Hans Halberstadt.
Michiel Broek <mbroek@mbse.eu>
parents: 359
diff changeset
229 colorh += row.f_amount * row.f_color * get_kt(row.f_color);
373
ee16d9b844d8 Added some info yo the about screen. Added calculating beer color using the method documented by Dirk Naudt. This looks like originated from a European Brewing Convention in 1948.
Michiel Broek <mbroek@mbse.eu>
parents: 372
diff changeset
230 colorn += (row.f_percentage / 100) * row.f_color; // For 8.6 Pt wort.
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
231 }
376
1de1623e1760 Inventory fermentables convert diastatic power between kolbach and lintner. In recipe and product editors calculate the recipe lintner value. For now a raw presentation of the outcome.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
232 $("#ferm_lintner").val(Math.round(parseFloat(lintner / mashkg)));
1de1623e1760 Inventory fermentables convert diastatic power between kolbach and lintner. In recipe and product editors calculate the recipe lintner value. For now a raw presentation of the outcome.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
233 console.log("lintner:"+lintner+" kg:"+mashkg);
127
6d5e215d77d2 Added fermentables Moment dropdown list. Added fermentables adjust to 100% logic.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
234 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
235 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
236 $("#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
237 } 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
238 $("#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
239 }
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
240
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
241 // Estimate total recipe OG.
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
242 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
243 $('#est_og').val(dataRecord.est_og);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
244 $('#est_og2').val(dataRecord.est_og);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
245
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
246 // Estimate SG in kettle before boil
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
247 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
248
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
249 // Color of the wort
373
ee16d9b844d8 Added some info yo the about screen. Added calculating beer color using the method documented by Dirk Naudt. This looks like originated from a European Brewing Convention in 1948.
Michiel Broek <mbroek@mbse.eu>
parents: 372
diff changeset
250 if (dataRecord.color_method == 4) {
ee16d9b844d8 Added some info yo the about screen. Added calculating beer color using the method documented by Dirk Naudt. This looks like originated from a European Brewing Convention in 1948.
Michiel Broek <mbroek@mbse.eu>
parents: 372
diff changeset
251 var color = Math.round(((sg_to_plato(dataRecord.est_og) / 8.6) * colorn) + (dataRecord.boil_time / 60));
ee16d9b844d8 Added some info yo the about screen. Added calculating beer color using the method documented by Dirk Naudt. This looks like originated from a European Brewing Convention in 1948.
Michiel Broek <mbroek@mbse.eu>
parents: 372
diff changeset
252 } else if (dataRecord.color_method == 3) { // Hans Halberstadt
372
1365b5e47130 Added color method written by Hans Halberstadt.
Michiel Broek <mbroek@mbse.eu>
parents: 359
diff changeset
253 var color = Math.round((4.46 * bv * sr) / parseFloat(dataRecord.batch_size) * colorh);
1365b5e47130 Added color method written by Hans Halberstadt.
Michiel Broek <mbroek@mbse.eu>
parents: 359
diff changeset
254 } else {
1365b5e47130 Added color method written by Hans Halberstadt.
Michiel Broek <mbroek@mbse.eu>
parents: 359
diff changeset
255 var cw = colort / parseFloat(dataRecord.batch_size) * 8.34436;
1365b5e47130 Added color method written by Hans Halberstadt.
Michiel Broek <mbroek@mbse.eu>
parents: 359
diff changeset
256 var color = kw_to_ebc(dataRecord.color_method, cw);
1365b5e47130 Added color method written by Hans Halberstadt.
Michiel Broek <mbroek@mbse.eu>
parents: 359
diff changeset
257 }
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
258 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
259 $('#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
260 $('#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
261 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
262 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
263 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
264
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
265 // 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
266 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
267 $("#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
268 $("#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
269 $("#perc_cara").jqxProgressBar('val', pcara);
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
270
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
271 // Calculate estimated svg.
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
272 svg = 0; // default.
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
273 var rows = $('#yeastGrid').jqxGrid('getrows');
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
274 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
275 var row = rows[i];
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
276 if (row.y_use == 0) { // Primary
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
277 if (parseFloat(row.y_attenuation) > svg)
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
278 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
279 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
280 // TODO: brett in secondary ??
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
281 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
282 if (svg == 0)
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
283 svg = 77;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
284
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
285 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
286 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
287 } else {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
288 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
289 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
290 $('#est_fg').val(dataRecord.est_fg);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
291 $('#est_fg2').val(dataRecord.est_fg);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
292
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
293 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
294 $("#est_abv").val(dataRecord.est_abv);
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
295 $("#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
296 };
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
297
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
298 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
299 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
300
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 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
302 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
303 } 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
304 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
305 } 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
306 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
307 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
308 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
309 }
343
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
310 return (result * amount * 1000) / vol;
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
311 }
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
312
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 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
314 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
315
343
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
316 if (use == 5) { // Dry hop
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
317 result = 1.33;
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
318 } else if (bt > 20) {
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
319 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
320 } 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
321 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
322 } 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
323 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
324 } 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
325 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
326 } 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
327 result = 1.2;
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
328 }
343
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
329 return (result * amount * 1000) / vol;
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
330 }
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
331
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
332 function calcMash() {
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
333
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
334 if (!(rows = $('#mashGrid').jqxGrid('getrows')))
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
335 return;
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
336 if (mashkg == 0)
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
337 return;
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
338
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
339 var infused = 0;
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
340 for (var i = 0; i < rows.length; i++) {
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
341 var row = $("#mashGrid").jqxGrid('getrowdata', i);
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
342 if (row.step_type == 0) // Infusion
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
343 infused += row.step_infuse_amount;
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
344 $("#mashGrid").jqxGrid('setcellvalue', i, "step_thickness", infused / mashkg);
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
345 }
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
346 }
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
347
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
348 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
349 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
350 hop_aroma = hop_flavour = 0;
343
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
351 var rows = {};
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
352 if (!(rows = $('#hopGrid').jqxGrid('getrows'))) {
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
353 return;
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
354 }
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
355 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
356 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
357 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
358 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
359 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
360 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
361 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
362 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
363 }
343
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
364 total_ibus = Math.round(total_ibus * 10) / 10;
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
365 hop_flavour = Math.round(hop_flavour * 100) / 10;
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
366 hop_aroma = Math.round(hop_aroma * 100) / 10;
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
367 if (hop_flavour > 100)
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
368 hop_flavour = 100;
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
369 if (hop_aroma > 100)
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
370 hop_aroma = 100;
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
371 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
372 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
373 $('#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
374 $('#est_ibu2').val(total_ibus);
343
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
375 $("#hop_flavour").jqxProgressBar('val', hop_flavour);
82184e3be6d9 Backport hop calculations from product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 340
diff changeset
376 $("#hop_aroma").jqxProgressBar('val', hop_aroma);
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
377 };
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
378
263
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
379 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
380
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
381 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
382
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
383 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
384 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
385 return;
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 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
388 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
389 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
390 $("#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
391 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
392 };
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
393
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
394 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
395
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
396 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
397
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 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
399 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
400 return;
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 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
403 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
404 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
405 $("#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
406 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
407 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
408 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
409 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
410 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
411 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
412 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
413 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
414 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
415 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
416 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
417 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
418 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
419 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
420 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
421 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
422 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
423 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
424 break;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
425 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
426 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
427 };
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
428
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
429 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
430
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
431 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
432
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
433 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
434 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
435 return;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
436
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
437 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
438 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
439 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
440 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
441 $("#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
442 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
443 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
444 };
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
445
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
446 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
447
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
448 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
449
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
450 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
451 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
452 return;
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
453
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
454 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
455 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
456 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
457 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
458 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
459 $("#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
460 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
461 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
462 }
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
463 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
464 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
465 $("#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
466 } else {
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
467 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
468 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
469 $("#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
470 $("#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
471 }
264
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
472 $('#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
473 };
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
474
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
475 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
476 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
477 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
478 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
479 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
480 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
481 }
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
482
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
483 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
484 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
485 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
486 }
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
487
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
488 function setWaterAgent(name, amount) {
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
489 //console.log("setWaterAgent(" + name + ", " + 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
490 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
491 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
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 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
496 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
497 }
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 } 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
500 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
501 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
502 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
503 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
504 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
505 $("#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
506 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
507 }
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 }
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 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
510 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
511 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
512 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
513 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
514 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
515 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
516 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
517 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
518 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
519 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
520 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
521 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
522 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
523 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
524 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
525 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
526 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
527 }
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
528 }
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
529 }
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
530 });
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
531 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
532 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
533 }
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
534 }
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
535 }
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
536
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
537 function setRangeIndicator(ion, rangeCode) {
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
538 if ((rangeCode == "laag") || (rangeCode == "hoog"))
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
539 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>"+rangeCode + "</span>");
262
36cf32fcd210 Swapped icons
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
540 else
36cf32fcd210 Swapped icons
Michiel Broek <mbroek@mbse.eu>
parents: 261
diff changeset
541 $("#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
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
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
544 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
545 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
546 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
547 }
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
548 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
549 }
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
550
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
551 // mg/l as CaCO3
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
552 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
553 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
554 }
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
555
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
556 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
557 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
558
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 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
560 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
561 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
562 }
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
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 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
565 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
566 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
567 }
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
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
569 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
570 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
571 }
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
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 //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
574 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
575 var C43 = Charge(4.3);
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
576 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
577 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
578 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
579 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
580 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
581 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
582 }
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
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
584 //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
585 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
586
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 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
588 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
589 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
590 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
591 }
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
592
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
593 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
594
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
595 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
596 // 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
597 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
598 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
599 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
600 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
601 // 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
602 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
603 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
604 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
605 } else {
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
606 // 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
607 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
608 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
609 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
610 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
611 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
612 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
613 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
614 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
615 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
616 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
617 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
618 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
619 }
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
620 }
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
621 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
622 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
623 }
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 }
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
625 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
626 }
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
627
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
628 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
629 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
630 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
631 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
632 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
633 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
634 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
635 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
636 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
637 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
638 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
639 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
640 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
641 }
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 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
643 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
644 }
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
645
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
646 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
647 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
648 case 0: return { // Melkzuur
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
649 pK1: 3.86,
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
650 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
651 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
652 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
653 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
654 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
655 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable 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 case 1: return { // Zoutzuur
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
657 pK1: -7,
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
658 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
659 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
660 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
661 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
662 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
663 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable 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 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
665 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
666 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
667 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
668 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
669 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
670 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
671 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable 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 case 3: return { // Zwavelzuur
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
673 pK1: -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
674 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
675 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
676 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
677 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
678 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
679 };
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
680 }
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
681 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
682 }
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
683
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
684 // 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
685 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
686
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 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
688 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
689 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
690 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
691 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
692 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
693 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
694 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
695 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
696 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
697 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
698 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
699 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
700 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
701 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
702
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
703 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
704 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
705 }
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 // 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
707
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 // 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
709 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
710 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
711 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
712 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
713 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
714 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
715 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
716 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
717 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
718 } 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
719 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
720 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
721 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
722 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
723 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
724 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
725 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
726 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
727 }
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
728 $('#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
729 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
730 $('#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
731 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
732 $('#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
733 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
734 $('#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
735 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
736 $('#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
737 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
738 $('#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
739 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
740 $('#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
741 // 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
742 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
743 $('#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
744 $('#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
745 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
746 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
747
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 // 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
749 // 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
750 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
751 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
752 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
753
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
754 // 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
755 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
756 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
757
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 // 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
759 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
760 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
761
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 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
763 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
764 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
765 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
766
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
767 // 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
768 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
769 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
770 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
771 // 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
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 ($("#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
774 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
775 $("#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
776 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
777 }
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
778 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
779 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
780
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 ($("#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
782 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
783 $("#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
784 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
785 }
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
786 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
787 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
788
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
789 var AT = dataRecord.wa_acid_name;
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
790 var BT = dataRecord.wa_base_name;
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
791
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
792 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
793 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
794 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
795 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
796 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
797 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
798 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
799
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 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
801 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
802 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
803 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
804 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
805 $("#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
806 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
807 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
808 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
809 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
810 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
811 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
812
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
813 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
814 $("#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
815 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
816 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
817 $("#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
818 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
819
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
820 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
821 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
822 } 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
823 $("#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
824 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
825 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
826 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
827 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
828 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
829 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
830 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
831 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
832 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
833 $("#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
834 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
835 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
836 // 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
837 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
838 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
839 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
840 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
841 // 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
842 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
843 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
844 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
845 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
846 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
847 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable 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 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
849 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
850 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
851 $("#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
852 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
853 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
854 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
855 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
856 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
857 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
858 // 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
859 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
860 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
861 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
862 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
863 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
864 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable 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 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
866 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
867 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
868 //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
869 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
870 $("#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
871 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
872 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
873 //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
874 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
875 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
876 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
877 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
878 //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
879 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
880 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
881 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
882 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
883 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
884 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
885 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable 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 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
887 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
888 $("#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
889 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
890 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
891 // 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
892 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
893 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
894 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
895 // 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
896 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
897 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
898 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
899 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
900 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
901 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
902 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
903 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
904 }
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 }
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 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
907 $('#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
908 } 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
909 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
910 // 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
911 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
912 if (liters > 0) {
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
913 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
914 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
915 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
916 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
917 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
918 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
919 // 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
920 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
921 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
922 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
923 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
924 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
925 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
926 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
927 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
928 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
929 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
930 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
931 // 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
932 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
933 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
934 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
935 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
936 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
937 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
938 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
939 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
940 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
941 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
942 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
943 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
944 // 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
945 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
946 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
947 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
948 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
949 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
950 break;
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
951 }
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
952 }
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
953 }
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
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 TpH = parseFloat(dataRecord.mash_ph);
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
956 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
957 // 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
958 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
959 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
960 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
961 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
962 $("#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
963 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
964 Acid *= AcidSG; // ml
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
965 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
966 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
967
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
968 //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
969 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
970 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
971
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
972 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
973 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
974 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
975 var n = 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
976 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
977 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
978 if (pd < (protonDeficit-deltapd))
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
979 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
980 else if (pd > (protonDeficit+deltapd))
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
981 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
982 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
983 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
984 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
985 }
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
986 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
987 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
988 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
989 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
990 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
991 $('#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
992 }
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
993 }
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
994
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
995 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
996 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
997 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
998 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
999 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
1000 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
1001 } 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
1002 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
1003 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
1004 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
1005 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
1006 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
1007 }
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
1008
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1009 // 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
1010 // 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
1011 // 1:2 Sulfate to Chloride Malty
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1012 // Note, values below are the other way, cl to so4!
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1013 // So: 0.5 is IPA's, Pale Ales.
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1014 // 1 Balanced
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1015 // 2 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
1016 $('#tgt_bu').val(Math.round(GetBUGU() * 100) / 100);
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1017 // From brouwhulp.
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1018 if (GetBUGU() < 0.32)
348
5fc0f4b42224 Improved BUGU descriptions.
Michiel Broek <mbroek@mbse.eu>
parents: 347
diff changeset
1019 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig en zoet</span>");
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1020 else if (GetBUGU() < 0.43)
348
5fc0f4b42224 Improved BUGU descriptions.
Michiel Broek <mbroek@mbse.eu>
parents: 347
diff changeset
1021 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig, zoet</span>");
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1022 else if (GetBUGU() < 0.52)
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1023 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>");
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1024 else if (GetBUGU() < 0.63)
348
5fc0f4b42224 Improved BUGU descriptions.
Michiel Broek <mbroek@mbse.eu>
parents: 347
diff changeset
1025 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht hoppig, bitter</span>");
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1026 else
348
5fc0f4b42224 Improved BUGU descriptions.
Michiel Broek <mbroek@mbse.eu>
parents: 347
diff changeset
1027 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Extra hoppig, zeer bitter</span>");
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1028 $('#tgt_cl_so4').val(Math.round(GetOptClSO4ratio() * 10) / 10);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1029 if (sulfate > 0)
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1030 RA = chloride / sulfate;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1031 else
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1032 RA = 10;
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1033 $('#got_cl_so4').val(Math.round(RA * 10) / 10);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1034 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
1035 var piCLSO4_high = 1.2 * GetOptClSO4ratio();
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1036 var Res = 'normaal';
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1037 if (RA < piCLSO4_low)
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1038 Res = 'laag';
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1039 else if (RA > piCLSO4_high)
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1040 Res = 'hoog';
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1041 setRangeIndicator('cl_so4', Res);
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
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 $('#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
1044 $('#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
1045 $('#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
1046 $('#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
1047 $('#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
1048 $('#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
1049
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
1050 if (calcium < 40) {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1051 setRangeIndicator("calcium", "laag");
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
1052 } else if (calcium > 150) {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1053 setRangeIndicator("calcium", "hoog");
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
1054 } else {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1055 setRangeIndicator("calcium", "normaal");
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
1056 }
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
1057 if (magnesium >= 0 && magnesium <= 30) {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1058 setRangeIndicator("magnesium", "normaal");
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
1059 } else {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1060 setRangeIndicator("magnesium", "hoog");
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
1061 }
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
1062 if (sodium <= 150) {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1063 setRangeIndicator("sodium", "normaal");
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
1064 } else {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1065 setRangeIndicator("sodium", "hoog");
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
1066 }
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1067 // Both chloride and sulfate should be above 50 according to
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1068 // John Palmer. So the Cl/SO4 ratio calculation will work.
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1069 if (chloride <= 50) {
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1070 setRangeIndicator("chloride", "laag");
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1071 } else if (chloride <= 100) {
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1072 setRangeIndicator("chloride", "normaal");
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
1073 } else {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1074 setRangeIndicator("chloride", "hoog");
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1075 }
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1076 if (sulfate <= 50) {
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1077 setRangeIndicator("sulfate", "laag");
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1078 } else if (sulfate <= 350) {
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1079 setRangeIndicator("sulfate", "normaal");
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1080 } else {
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1081 setRangeIndicator("sulfate", "hoog");
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
1082 }
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
1083 if (ph < 5.2) {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1084 setRangeIndicator("ph", "laag");
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
1085 } else if (ph > 5.6) {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1086 setRangeIndicator("ph", "hoog");
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
1087 } else {
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
1088 setRangeIndicator("ph", "normaal");
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
1089 }
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1090 calcSparge();
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1091 }
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1092
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1093 function calcSparge() {
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1094
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1095 // 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
1096 var TargetpH = dataRecord.sparge_ph;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1097 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
1098 var Source_alkalinity = dataRecord.w1_total_alkalinity;
158
3b9e4dfb0476 Fixes and optimisations for water calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 156
diff changeset
1099 // 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
1100 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
1101 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
1102 Source_pH = dataRecord.w2_ph;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1103 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
1104 } 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
1105 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
1106 $("#sparge_source").val(0);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1107 }
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
1108 } 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
1109 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
1110 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
1111 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
1112 } 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
1113 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
1114 $("#sparge_source").val(0);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1115 }
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1116 }
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1117
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
1118 //console.log("calcSparge() target pH: "+TargetpH+" Source: "+Source_pH+" alkalinity: "+Source_alkalinity);
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1119
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1120 // 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
1121 var r1 = Math.pow(10, Source_pH - 6.38);
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
1122 var r2 = Math.pow(10, Source_pH - 10.373);
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
1123 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
1124 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
1125 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
1126 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
1127
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1128 //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
1129 var r143 = Math.pow(10, 4.3 - 6.38);
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
1130 var r243 = Math.pow(10, 4.3 - 10.373);
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
1131 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
1132 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
1133 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
1134 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
1135
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1136 //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
1137 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
1138 //Step 4. Solve
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
1139 var Ct = (alkalinity - 1000 * (Math.pow(10, -4.3) - Math.pow(10, -Source_pH))) / ((f143-f1)+(f3-f343));
156
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 //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
1142 var r1g = Math.pow(10, TargetpH - 6.38);
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
1143 var r2g = Math.pow(10, TargetpH - 10.373);
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
1144 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
1145 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
1146 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
1147 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
1148
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1149 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L)
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
1150 var Acid = Ct * ((f1g-f1)+(f3-f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
1151 Acid += 0.01; // Add acid that would be required for distilled water.
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
1152 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
1153 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
1154 $("#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
1155 }
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
1156
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
1157 //Step 8. Get the acid data.
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
1158 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
1159 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
1160 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
1161 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
1162 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
1163 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
1164 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
1165 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
1166 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
1167
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1168 //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
1169 Acid /= fract;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1170
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1171 //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
1172 Acid *= MolWt; //mg
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1173
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1174 Acid = Acid / AcidSG; //ml ; 88% lactic solution
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
1175 var f1 = dataRecord.sparge_acid_perc;
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1176 if (f1 <= 0.1)
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1177 f1 = AcidPrc;
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1178 Acid = Acid * AcidPrc / (f1 / 100);
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1179
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1180 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
1181 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
1182 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
1183 $("#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
1184 }
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
1185
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
1186 /*
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
1187 * 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
1188 */
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
1189 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
1190
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
1191 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
1192 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
1193 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
1194 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
1195 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
1196
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
1197 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
1198 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
1199 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
1200 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
1201 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
1202 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
1203 }
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
1204 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
1205 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
1206 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
1207
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
1208 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
1209 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
1210 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
1211 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
1212 $("#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
1213 }
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
1214 }
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
1215 };
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
1216
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
1217 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
1218 console.log("calc.init()");
135
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1219
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
1220 $("#calc_acid").on('checked', function (event) {
359
98354ef399cd Lot's of improvements for recipes and products database load and save. Insert missing yeast tolerance field for old products and recipes. Recipe locked and calc_acid fields coverted to integer. In recipe edit screen removed the Print button. It is now included in the export screen. Added recipe export to forum screen.
Michiel Broek <mbroek@mbse.eu>
parents: 352
diff changeset
1221 dataRecord.calc_acid = 1;
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
1222 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
1223 });
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
1224 $("#calc_acid").on('unchecked', function (event) {
359
98354ef399cd Lot's of improvements for recipes and products database load and save. Insert missing yeast tolerance field for old products and recipes. Recipe locked and calc_acid fields coverted to integer. In recipe edit screen removed the Print button. It is now included in the export screen. Added recipe export to forum screen.
Michiel Broek <mbroek@mbse.eu>
parents: 352
diff changeset
1225 dataRecord.calc_acid = 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
1226 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
1227 });
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
1228 $("#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
1229 $("#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
1230 // Fix tap water if zero using mash infuse amount.
336
3323b02c1bbe Fix clearing water 2 volume during product load.
Michiel Broek <mbroek@mbse.eu>
parents: 332
diff changeset
1231 if (parseFloat($("#w1_amount").jqxNumberInput('decimal')) == 0 && 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
1232 $("#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
1233 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
1234 $("#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
1235 $("#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
1236 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
1237 }
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
1238 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
1239 $("#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
1240 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
1241
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
1242 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
1243 $("#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
1244 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
1245 }
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
1246 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
1247 $("#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
1248 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
1249 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
1250 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
1251 });
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
1252 $('#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
1253 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
1254 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
1255 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
1256 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
1257 }
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
1258 });
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
1259 $('#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
1260 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
1261 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
1262 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
1263 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
1264 }
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
1265 });
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
1266 $('#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
1267 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
1268 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
1269 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
1270 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
1271 }
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
1272 });
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 $('#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
1274 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
1275 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
1276 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
1277 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
1278 }
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
1279 });
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
1280 $('#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
1281 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
1282 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
1283 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
1284 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
1285 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
1286 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
1287 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
1288 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
1289 }
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
1290 });
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
1291 $('#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
1292 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
1293 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
1294 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
1295 });
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
1296 $('#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
1297 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
1298 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
1299 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
1300 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
1301 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
1302 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
1303 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
1304 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
1305 }
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
1306 });
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
1307 $('#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
1308 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
1309 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
1310 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
1311 });
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
1312 $('#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
1313
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
1314 $('#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
1315 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
1316 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
1317 });
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
1318 $('#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
1319 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
1320 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
1321 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
1322 });
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1323 $('#batch_size').on('change', function (event) {
135
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1324 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
1325 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
1326 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
1327 dataRecord.boil_size = new_boil;
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1328 $("#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
1329 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
1330 $("#sparge_volume").val(dataRecord.sparge_volume);
135
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1331 dataRecord.batch_size = parseFloat(event.args.value);
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1332 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
1333 adjustWaters(factor);
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1334 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
1335 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
1336 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
1337 adjustYeasts(factor);
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1338 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
1339 calcWater();
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1340 calcSparge();
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
1341 calcMash();
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1342 });
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1343 $('#boil_time').on('change', function (event) {
135
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1344 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
1345 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
1346 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
1347 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
1348 // 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
1349 dataRecord.boil_time = parseFloat(event.args.value);
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1350 dataRecord.boil_size = new_boil;
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1351 $("#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
1352 calcFermentables();
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1353 // TODO: adjust the hops, miscs, yeast, water.
cd1403633e96 Added boil time change logic. Better precision.
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
1354 calcIBUs();
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1355 });
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1356 $('#efficiency').on('change', function (event) {
317
454851b335ad Better handling of efficience and est_og changes.
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
1357 var estog = parseFloat($("#est_og").jqxNumberInput('decimal'));
454851b335ad Better handling of efficience and est_og changes.
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
1358 dataRecord.efficiency = parseFloat(event.args.value);
454851b335ad Better handling of efficience and est_og changes.
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
1359 console.log("efficiency change:"+dataRecord.efficiency);
454851b335ad Better handling of efficience and est_og changes.
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
1360 calcFermentablesFromOG(estog); // Keep the OG
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1361 calcFermentables();
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1362 calcIBUs();
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1363 });
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1364 $('#est_og').on('change', function (event) {
317
454851b335ad Better handling of efficience and est_og changes.
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
1365 dataRecord.est_og = parseFloat(event.args.value);
454851b335ad Better handling of efficience and est_og changes.
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
1366 console.log("est_og change:"+dataRecord.est_og);
454851b335ad Better handling of efficience and est_og changes.
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
1367 calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1368 calcFermentables(); // Update the recipe details
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1369 calcIBUs(); // and the IBU's.
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
1370 calcMash();
134
be59b9127978 Added change batch size and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
1371 });
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
1372 $('#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
1373 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
1374 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
1375 });
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1376
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1377 $('#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
1378 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
1379 calcSparge();
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1380 });
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1381 $('#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
1382 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
1383 calcSparge();
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1384 });
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1385 $('#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
1386 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
1387 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
1388 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
1389 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
1390 }
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1391 });
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1392 $('#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
1393 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
1394 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
1395 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
1396 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
1397 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
1398 }
156
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1399 });
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1400 $('#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
1401 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
1402 calcSparge();
35860890224c Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
1403 });
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
1404 $('#locked').on('checked', function (event) {
359
98354ef399cd Lot's of improvements for recipes and products database load and save. Insert missing yeast tolerance field for old products and recipes. Recipe locked and calc_acid fields coverted to integer. In recipe edit screen removed the Print button. It is now included in the export screen. Added recipe export to forum screen.
Michiel Broek <mbroek@mbse.eu>
parents: 352
diff changeset
1405 dataRecord.locked = 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
1406 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
1407 });
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
1408 $('#locked').on('unchecked', function (event) {
359
98354ef399cd Lot's of improvements for recipes and products database load and save. Insert missing yeast tolerance field for old products and recipes. Recipe locked and calc_acid fields coverted to integer. In recipe edit screen removed the Print button. It is now included in the export screen. Added recipe export to forum screen.
Michiel Broek <mbroek@mbse.eu>
parents: 352
diff changeset
1409 dataRecord.locked = 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
1410 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
1411 });
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
1412 // 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
1413 };
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
1414
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
1415 $("#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
1416 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
1417 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
1418 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
1419 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
1420 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
1421 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
1422 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
1423 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
1424 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
1425 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
1426 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
1427 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
1428 }
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
1429 });
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
1430 $("#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
1431 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
1432 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
1433 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
1434 $("#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
1435 $("#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
1436 $("#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
1437 $("#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
1438 $("#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
1439 $("#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
1440 $("#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
1441 $("#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
1442 $("#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
1443 $("#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
1444 $("#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
1445 $("#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
1446 $("#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
1447 $("#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
1448 $("#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
1449 $("#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
1450 $("#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
1451 $("#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
1452 }
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
1453 });
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
1454
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1455 function saveRecord() {
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1456 var fermentablerow = $('#fermentableGrid').jqxGrid('getrows');
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1457 var hoprow = $('#hopGrid').jqxGrid('getrows');
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1458 var miscrow = $('#miscGrid').jqxGrid('getrows');
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1459 var yeastrow = $('#yeastGrid').jqxGrid('getrows');
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1460 var mashrow = $('#mashGrid').jqxGrid('getrows');
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1461 var row = {
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1462 record: my_record,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1463 uuid: dataRecord.uuid,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1464 name: $("#name").val(),
359
98354ef399cd Lot's of improvements for recipes and products database load and save. Insert missing yeast tolerance field for old products and recipes. Recipe locked and calc_acid fields coverted to integer. In recipe edit screen removed the Print button. It is now included in the export screen. Added recipe export to forum screen.
Michiel Broek <mbroek@mbse.eu>
parents: 352
diff changeset
1465 locked: dataRecord.locked,
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1466 notes: $("#notes").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1467 st_name: $('#st_name').val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1468 st_letter: $('#st_letter').val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1469 st_guide: $('#st_guide').val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1470 st_type: dataRecord.st_type,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1471 st_category: $('#st_category').val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1472 st_category_number: parseFloat($("#st_category_number").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1473 st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1474 st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1475 st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1476 st_fg_max: parseFloat($("#st_fg_max").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1477 st_ibu_min: parseFloat($("#st_ibu_min").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1478 st_ibu_max: parseFloat($("#st_ibu_max").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1479 st_color_min: parseFloat($("#st_color_min").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1480 st_color_max: parseFloat($("#st_color_max").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1481 st_carb_min: parseFloat($("#st_carb_min").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1482 st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1483 st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1484 st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1485 type: $("#type").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1486 batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1487 boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1488 boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1489 efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1490 est_og: parseFloat($("#est_og").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1491 est_fg: parseFloat($("#est_fg").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1492 est_abv: parseFloat($("#est_abv").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1493 est_color: parseFloat($("#est_color").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1494 color_method: $("#color_method").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1495 est_ibu: parseFloat($("#est_ibu").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1496 ibu_method: $("#ibu_method").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1497 est_carb: parseFloat($("#est_carb").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1498 mash_name: $("#mash_name").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1499 mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1500 sparge_temp: parseFloat($("#sparge_temp").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1501 sparge_ph: parseFloat($("#sparge_ph").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1502 sparge_volume: parseFloat($("#sparge_volume").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1503 sparge_source: $("#sparge_source").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1504 sparge_acid_type: $("#sparge_acid_type").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1505 sparge_acid_perc: parseFloat($("#sparge_acid_perc").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1506 sparge_acid_amount: dataRecord.sparge_acid_amount,
359
98354ef399cd Lot's of improvements for recipes and products database load and save. Insert missing yeast tolerance field for old products and recipes. Recipe locked and calc_acid fields coverted to integer. In recipe edit screen removed the Print button. It is now included in the export screen. Added recipe export to forum screen.
Michiel Broek <mbroek@mbse.eu>
parents: 352
diff changeset
1507 calc_acid: dataRecord.calc_acid,
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1508 w1_name: $("#w1_name").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1509 w1_amount: parseFloat($("#w1_amount").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1510 w1_calcium: parseFloat($("#w1_calcium").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1511 w1_sulfate: parseFloat($("#w1_sulfate").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1512 w1_chloride: parseFloat($("#w1_chloride").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1513 w1_sodium: parseFloat($("#w1_sodium").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1514 w1_magnesium: parseFloat($("#w1_magnesium").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1515 w1_total_alkalinity: parseFloat($("#w1_total_alkalinity").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1516 w1_ph: parseFloat($("#w1_ph").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1517 w1_cost: dataRecord.w1_cost,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1518 w2_name: $("#w2_name").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1519 w2_amount: parseFloat($("#w2_amount").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1520 w2_calcium: parseFloat($("#w2_calcium").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1521 w2_sulfate: parseFloat($("#w2_sulfate").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1522 w2_chloride: parseFloat($("#w2_chloride").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1523 w2_sodium: parseFloat($("#w2_sodium").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1524 w2_magnesium: parseFloat($("#w2_magnesium").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1525 w2_total_alkalinity: parseFloat($("#w2_total_alkalinity").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1526 w2_ph: parseFloat($("#w2_ph").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1527 w2_cost: dataRecord.w2_cost,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1528 wa_acid_name: $("#wa_acid_name").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1529 wa_acid_perc: parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1530 wa_base_name: $("#wa_base_name").val(),
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1531 fermentables: fermentablerow,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1532 hops: hoprow,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1533 miscs: miscrow,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1534 yeasts: yeastrow,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1535 mashs: mashrow
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1536 };
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1537 var data = "update=true&" + $.param(row);
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1538 $.ajax({
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1539 dataType: 'json',
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1540 url: url,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1541 cache: false,
316
82c3bb9a40c2 See if we can solve the sometimes not saved data.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
1542 async: false,
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1543 data: data,
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1544 type: "POST",
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1545 success: function (data, status, xhr) {
316
82c3bb9a40c2 See if we can solve the sometimes not saved data.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
1546 console.log("saveRecord() success");
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1547 },
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1548 error: function(jqXHR, textStatus, errorThrown) {
316
82c3bb9a40c2 See if we can solve the sometimes not saved data.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
1549 console.log("saveRecord() error");
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1550 }
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1551 });
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1552 };
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1553
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
1554 var dataRecord = {};
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1555 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
1556
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1557 // prepare the data
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1558 var source = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1559 datatype: "json",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1560 cache: false,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1561 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1562 { 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
1563 { name: 'uuid', type: 'string' },
359
98354ef399cd Lot's of improvements for recipes and products database load and save. Insert missing yeast tolerance field for old products and recipes. Recipe locked and calc_acid fields coverted to integer. In recipe edit screen removed the Print button. It is now included in the export screen. Added recipe export to forum screen.
Michiel Broek <mbroek@mbse.eu>
parents: 352
diff changeset
1564 { name: 'locked', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1565 { name: 'st_name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1566 { name: 'st_letter', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1567 { 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
1568 { 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
1569 { 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
1570 { name: 'st_category_number', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1571 { name: 'st_og_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1572 { name: 'st_og_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1573 { name: 'st_fg_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1574 { name: 'st_fg_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1575 { name: 'st_ibu_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1576 { name: 'st_ibu_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1577 { name: 'st_color_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1578 { name: 'st_color_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1579 { name: 'st_carb_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1580 { name: 'st_carb_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1581 { name: 'st_abv_min', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1582 { name: 'st_abv_max', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1583 { name: 'name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1584 { 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
1585 { name: 'type', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1586 { name: 'batch_size', type: 'float' },
95
8dc0a00b1db4 Boil_size volume toegevoegd.
Michiel Broek <mbroek@mbse.eu>
parents: 85
diff changeset
1587 { name: 'boil_size', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1588 { name: 'boil_time', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1589 { name: 'efficiency', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1590 { name: 'est_og', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1591 { 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
1592 { name: 'est_abv', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1593 { 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
1594 { name: 'color_method', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1595 { 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
1596 { 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
1597 { 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
1598 { 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
1599 { 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
1600 { 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
1601 { 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
1602 { 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
1603 { 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
1604 { name: 'sparge_acid_amount', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1605 { name: 'mash_ph', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1606 { name: 'mash_name', type: 'string' },
359
98354ef399cd Lot's of improvements for recipes and products database load and save. Insert missing yeast tolerance field for old products and recipes. Recipe locked and calc_acid fields coverted to integer. In recipe edit screen removed the Print button. It is now included in the export screen. Added recipe export to forum screen.
Michiel Broek <mbroek@mbse.eu>
parents: 352
diff changeset
1607 { name: 'calc_acid', type: 'int' },
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
1608 { 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
1609 { 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
1610 { 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
1611 { 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
1612 { 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
1613 { 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
1614 { 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
1615 { 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
1616 { 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
1617 { 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
1618 { 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
1619 { 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
1620 { 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
1621 { 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
1622 { 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
1623 { 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
1624 { 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
1625 { 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
1626 { 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
1627 { 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
1628 { 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
1629 { 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
1630 { 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
1631 { 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
1632 { 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
1633 { 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
1634 { 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
1635 { name: 'mashs', type: 'array' }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1636 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1637 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
1638 url: url + '?record=' + my_record
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1639 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1640 // Load data and select one record.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1641 var dataAdapter = new $.jqx.dataAdapter(source, {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1642 loadComplete: function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1643 var records = dataAdapter.records;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1644 dataRecord = records[0];
166
635033a29c48 Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents: 159
diff changeset
1645 // Hidden record uuid
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1646 $("#name").val(dataRecord.name);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1647 $("#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
1648 $("#locked").val(dataRecord.locked);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1649 $("#st_name").val(dataRecord.st_name);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1650 $("#st_letter").val(dataRecord.st_letter);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1651 $("#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
1652 $("#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
1653 $("#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
1654 $("#st_type").val(StyleTypeData[dataRecord.st_type].nl);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1655 $("#type").val(dataRecord.type);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1656 $("#batch_size").val(dataRecord.batch_size);
95
8dc0a00b1db4 Boil_size volume toegevoegd.
Michiel Broek <mbroek@mbse.eu>
parents: 85
diff changeset
1657 $("#boil_size").val(dataRecord.boil_size);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1658 $("#boil_time").val(dataRecord.boil_time);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1659 $("#efficiency").val(dataRecord.efficiency);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1660 $("#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
1661 $("#est_og2").val(dataRecord.est_og);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1662 $("#st_og_min").val(dataRecord.st_og_min);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1663 $("#st_og_max").val(dataRecord.st_og_max);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1664 $("#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
1665 $("#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
1666 $("#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
1667 $("#st_fg_max").val(dataRecord.st_fg_max);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1668 $("#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
1669 $("#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
1670 $("#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
1671 $("#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
1672 $("#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
1673 $("#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
1674 $("#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
1675 $("#st_color_max").val(dataRecord.st_color_max);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1676 $("#color_method").val(dataRecord.color_method);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1677 $("#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
1678 $("#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
1679 $("#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
1680 $("#st_ibu_max").val(dataRecord.st_ibu_max);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1681 $("#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
1682 $("#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
1683 $("#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
1684 $("#st_carb_max").val(dataRecord.st_carb_max);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1685 $("#mash_name").val(dataRecord.mash_name);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1686 $("#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
1687 $("#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
1688 $("#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
1689 $("#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
1690 $("#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
1691 $("#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
1692 $("#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
1693 $("#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
1694 $("#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
1695 $("#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
1696 $("#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
1697 $("#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
1698 $("#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
1699 $("#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
1700 $("#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
1701 $("#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
1702 $("#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
1703 $("#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
1704 $("#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
1705 $("#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
1706 $("#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
1707 $("#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
1708 $("#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
1709 $("#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
1710 $("#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
1711 $("#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
1712 $("#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
1713 $("#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
1714 $("#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
1715 $("#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
1716 $("#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
1717 $("#wa_base_name").val(dataRecord.wa_base_name);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1718 editFermentable(dataRecord);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1719 editHop(dataRecord);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1720 editMisc(dataRecord);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1721 editYeast(dataRecord);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1722 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
1723 $('#jqxTabs').jqxTabs('next');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1724 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1725 loadError: function (jqXHR, status, error) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1726 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1727 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
1728 $('#jqxLoader').jqxLoader('open');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1729 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1730 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1731 dataAdapter.dataBind();
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1732
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1733 // Inline fermentables editor
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1734 var editFermentable = function (data) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1735 var fermentableSource = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1736 localdata: data.fermentables,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1737 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
1738 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
1739 async: false,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1740 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1741 { name: 'f_name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1742 { name: 'f_origin', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1743 { name: 'f_supplier', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1744 { name: 'f_amount', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1745 { 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
1746 { name: 'f_type', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1747 { name: 'f_yield', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1748 { name: 'f_color', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1749 { name: 'f_coarse_fine_diff', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1750 { name: 'f_moisture', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1751 { name: 'f_diastatic_power', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1752 { name: 'f_protein', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1753 { 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
1754 { 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
1755 { name: 'f_added', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1756 { 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
1757 { 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
1758 { 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
1759 { name: 'f_adjust_to_total_100', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1760 { 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
1761 { 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
1762 { 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
1763 { 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
1764 { name: 'f_avail', type: 'int' }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1765 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1766 addrow: function (rowid, rowdata, position, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1767 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1768 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1769 deleterow: function (rowid, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1770 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1771 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1772 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1773 var fermentableAdapter = new $.jqx.dataAdapter(fermentableSource);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1774 $("#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
1775 width: 1240,
376
1de1623e1760 Inventory fermentables convert diastatic power between kolbach and lintner. In recipe and product editors calculate the recipe lintner value. For now a raw presentation of the outcome.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
1776 height: 470,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1777 source: fermentableAdapter,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1778 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1779 selectionmode: 'singlerow',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1780 showtoolbar: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1781 rendertoolbar: function (toolbar) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1782 var me = this;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1783 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1784 toolbar.append(container);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1785 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
1786 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
1787 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
1788 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
1789 // add fermentable from dropdownlist.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1790 $("#faddrowbutton").jqxDropDownList({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1791 placeHolder: "Kies mout:",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1792 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
1793 template: "primary",
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1794 source: fermentablelist,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1795 displayMember: "name",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1796 width: 150,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1797 height: 27,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1798 dropDownWidth: 500,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1799 dropDownHeight: 500,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1800 renderer: function (index, label, value) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1801 var datarecord = fermentablelist.records[index];
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1802 return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)";
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1803 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1804 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1805 $("#faddrowbutton").on('select', function (event) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1806 if (event.args) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1807 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1808 var index = event.args.index;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1809 var datarecord = fermentablelist.records[index];
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1810 var row = {};
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1811 row["f_name"] = datarecord.name;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1812 row["f_origin"] = datarecord.origin;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1813 row["f_supplier"] = datarecord.supplier;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1814 row["f_amount"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1815 row["f_cost"] = datarecord.cost;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1816 row["f_type"] = datarecord.type;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1817 row["f_yield"] = datarecord.yield;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1818 row["f_color"] = datarecord.color;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1819 row["f_coarse_fine_diff"] = datarecord.coarse_fine_diff;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1820 row["f_moisture"] = datarecord.moisture;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1821 row["f_diastatic_power"] = datarecord.diastatic_power;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1822 row["f_protein"] = datarecord.protein;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1823 row["f_max_in_batch"] = datarecord.max_in_batch;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1824 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
1825 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
1826 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
1827 } 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
1828 row["f_added"] = 1; // Boil
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1829 } 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
1830 row["f_added"] = 0; // Mash
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1831 }
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
1832 row["f_dissolved_protein"] = datarecord.dissolved_protein;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1833 row["f_recommend_mash"] = datarecord.recommend_mash;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1834 row["f_add_after_boil"] = datarecord.add_after_boil;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1835 if (rowscount == 0) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1836 // The first fermentable
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1837 row["f_adjust_to_total_100"] = 1;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1838 row["f_percentage"] = 100;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1839 } else {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1840 row["f_adjust_to_total_100"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1841 row["f_percentage"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1842 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1843 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
1844 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
1845 row["f_inventory"] = datarecord.inventory;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1846 var commit = $("#fermentableGrid").jqxGrid('addrow', null, row);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1847 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1848 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1849
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 $("#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
1851 $("#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
1852 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
1853 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
1854 });
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
1855
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1856 // 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
1857 $("#fdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1858 $("#fdeleterowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1859 var selectedrowindex = $("#fermentableGrid").jqxGrid('getselectedrowindex');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1860 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1861 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1862 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
1863 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
1864 var amount = $('#fermentableGrid').jqxGrid('getcellvalue', id, "f_amount");
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1865 var commit = $("#fermentableGrid").jqxGrid('deleterow', id);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1866 }
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
1867 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
1868 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
1869 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
1870 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
1871 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
1872 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
1873 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
1874 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
1875 }
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
1876 }
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
1877 } 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
1878 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
1879 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
1880 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
1881 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
1882 };
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
1883 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
1884 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
1885 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
1886 $("#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
1887 };
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
1888 }
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
1889 } 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
1890 $("#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
1891 }
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
1892 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
1893 calcIBUs();
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1894 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1895 },
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
1896 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
1897 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
1898 $('#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
1899 },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1900 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
1901 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name',
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1902 cellsrenderer: function (index, datafield, value, defaulvalue, column, rowdata) {
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1903 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" +
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1904 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
1905 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1906 },
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
1907 { 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
1908 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1909 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + FermentableTypeData[value].nl + "</span>";
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
1910 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1911 },
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1912 { 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
1913 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1914 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + AddedData[value].nl + "</span>";
127
6d5e215d77d2 Added fermentables Moment dropdown list. Added fermentables adjust to 100% logic.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1915 }
6d5e215d77d2 Added fermentables Moment dropdown list. Added fermentables adjust to 100% logic.
Michiel Broek <mbroek@mbse.eu>
parents: 126
diff changeset
1916 },
331
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1917 { text:'Maxinbatch', datafield: 'f_max_in_batch', hidden: true },
128
4d188d216c88 Layout changes in fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents: 127
diff changeset
1918 { 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
1919 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1920 { text: 'Voorr. Kg', datafield: 'f_inventory', width: 120, align: 'right',
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1921 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties, rowdata) {
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1922 var color = '#ffffff';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1923 if (value < rowdata.f_amount)
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1924 color = '#ff4040';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1925 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' +
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1926 color + ';">' +fermentableAdapter.formatNumber(value, "f3") + '</span>';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1927 }
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1928 },
331
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1929 { text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right',
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1930 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties, rowdata) {
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1931 var color = '#ffffff';
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1932 if (value > rowdata.f_max_in_batch)
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1933 color = '#ff4040';
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1934 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' +
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1935 color + ';">' +fermentableAdapter.formatNumber(value, "p1") + '</span>';
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1936 }
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1937 },
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
1938 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1939 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
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
1940 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
1941 }, 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
1942 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
1943 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
1944 $("#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
1945 $("#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
1946 $("#wf_percentage").val(fermentableData.f_percentage);
331
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
1947 $("#wf_max_in_batch").val(fermentableData.f_max_in_batch);
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
1948 $("#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
1949 $("#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
1950 // 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
1951 $("#popupFermentable").jqxWindow('open');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1952 }
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
1953 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1954 ]
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1955 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1956 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1957
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1958 // Inline hops editor
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1959 var editHop = function (data) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1960 var hopSource = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1961 localdata: data.hops,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1962 datatype: "local",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1963 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
1964 async: false,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1965 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1966 { name: 'h_name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1967 { name: 'h_origin', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1968 { name: 'h_amount', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1969 { 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
1970 { 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
1971 { 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
1972 { name: 'h_useat', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1973 { name: 'h_time', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1974 { name: 'h_alpha', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1975 { name: 'h_beta', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1976 { name: 'h_hsi', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1977 { 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
1978 { name: 'h_caryophyllene', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1979 { name: 'h_cohumulone', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1980 { 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
1981 { 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
1982 { 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
1983 { name: 'h_avail', type: 'int' }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1984 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1985 addrow: function (rowid, rowdata, position, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1986 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1987 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1988 deleterow: function (rowid, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1989 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1990 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1991 };
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
1992 var hopAdapter = new $.jqx.dataAdapter(hopSource);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1993 $("#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
1994 width: 1240,
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
1995 height: 560,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1996 source: hopAdapter,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1997 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1998 selectionmode: 'singlerow',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1999 showtoolbar: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2000 rendertoolbar: function (toolbar) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2001 var me = this;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2002 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2003 toolbar.append(container);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2004 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
2005 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
2006 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
2007 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
2008 // add hop from dropdownlist.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2009 $("#haddrowbutton").jqxDropDownList({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2010 placeHolder: "Kies hop:",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2011 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
2012 template: "primary",
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2013 source: hoplist,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2014 displayMember: "name",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2015 width: 150,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2016 height: 27,
69
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
2017 dropDownWidth: 500,
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
2018 dropDownHeight: 500,
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
2019 renderer: function (index, label, value) {
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
2020 var datarecord = hoplist.records[index];
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
2021 return datarecord.origin+ " / " + datarecord.name + " (" + datarecord.alpha + "% &alpha;)";
ca25fdce3b85 Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents: 68
diff changeset
2022 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2023 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2024 $("#haddrowbutton").on('select', function (event) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2025 if (event.args) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2026 var index = event.args.index;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2027 var datarecord = hoplist.records[index];
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2028 var row = {};
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2029 row["h_name"] = datarecord.name;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2030 row["h_origin"] = datarecord.origin;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2031 row["h_amount"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2032 row["h_cost"] = datarecord.cost;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2033 row["h_type"] = datarecord.type;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2034 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
2035 row["h_useat"] = 2; // Boil
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2036 row["h_time"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2037 row["h_alpha"] = datarecord.alpha;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2038 row["h_beta"] = datarecord.beta;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2039 row["h_hsi"] = datarecord.hsi;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2040 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
2041 row["h_caryophyllene"] = datarecord.caryophyllene;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2042 row["h_cohumulone"] = datarecord.cohumulone;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2043 row["h_myrcene"] = datarecord.myrcene;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2044 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
2045 row["h_inventory"] = datarecord.inventory;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2046 var commit = $("#hopGrid").jqxGrid('addrow', null, row);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2047 }
267
dafc9ff806a4 Allow the same hops and yeasts to be added multiple times.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
2048 $("#haddrowbutton").jqxDropDownList('clearSelection');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2049 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2050
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
2051 $("#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
2052 $("#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
2053 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
2054 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
2055 });
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
2056
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2057 // 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
2058 $("#hdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2059 $("#hdeleterowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2060 var selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2061 var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2062 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2063 var id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2064 var commit = $("#hopGrid").jqxGrid('deleterow', id);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2065 }
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
2066 calcIBUs();
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2067 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2068 },
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
2069 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
2070 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
2071 $('#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
2072 },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2073 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
2074 { text: 'Hop', datafield: 'h_name',
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2075 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2076 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" +rowdata.h_origin+" / "+rowdata.h_name+"</span>";
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
2077 },
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
2078 },
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
2079 { 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
2080 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2081 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>';
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
2082 }
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
2083 },
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
2084 { 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
2085 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2086 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>';
140
93c64d7ac79c Hops grid editor amount is now in grams.
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
2087 }
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
2088 },
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
2089 { 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
2090 { 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
2091 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2092 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopUseData[value].nl + '</span>';
126
9999b3ce98cb Row editors are now per cell. Added fermentable percentages editor.
Michiel Broek <mbroek@mbse.eu>
parents: 125
diff changeset
2093 }
9999b3ce98cb Row editors are now per cell. Added fermentable percentages editor.
Michiel Broek <mbroek@mbse.eu>
parents: 125
diff changeset
2094 },
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
2095 { 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
2096 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2097 var duration = '';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2098 if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2099 duration = dataAdapter.formatNumber(value, "f0")+" min.";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2100 else if (rowdata.h_useat == 5) // Dry hop
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2101 duration = dataAdapter.formatNumber(value/1440, "f0")+" dagen";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2102 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>';
132
aaefac2d08a3 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 131
diff changeset
2103 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2104 },
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
2105 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right',
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2106 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2107 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')),
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2108 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time),
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2109 parseFloat(rowdata.h_alpha), $("#ibu_method").val());
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2110 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, "f1") + '</span>';
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2111 }
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
2112 },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2113 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right',
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
2114 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2115 var amount = dataAdapter.formatNumber(value, "f1") + ' kg';
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
2116 if (value < 1)
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2117 amount = dataAdapter.formatNumber(value * 1000, "f1") + ' gr';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2118 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
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
2119 }
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
2120 },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2121 { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right',
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
2122 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2123 var color = '#ffffff';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2124 if (value < rowdata.h_amount)
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2125 color = '#ff4040';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2126 var amount = dataAdapter.formatNumber(value, "f1") + ' kg';
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
2127 if (value < 1)
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2128 amount = dataAdapter.formatNumber(value * 1000, "f1") + ' gr';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2129 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
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
2130 }
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
2131 },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2132 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: 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
2133 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
2134 }, 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
2135 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
2136 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
2137 $("#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
2138 $("#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
2139 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
2140 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
2141 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
2142 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
2143 );
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
2144 $("#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
2145 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
2146 $("#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
2147 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
2148 $("#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
2149 $("#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
2150 // 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
2151 $("#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
2152 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2153 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2154 ]
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
2155 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2156 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2157
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2158 // Inline miscs editor
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2159 var editMisc = function (data) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2160 var miscSource = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2161 localdata: data.miscs,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2162 datatype: "local",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2163 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
2164 async: false,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2165 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2166 { name: 'm_name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2167 { name: 'm_amount', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2168 { 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
2169 { 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
2170 { name: 'm_use_use', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2171 { 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
2172 { 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
2173 { 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
2174 { name: 'm_avail', type: 'int' }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2175 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2176 addrow: function (rowid, rowdata, position, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2177 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2178 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2179 deleterow: function (rowid, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2180 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2181 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2182 };
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
2183 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
2184 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
2185 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
2186 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
2187 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
2188 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
2189 // 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
2190 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
2191 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
2192 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
2193 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
2194 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
2195 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
2196 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
2197 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
2198 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
2199 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
2200 $("#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
2201 $("#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
2202 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
2203 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
2204 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
2205 $("#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
2206 $("#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
2207 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
2208 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
2209 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
2210 $("#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
2211 $("#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
2212 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
2213 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
2214 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
2215 $("#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
2216 $("#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
2217 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
2218 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
2219 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
2220 $("#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
2221 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
2222 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
2223 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
2224 $("#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
2225 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
2226 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
2227 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
2228 $("#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
2229 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
2230 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
2231 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
2232 $("#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
2233 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
2234 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
2235 }
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
2236 }
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
2237 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
2238 },
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
2239 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
2240 $('#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
2241 },
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
2242 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2243 $("#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
2244 width: 1240,
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2245 height: 575,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2246 source: miscAdapter,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2247 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2248 selectionmode: 'singlerow',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2249 showtoolbar: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2250 rendertoolbar: function (toolbar) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2251 var me = this;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2252 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2253 toolbar.append(container);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2254 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
2255 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
2256 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
2257 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
2258 // add misc from dropdownlist.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2259 $("#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
2260 placeHolder: "Kies ingredi&euml;nt:",
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2261 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
2262 template: "primary",
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2263 source: misclist,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2264 displayMember: "name",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2265 width: 150,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2266 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
2267 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
2268 dropDownHeight: 500
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2269 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2270 $("#maddrowbutton").on('select', function (event) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2271 if (event.args) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2272 var index = event.args.index;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2273 var datarecord = misclist.records[index];
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2274 var row = {};
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2275 row["m_name"] = datarecord.name;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2276 row["m_amount"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2277 row["m_cost"] = datarecord.cost;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2278 row["m_type"] = datarecord.type;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2279 row["m_use_use"] = datarecord.use_use;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2280 row["m_time"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2281 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
2282 row["m_inventory"] = datarecord.inventory;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2283 var commit = $("#miscGrid").jqxGrid('addrow', null, row);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2284 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2285 });
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
2286 $("#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
2287 $("#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
2288 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
2289 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
2290 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2291 // 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
2292 $("#mdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2293 $("#mdeleterowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2294 var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2295 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
2296 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
2297 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2298 var id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2299 var commit = $("#miscGrid").jqxGrid('deleterow', id);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2300 }
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 },
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
2303 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
2304 $('#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
2305 },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2306 columns: [
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2307 { 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
2308 { 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
2309 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2310 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + MiscTypeData[value].nl + "</span>";
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2311 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2312 },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2313 { 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
2314 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2315 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + MiscUseData[value].nl + "</span>";
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
2316 }
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
2317 },
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2318 { 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
2319 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2320 var duration = '';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2321 if (rowdata.m_use_use == 2) // Boil
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2322 duration = dataAdapter.formatNumber(value, "f0")+" min.";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2323 else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2324 duration = dataAdapter.formatNumber(value/1440, "f0")+" dagen";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2325 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>';
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2326 },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2327 },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2328 { 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
2329 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
2330 var vstr = rowdata.m_amount_is_weight ? "gr":"ml";
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2331 return '<span style="margin: 4px; margin-top: 6px; float: right;">' +
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2332 dataAdapter.formatNumber(value * 1000,"f2")+" "+vstr + '</span>';
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
2333 },
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2334 },
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2335 { 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
2336 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
2337 var vstr = rowdata.m_amount_is_weight ? "gr":"ml";
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2338 var color = '#ffffff';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2339 if (value < rowdata.m_amount)
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2340 color = '#ff4040';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2341 var amount = dataAdapter.formatNumber(value * 1000,"f2")+" "+vstr;
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2342 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
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
2343 },
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2344 },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2345 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2346 return "Wijzig";
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2347 }, 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
2348 miscRow = row;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2349 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
2350 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
2351 $("#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
2352 else
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2353 $("#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
2354 $("#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
2355 $("#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
2356 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
2357 $("#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
2358 else
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2359 $("#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
2360 $("#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
2361 // 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
2362 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
2363 $("#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
2364 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
2365 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2366 ]
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
2367 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2368 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2369
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2370 // Inline yeasts editor
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2371 var editYeast = function (data) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2372 var yeastSource = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2373 localdata: data.yeasts,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2374 datatype: "local",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2375 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
2376 async: false,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2377 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2378 { name: 'y_name', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2379 { name: 'y_laboratory', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2380 { name: 'y_product_id', type: 'string' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2381 { name: 'y_amount', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2382 { 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
2383 { 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
2384 { 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
2385 { name: 'y_flocculation', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2386 { name: 'y_min_temperature', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2387 { name: 'y_max_temperature', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2388 { 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
2389 { 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
2390 { name: 'y_cells', type: 'float' },
332
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2391 { name: 'y_tolerance', type: 'float' },
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2392 { name: 'y_inventory', type: 'float' },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2393 { name: 'y_avail', type: 'int' }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2394 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2395 addrow: function (rowid, rowdata, position, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2396 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2397 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2398 deleterow: function (rowid, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2399 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2400 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2401 };
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2402 var yeastAdapter = new $.jqx.dataAdapter(yeastSource);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2403 $("#yeastGrid").jqxGrid({
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2404 width: 1240,
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2405 height: 350,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2406 source: yeastAdapter,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2407 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2408 selectionmode: 'singlerow',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2409 showtoolbar: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2410 rendertoolbar: function (toolbar) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2411 var me = this;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2412 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2413 toolbar.append(container);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2414 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
2415 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
2416 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
2417 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
2418 // add yeast from dropdownlist.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2419 $("#yaddrowbutton").jqxDropDownList({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2420 placeHolder: "Kies gist:",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2421 theme: theme,
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2422 template: "primary",
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2423 source: yeastlist,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2424 displayMember: "name",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2425 width: 150,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2426 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
2427 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
2428 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
2429 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
2430 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
2431 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
2432 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2433 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2434 $("#yaddrowbutton").on('select', function (event) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2435 if (event.args) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2436 var index = event.args.index;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2437 var datarecord = yeastlist.records[index];
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2438 var row = {};
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2439 row["y_name"] = datarecord.name;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2440 row["y_laboratory"] = datarecord.laboratory;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2441 row["y_product_id"] = datarecord.product_id;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2442 row["y_type"] = datarecord.type;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2443 row["y_form"] = datarecord.form;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2444 row["y_amount"] = 0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2445 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
2446 row["y_use"] = 0;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2447 row["y_min_temperature"] = datarecord.min_temperature;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2448 row["y_max_temperature"] = datarecord.max_temperature;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2449 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
2450 row["y_flocculation"] = datarecord.flocculation;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2451 row["y_cells"] = datarecord.cells;
332
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2452 row["y_tolerance"] = datarecord.tolerance;
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2453 row["y_inventory"] = datarecord.inventory;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2454 var commit = $("#yeastGrid").jqxGrid('addrow', null, row);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2455 }
267
dafc9ff806a4 Allow the same hops and yeasts to be added multiple times.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
2456 $("#yaddrowbutton").jqxDropDownList('clearSelection');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2457 });
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
2458 $("#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
2459 $("#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
2460 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
2461 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
2462 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2463 // delete selected yeast.
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2464 $("#ydeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2465 $("#ydeleterowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2466 var selectedrowindex = $("#yeastGrid").jqxGrid('getselectedrowindex');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2467 var rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2468 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2469 var id = $("#yeastGrid").jqxGrid('getrowid', selectedrowindex);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2470 var commit = $("#yeastGrid").jqxGrid('deleterow', id);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2471 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2472 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2473 },
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
2474 ready: function() {
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2475 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
2476 $('#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
2477 },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2478 columns: [
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2479 { text: 'Gist', datafield: 'y_name' },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2480 { 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
2481 { 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
2482 { 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
2483 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2484 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastFormData[value].nl + '</span>';
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2485 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2486 },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2487 { 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
2488 { text: 'Max. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' },
332
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2489 { text: 'Tol. %', width: 60, align: 'right', cellsalign: 'right', datafield: 'y_tolerance',
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2490 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2491 var color = '#ffffff';
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2492 var amount = "";
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2493 if (value > 0) {
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2494 amount = dataAdapter.formatNumber(value, "f1");
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2495 if (dataRecord.est_abv > value)
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2496 color = '#ff4040';
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2497 }
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2498 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2499 }
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2500 },
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2501 { 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
2502 { 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
2503 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2504 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastUseData[value].nl + '</span>';
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
2505 }
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
2506 },
332
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2507 { text: 'Hoeveel', datafield: 'y_amount', width: 90, 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
2508 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2509 var amount = dataAdapter.formatNumber(value*1000, "f0")+" ml";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2510 if (rowdata.y_form == 0) // Liquid
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2511 amount = dataAdapter.formatNumber(value, "f0")+" pk";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2512 else if (rowdata.y_form == 1) // Dry
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2513 amount = dataAdapter.formatNumber(value*1000, "f1")+" gr";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2514 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2515 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2516 },
332
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2517 { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right',
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2518 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2519 var color = '#ffffff';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2520 if (value < rowdata.y_amount)
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2521 color = '#ff4040';
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2522 var amount = dataAdapter.formatNumber(value*1000, "f0")+" ml";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2523 if (rowdata.y_form == 0) // Liquid
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2524 amount = dataAdapter.formatNumber(value, "f0")+" pk";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2525 else if (rowdata.y_form == 1) // Dry
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2526 amount = dataAdapter.formatNumber(value*1000, "f1")+" gr";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2527 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2528 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2529 },
332
f0ca77097236 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance.
Michiel Broek <mbroek@mbse.eu>
parents: 331
diff changeset
2530 { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center', cellsrenderer: function () {
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2531 return "Wijzig";
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2532 }, buttonclick: function (row) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2533 yeastRow = row;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2534 yeastData = $("#yeastGrid").jqxGrid('getrowdata', yeastRow);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2535 if (yeastData.y_form == 0) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2536 $("#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
2537 $("#wy_amount").val(yeastData.y_amount);
265
05f9a0c9ed2d Fixed yeast amount editing using spinbuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 264
diff changeset
2538 $("#wy_amount").jqxNumberInput({ decimalDigits: 0 });
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2539 } 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
2540 $("#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
2541 $("#wy_amount").val(yeastData.y_amount * 1000);
265
05f9a0c9ed2d Fixed yeast amount editing using spinbuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 264
diff changeset
2542 $("#wy_amount").jqxNumberInput({ decimalDigits: 1 });
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2543 } else {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2544 $("#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
2545 $("#wy_amount").val(yeastData.y_amount * 1000);
265
05f9a0c9ed2d Fixed yeast amount editing using spinbuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 264
diff changeset
2546 $("#wy_amount").jqxNumberInput({ decimalDigits: 0 });
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2547 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2548 $("#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
2549 $("#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
2550 $("#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
2551 $("#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
2552 // show the popup window.
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2553 $("#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
2554 }
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
2555 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2556 ]
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
2557 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2558 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2559
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2560 // inline mash editor
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2561 var editMash = function (data) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2562 var generaterow = function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2563 var row = {};
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2564 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
2565 row["step_type"] = 0;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2566 row["step_infuse_amount"] = 15;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2567 row["step_temp"] = 62.0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2568 row['step_time'] = 20.0;
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
2569 row['step_thickness'] = 0;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2570 row['ramp_time'] = 1.0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2571 row['end_temp'] = 62.0;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2572 return row;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2573 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2574 var mashSource = {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2575 localdata: data.mashs,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2576 datatype: "local",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2577 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
2578 async: false,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2579 datafields: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2580 { 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
2581 { name: 'step_type', type: 'int' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2582 { name: 'step_infuse_amount', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2583 { name: 'step_temp', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2584 { name: 'step_time', type: 'float' },
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
2585 { name: 'step_thickness', type: 'float' },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2586 { name: 'ramp_time', type: 'float' },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2587 { name: 'end_temp', type: 'float' }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2588 ],
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2589 addrow: function (rowid, rowdata, position, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2590 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2591 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2592 deleterow: function (rowid, commit) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2593 commit(true);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2594 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2595 };
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
2596 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
2597 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
2598 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
2599 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
2600 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
2601 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
2602 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
2603 mash_infuse += parseFloat(row.step_infuse_amount);
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
2604 row.step_thickness = 0; // Init this field.
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
2605 data.push(row);
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
2606 }
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
2607 },
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
2608 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2609 $("#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
2610 width: 1240,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2611 height: 400,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2612 source: mashAdapter,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2613 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2614 selectionmode: 'singlerow',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2615 showtoolbar: true,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2616 rendertoolbar: function (toolbar) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2617 var me = this;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2618 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2619 toolbar.append(container);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2620 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
2621 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
2622 $("#saddrowbutton").jqxButton({ template: "primary", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2623 $("#saddrowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2624 var datarow = generaterow();
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2625 var commit = $("#mashGrid").jqxGrid('addrow', null, datarow);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2626 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2627 // 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
2628 $("#sdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2629 $("#sdeleterowbutton").on('click', function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2630 var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2631 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2632 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2633 var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2634 var commit = $("#mashGrid").jqxGrid('deleterow', id);
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2635 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2636 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2637 },
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
2638 ready: function() {
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2639 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
2640 calcInit();
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
2641 calcMash();
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
2642 $('#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
2643 $('#jqxTabs').jqxTabs('first');
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
2644 },
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2645 columns: [
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2646 { 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
2647 { 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
2648 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
2649 return "<div style='margin: 4px;'>" + MashStepTypeData[value].nl + "</div>";
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2650 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2651 },
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
2652 { 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
2653 { text: 'Eind &deg;C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2654 { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' },
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2655 { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' },
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2656 { text: 'Infuse L.', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
2657 { text: 'L/Kg.', datafield: 'step_thickness', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f2' },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 283
diff changeset
2658 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
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
2659 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
2660 }, 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
2661 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
2662 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
2663 $("#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
2664 $("#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
2665 $("#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
2666 $("#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
2667 $("#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
2668 $("#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
2669 $("#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
2670 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
2671 $("#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
2672 $("#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
2673 } 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
2674 $("#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
2675 $("#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
2676 }
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
2677 // 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
2678 $("#popupMash").jqxWindow('open');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2679 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2680 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2681 ]
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2682 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2683 };
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2684
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2685 // 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
2686 // 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
2687 $("#name").jqxTooltip({ content: 'De naam voor dit recept.' });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2688 $("#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
2689 $("#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
2690 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2691 $("#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
2692 $("#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
2693 $("#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
2694 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
2695 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
2696 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
2697 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
2698 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
2699 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
2700 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
2701 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2702 $("#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
2703 $("#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
2704 $("#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
2705 $("#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
2706 $("#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
2707 $("#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
2708 $("#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
2709 $("#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
2710 $("#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
2711 $("#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
2712
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2713 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2714 $("#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
2715 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2716 $("#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
2717 $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'});
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2718 $("#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
2719 $("#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
2720 $("#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
2721 $("#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
2722 $("#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
2723 $("#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
2724 $("#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
2725
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable 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 $("#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
2727 $("#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
2728 $("#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
2729 $("#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
2730 $("#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
2731 $("#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
2732
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
2733 $("#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
2734 $("#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
2735 $("#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
2736 $("#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
2737 $("#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
2738 $("#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
2739
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
2740 $("#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
2741 $("#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
2742 $("#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
2743 $("#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
2744 $("#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
2745 $("#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
2746
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
2747 $("#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
2748 $("#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
2749 $("#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
2750 $("#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
2751 $("#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
2752 $("#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
2753 $("#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
2754 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
2755 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
2756 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
2757 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
2758 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
2759 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
2760 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
2761 });
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
2762
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
2763 $("#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
2764 $("#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
2765 $("#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
2766 $("#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
2767 $("#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
2768 $("#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
2769 $("#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
2770 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
2771 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
2772 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
2773 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
2774 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
2775 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
2776 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
2777 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
2778 });
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
2779
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
2780 $("#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
2781 $("#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
2782 $("#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
2783 $("#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
2784 $("#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
2785 $("#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
2786
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
2787 // 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
2788 $("#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
2789 $("#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
2790 $("#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
2791 $("#est_og2").jqxNumberInput( Show3dec );
376
1de1623e1760 Inventory fermentables convert diastatic power between kolbach and lintner. In recipe and product editors calculate the recipe lintner value. For now a raw presentation of the outcome.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
2792 $("#ferm_lintner").jqxTooltip({ content: 'De enzymkracht van alle mouten in de maisch. Moet hoger dan 35 zijn.' });
1de1623e1760 Inventory fermentables convert diastatic power between kolbach and lintner. In recipe and product editors calculate the recipe lintner value. For now a raw presentation of the outcome.
Michiel Broek <mbroek@mbse.eu>
parents: 373
diff changeset
2793 $("#ferm_lintner").jqxNumberInput( Show0dec );
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2794 $("#perc_malts").jqxProgressBar({
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2795 width: 300,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2796 height: 23,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2797 theme: theme,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2798 showText: true,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2799 animationDuration: 0,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2800 colorRanges: [
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2801 { stop: 90, color: '#008C00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2802 { stop: 95, color: '#EB7331' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2803 { stop: 100, color: '#FF0000' }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2804 ]
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2805 });
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2806 $("#perc_sugars").jqxProgressBar({
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2807 width: 300,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2808 height: 23,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2809 theme: theme,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2810 showText: true,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2811 animationDuration: 0,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2812 colorRanges: [
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2813 { stop: 20, color: '#008C00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2814 { stop: 100, color: '#FF0000' }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2815 ]
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2816 });
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2817 $("#perc_cara").jqxProgressBar({
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2818 width: 300,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2819 height: 23,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2820 theme: theme,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2821 showText: true,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2822 animationDuration: 0,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2823 colorRanges: [
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2824 { stop: 25, color: '#008C00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2825 { stop: 100, color: '#FF0000' }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2826 ]
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
2827 });
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
2828 $("#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
2829 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
2830 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
2831 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
2832 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
2833 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
2834 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
2835 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
2836 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
2837 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
2838 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2839 $("#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
2840 $("#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
2841 $("#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
2842 // 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
2843 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
2844 calcIBUs();
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
2845 calcMash();
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
2846 // 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
2847 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2848 $("#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
2849 $("#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
2850 $("#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
2851 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
2852 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
2853 });
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
2854 $("#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
2855 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
2856 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
2857 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
2858 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
2859 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
2860 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
2861 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
2862 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
2863 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
2864 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
2865 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
2866 }
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
2867 });
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
2868 $("#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
2869 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
2870 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
2871 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
2872 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
2873 $("#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
2874 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
2875 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
2876 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
2877 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
2878 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
2879 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
2880 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
2881 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
2882 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
2883 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
2884 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
2885 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
2886 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
2887 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
2888 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
2889 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
2890 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
2891 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
2892 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
2893 }
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
2894 });
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
2895 $("#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
2896 $('#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
2897 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
2898 $("#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
2899 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
2900 // 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
2901 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
2902 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
2903 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
2904 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
2905 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
2906 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
2907 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
2908 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2909 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
2910 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
2911 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
2912 $("#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
2913 // 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
2914 // $("#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
2915 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2916 } 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
2917 $("#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
2918 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2919 calcFermentables();
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
2920 calcMash();
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
2921 };
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2922 });
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
2923 $("#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
2924 $("#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
2925 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
2926 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
2927 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
2928 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
2929 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
2930 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
2931 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
2932 $("#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
2933 } 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
2934 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
2935 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
2936 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
2937 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
2938 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
2939 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2940 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
2941 // 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
2942 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
2943 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
2944 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
2945 $("#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
2946 $("#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
2947 $("#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
2948 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
2949 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
2950 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
2951 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
2952 $("#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
2953 $("#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
2954 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2955 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2956 calcFermentables();
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
2957 cacMash();
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
2958 } 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
2959 // 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
2960 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
2961 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
2962 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
2963 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
2964 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
2965 $("#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
2966 // $("#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
2967 $("#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
2968 } 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
2969 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
2970 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
2971 $("#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
2972 $("#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
2973 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2974 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2975 calcFermentables();
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
2976 calcMash();
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
2977 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2978 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2979 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2980
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2981 });
331
8d7fad771dde Warn if a fermentabe ingredient is used above the maximum in batch percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
2982 $("#wf_max_in_batch").jqxNumberInput( Show1dec );
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
2983 $("#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
2984 $("#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
2985 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
2986 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
2987 // 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
2988 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
2989 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
2990 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
2991 $("#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
2992 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2993 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2994 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2995 $("#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
2996 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
2997 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2998 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2999 $("#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
3000 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
3001 $("#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
3002 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
3003 }
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3004 });
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3005 $("#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
3006 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
3007 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
3008 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
3009 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
3010 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
3011 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
3012 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
3013 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
3014 });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3015 $("#wf_added").on('select', function (event) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3016 if (event.args) {
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3017 var index = event.args.index;
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3018 $("#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
3019 calcFermentables();
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3020 calcIBUs();
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
3021 calcMash();
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3022 }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3023 });
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
3024
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3025 // 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
3026 $("#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
3027 $("#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
3028 $("#hop_flavour").jqxProgressBar({
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3029 width: 300,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3030 height: 23,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3031 theme: theme,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3032 showText: true,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3033 animationDuration: 0,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3034 colorRanges: [
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3035 { stop: 20, color: '#004D00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3036 { stop: 40, color: '#008C00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3037 { stop: 60, color: '#00BF00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3038 { stop: 80, color: '#00FF00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3039 { stop: 100, color: '#80FF80' }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3040 ]
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3041 });
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3042 $("#hop_aroma").jqxProgressBar({
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3043 width: 300,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3044 height: 23,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3045 theme: theme,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3046 showText: true,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3047 animationDuration: 0,
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3048 colorRanges: [
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3049 { stop: 20, color: '#004D00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3050 { stop: 40, color: '#008C00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3051 { stop: 60, color: '#00BF00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3052 { stop: 80, color: '#00FF00' },
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3053 { stop: 100, color: '#80FF80' }
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3054 ]
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3055 });
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
3056 $("#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
3057 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
3058 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
3059 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
3060 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
3061 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
3062 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
3063 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
3064 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
3065 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
3066 });
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
3067 $("#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
3068 $("#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
3069 $("#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
3070 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
3071 });
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
3072 $("#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
3073 $("#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
3074 $("#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
3075 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
3076 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
3077 });
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
3078 $("#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
3079 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
3080 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
3081 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
3082 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
3083 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
3084 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
3085 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
3086 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
3087 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
3088 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
3089 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
3090 }
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
3091 });
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
3092 $("#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
3093 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
3094 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
3095 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
3096 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
3097 $("#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
3098 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
3099 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
3100 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
3101 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
3102 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
3103 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
3104 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
3105 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
3106 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
3107 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
3108 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
3109 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
3110 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
3111 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
3112 }
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
3113 });
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
3114 $("#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
3115 $('#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
3116 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
3117 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
3118 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
3119
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
3120 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
3121 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
3122 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
3123 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
3124 );
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
3125 rowdata.h_amount = amount;
311
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 303
diff changeset
3126 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')),
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 303
diff changeset
3127 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), $("#ibu_method").val());
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 303
diff changeset
3128 $("#wh_ibu").val(ibu);
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
3129 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
3130 });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3131 $("#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
3132 $("#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
3133 $("#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
3134 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
3135 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
3136 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
3137 // 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
3138 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
3139 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
3140 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
3141 $("#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
3142 }
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
3143 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
3144 } 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
3145 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
3146 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
3147 $("#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
3148 }
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
3149 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
3150 } 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
3151 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
3152 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
3153 $("#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
3154 }
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
3155 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
3156 }
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
3157 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
3158 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
3159 $("#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
3160 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
3161 });
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
3162 $("#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
3163 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
3164 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
3165 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
3166 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
3167 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
3168 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
3169 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
3170 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
3171 });
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
3172 $("#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
3173 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
3174 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
3175 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
3176 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
3177 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
3178 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
3179 $("#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
3180 $("#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
3181 } 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
3182 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
3183 $("#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
3184 $("#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
3185 } 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
3186 $("#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
3187 }
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
3188 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
3189 $("#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
3190 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
3191 $("#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
3192 }
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
3193 });
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
3194
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3195 // 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
3196 $("#popupMisc").jqxWindow({
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3197 width: 800,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3198 height: 275,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3199 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
3200 resizable: false,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3201 theme: theme,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3202 isModal: true,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3203 autoOpen: false,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3204 cancelButton: $("#MiscReady"),
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3205 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
3206 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3207 $("#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
3208 $("#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
3209 $("#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
3210 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3211 $("#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
3212 $("#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
3213 $("#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
3214 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
3215 misclist.dataBind();
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3216 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3217 $("#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
3218 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
3219 theme: theme,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3220 source: misclist,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3221 displayMember: "name",
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3222 width: 150,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3223 height: 23,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3224 dropDownWidth: 500,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3225 dropDownHeight: 500
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3226 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3227 $("#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
3228 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
3229 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
3230 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
3231 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
3232 $("#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
3233 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
3234 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
3235 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
3236 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
3237 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
3238 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
3239 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3240 });
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
3241 $("#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
3242 $('#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
3243 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
3244 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
3245 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
3246 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
3247 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3248 $("#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
3249 $("#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
3250 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
3251 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
3252 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
3253
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3254 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
3255 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
3256 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
3257 $("#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
3258 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3259 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
3260 } 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
3261 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
3262 newtime = 21;
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3263 $("#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
3264 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3265 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
3266 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3267 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3268 $("#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
3269 theme: theme,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3270 source: MiscUseAdapter,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3271 valueMember: 'id',
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3272 displayMember: 'nl',
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3273 width: 180,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3274 height: 23,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3275 autoDropDownHeight: true,
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3276 dropDownVerticalAlignment: 'top'
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3277 });
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3278 $("#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
3279 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
3280 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
3281 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
3282 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
3283 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
3284 $("#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
3285 } else {
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3286 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
3287 $("#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
3288 $("#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
3289 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3290 }
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3291 });
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
3292
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3293 // Tab 5, Gist
227
fd6d87d1c9ed Recalculate FG, SVG and ABV when changing the primary yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 226
diff changeset
3294 $("#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
3295 $("#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
3296 $("#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
3297 $("#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
3298 $("#popupYeast").jqxWindow({
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3299 width: 800,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3300 height: 300,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3301 position: { x: 230, y: 100 },
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3302 resizable: false,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3303 theme: theme,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3304 isModal: true,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3305 autoOpen: false,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3306 cancelButton: $("#YeastReady"),
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3307 modalOpacity: 0.40
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3308 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3309 $("#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
3310 $("#YeastReady").click(function () {
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3311 calcFermentables();
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3312 $("#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
3313 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3314 $("#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
3315 $("#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
3316 $("#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
3317 $("#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
3318 $("#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
3319 yeastinstock = event.args.checked;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3320 yeastlist.dataBind();
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3321 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3322 $("#wy_select").jqxDropDownList({
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3323 placeHolder: "Kies gist:",
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3324 theme: theme,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3325 source: yeastlist,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3326 displayMember: "name",
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3327 width: 150,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3328 height: 23,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3329 dropDownWidth: 500,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3330 dropDownHeight: 500,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3331 renderer: function (index, label, value) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3332 var datarecord = yeastlist.records[index];
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3333 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
3334 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3335 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3336 $("#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
3337 if (event.args) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3338 var index = event.args.index;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3339 var datarecord = yeastlist.records[index];
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3340 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
3341 $("#wy_name").val(datarecord.name);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3342 $("#wy_laboratory").val(datarecord.laboratory);
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3343 $("#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
3344 rowdata.y_name = datarecord.name;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3345 rowdata.y_cost = datarecord.cost;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3346 rowdata.y_type = datarecord.type;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3347 rowdata.y_form = datarecord.form;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3348 rowdata.y_laboratory = datarecord.laboratory;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3349 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
3350 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
3351 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
3352 rowdata.y_flocculation = datarecord.flocculation;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3353 rowdata.y_attenuation = datarecord.attenuation;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3354 rowdata.y_cells = datarecord.cells;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3355 rowdata.y_inventory = datarecord.inventory;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3356 if (rowdata.y_form == 0) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3357 $("#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
3358 } 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
3359 $("#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
3360 } else {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3361 $("#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
3362 }
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3363 calcFermentables();
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3364 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3365 });
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
3366 $("#wy_amount").jqxNumberInput( Spin1dec );
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3367 $('#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
3368 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
3369 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
3370 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
3371 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
3372 else
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3373 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
3374 rowdata.y_amount = amount;
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3375 calcFermentables();
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3376 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3377 $("#wy_use").jqxDropDownList({
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3378 theme: theme,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3379 source: YeastUseAdapter,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3380 valueMember: 'id',
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3381 displayMember: 'nl',
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3382 width: 180,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3383 height: 23,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3384 autoDropDownHeight: true,
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3385 dropDownVerticalAlignment: 'top'
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3386 });
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3387 $("#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
3388 if (event.args) {
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3389 var index = event.args.index;
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3390 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
3391 rowdata.y_use = index;
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3392 calcFermentabes();
226
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3393 }
40e68b18b50d The recipes yeast grid now uses a popup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
3394 });
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
3395
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3396 // 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
3397 $("#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
3398 $("#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
3399 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
3400 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
3401 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
3402 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
3403 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
3404 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
3405 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
3406 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
3407 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
3408 });
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
3409 $("#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
3410 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
3411 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
3412 // 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
3413 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
3414 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
3415 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
3416 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
3417 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
3418 }
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
3419 $("#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
3420 // 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
3421 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
3422 $("#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
3423 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
3424 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
3425 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
3426 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
3427 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
3428 // 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
3429 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
3430 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
3431 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
3432 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
3433 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
3434 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
3435 row["step_temp"] = data.step_temp;
350
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
3436 if (mashkg > 0)
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
3437 row["step_thickness"] = parseFloat(mash_infuse / mashkg);
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
3438 else
c314277905e6 Added mash thickness calculation. Backported some water calculations from the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 348
diff changeset
3439 row["step_thickness"] = 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
3440 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
3441 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
3442 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
3443 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
3444 }
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
3445 }
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
3446 });
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
3447 $("#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
3448 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
3449 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
3450 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
3451 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
3452 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
3453 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
3454 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
3455 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
3456 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
3457 });
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
3458 $("#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
3459 $("#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
3460 $("#mashGrid").jqxGrid('sortby', 'step_temp', 'asc');
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
3461 calcMash();
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
3462 });
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
3463 $("#wstep_name").jqxInput({ theme: theme, width: 320, height: 23 });
340
fa4eb830c151 Fixed mash step name field editing.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
3464 $("#wstep_name").on('change', function (event) {
fa4eb830c151 Fixed mash step name field editing.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
3465 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow);
fa4eb830c151 Fixed mash step name field editing.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
3466 rowdata.step_name = event.args.value;
fa4eb830c151 Fixed mash step name field editing.
Michiel Broek <mbroek@mbse.eu>
parents: 336
diff changeset
3467 });
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
3468 $("#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
3469 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
3470 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
3471 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
3472 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
3473 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
3474 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
3475 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
3476 });
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
3477 $("#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
3478 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
3479 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
3480 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
3481 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
3482 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
3483 $("#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
3484 $("#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
3485 } else {
229
cfd87d51a33c Reset infuse amount if not an infusion step
Michiel Broek <mbroek@mbse.eu>
parents: 228
diff changeset
3486 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
3487 $("#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
3488 $("#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
3489 }
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
3490 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
3491 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
3492 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
3493 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
3494 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
3495 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
3496 }
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
3497 }
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
3498 });
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
3499 $("#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
3500 $('#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
3501 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
3502 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
3503 });
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
3504 $("#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
3505 $('#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
3506 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
3507 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
3508 });
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
3509 $("#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
3510 $('#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
3511 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
3512 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
3513 });
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
3514 $("#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
3515 $('#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
3516 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
3517 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
3518 });
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
3519 $("#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
3520 $('#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
3521 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
3522 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
3523 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
3524 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
3525 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
3526 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
3527 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
3528 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
3529 }
264
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3530 if (dataRecord.w2_amount == 0) {
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3531 dataRecord.w1_amount = mash_infuse;
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3532 $("#w1_amount").val(mash_infuse);
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3533 } else {
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3534 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
3535 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
3536 $("#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
3537 $("#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
3538 }
24139883b9fa Adjust water volumes if mash infusion amount is changed.
Michiel Broek <mbroek@mbse.eu>
parents: 263
diff changeset
3539 $('#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
3540 });
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
3541
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3542 // Tab 7, Water
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3543 $("#tgt_bu").jqxNumberInput( Show2wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3544 $("#tgt_cl_so4").jqxNumberInput( Show1wat );
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
3545 $("#got_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
3546
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3547 // 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
3548 $("#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
3549 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
3550 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
3551 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
3552 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
3553 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
3554 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
3555 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
3556 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
3557 });
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
3558 $("#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
3559 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
3560 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
3561 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
3562 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
3563 $("#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
3564 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
3565 $("#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
3566 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
3567 $("#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
3568 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
3569 $("#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
3570 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
3571 $("#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
3572 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
3573 $("#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
3574 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
3575 $("#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
3576 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
3577 $("#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
3578 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
3579 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
3580 }
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
3581 });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3582 $("#w1_amount").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3583 $("#w1_calcium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3584 $("#w1_magnesium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3585 $("#w1_sodium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3586 $("#w1_total_alkalinity").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3587 $("#w1_chloride").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3588 $("#w1_sulfate").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3589 $("#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
3590 // 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
3591 $("#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
3592 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
3593 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
3594 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
3595 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
3596 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
3597 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
3598 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
3599 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
3600 });
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
3601 $("#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
3602 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
3603 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
3604 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
3605 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
3606 $("#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
3607 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
3608 $("#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
3609 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
3610 $("#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
3611 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
3612 $("#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
3613 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
3614 $("#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
3615 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
3616 $("#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
3617 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
3618 $("#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
3619 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
3620 $("#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
3621 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
3622 $("#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
3623 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
3624 }
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
3625 });
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
3626 $("#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
3627 $("#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
3628 $("#w2_calcium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3629 $("#w2_magnesium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3630 $("#w2_sodium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3631 $("#w2_total_alkalinity").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3632 $("#w2_chloride").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3633 $("#w2_sulfate").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3634 $("#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
3635 // Water mixed
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3636 $("#wg_amount").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3637 $("#wg_calcium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3638 $("#wg_magnesium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3639 $("#wg_sodium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3640 $("#wg_total_alkalinity").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3641 $("#wg_chloride").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3642 $("#wg_sulfate").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3643 $("#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
3644 // 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
3645 $("#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
3646 $("#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
3647 $("#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
3648 $("#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
3649 $("#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
3650 $("#wb_sodium").jqxNumberInput( Show1wat );
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
3651 $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'});
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3652 $("#wb_chloride").jqxNumberInput( Show1wat );
347
e6e7ec9e33e0 Finished bitterness and cl/so4 ratio calculations and design aids. Translated water error messages. Fixed recipes menu width.
Michiel Broek <mbroek@mbse.eu>
parents: 343
diff changeset
3653 $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'});
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3654 $("#wb_sulfate").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3655 $("#wb_total_alkalinity").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3656 $("#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
3657 // 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
3658 $("#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
3659 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
3660 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
3661 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
3662 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
3663 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
3664 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
3665 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
3666 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
3667 });
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
3668 $("#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
3669 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
3670 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
3671 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
3672 $("#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
3673 $("#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
3674 $("#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
3675 $("#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
3676 $("#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
3677 $("#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
3678 }
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
3679 });
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3680 $("#pr_calcium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3681 $("#pr_magnesium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3682 $("#pr_sodium").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3683 $("#pr_total_alkalinity").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3684 $("#pr_chloride").jqxNumberInput( Show1wat );
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
3685 $("#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
3686
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
3687 // 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
3688 $("#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
3689 $("#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
3690 $("#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
3691 $("#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
3692 $("#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
3693 $("#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
3694 $("#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
3695 $("#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
3696 $("#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
3697 $("#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
3698 $("#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
3699 $("#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
3700 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
3701 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
3702 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
3703 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
3704 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
3705 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
3706 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
3707 });
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
3708 $("#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
3709 $("#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
3710 $("#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
3711 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
3712 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
3713 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
3714 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
3715 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
3716 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
3717 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
3718 });
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
3719 $("#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
3720 $("#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
3721 $("#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
3722 $("#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
3723 // 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
3724 $("#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
3725 $("#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
3726 $("#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
3727 $("#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
3728 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
3729 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
3730 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
3731 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
3732 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
3733 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
3734 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
3735 });
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
3736 $("#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
3737 $("#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
3738 $("#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
3739 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
3740 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
3741 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
3742 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
3743 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
3744 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
3745 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
3746 });
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
3747 $("#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
3748 $("#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
3749
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3750 // Tabs inside the popup window.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3751 $('#jqxTabs').jqxTabs({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3752 theme: theme,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3753 width: 1280,
283
879b81864e4e The product and recipe editors disable the top menu so the user is forced to exit using the buttons on the first tab.
Michiel Broek <mbroek@mbse.eu>
parents: 271
diff changeset
3754 height: 660,
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3755 autoHeight: false,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3756 position: 'top'
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3757 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3758
359
98354ef399cd Lot's of improvements for recipes and products database load and save. Insert missing yeast tolerance field for old products and recipes. Recipe locked and calc_acid fields coverted to integer. In recipe edit screen removed the Print button. It is now included in the export screen. Added recipe export to forum screen.
Michiel Broek <mbroek@mbse.eu>
parents: 352
diff changeset
3759 // Buttons below
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
3760 $("#Export").jqxButton({ template: "info", width: '80px', theme: theme });
316
82c3bb9a40c2 See if we can solve the sometimes not saved data.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
3761 $("#Export").bind('click', function () {
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
3762 saveRecord();
303
98c2afc88780 Added recipe export menu.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
3763 var url="rec_export.php?record=" + my_record + "&return=" + my_return + "&name=" + dataRecord.name;
98c2afc88780 Added recipe export menu.
Michiel Broek <mbroek@mbse.eu>
parents: 301
diff changeset
3764 window.location.href = url;
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
3765 });
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
3766
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3767 $("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme });
316
82c3bb9a40c2 See if we can solve the sometimes not saved data.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
3768 $("#Delete").bind('click', function () {
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3769 // Open a popup to confirm this action.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3770 $('#eventWindow').jqxWindow('open');
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3771 $("#delOk").click(function () {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3772 var data = "delete=true&" + $.param({ record: my_record });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3773 $.ajax({
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3774 dataType: 'json',
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3775 url: url,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3776 cache: false,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3777 data: data,
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3778 type: "POST",
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3779 success: function (data, status, xhr) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3780 // delete command is executed.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3781 window.location.href = my_return;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3782 },
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3783 error: function (jqXHR, textStatus, errorThrown) {
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3784 }
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3785 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3786 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3787 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3788
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3789 $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme });
316
82c3bb9a40c2 See if we can solve the sometimes not saved data.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
3790 $("#Cancel").bind('click', function () {
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3791 window.location.href = my_return;
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3792 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3793
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
3794 $("#Save").jqxButton({ template: "success", width: '80px', theme: theme });
316
82c3bb9a40c2 See if we can solve the sometimes not saved data.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
3795 $("#Save").bind('click', function () {
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
3796 saveRecord();
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
3797 window.location.href = my_return;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3798 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3799 createDelElements();
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3800 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3801

mercurial