www/js/rec_edit.js

Wed, 03 Aug 2022 17:24:05 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 03 Aug 2022 17:24:05 +0200
changeset 807
ffb16dafbc93
parent 806
09f29253cc7e
child 808
f6dcde592a7b
permissions
-rw-r--r--

Phase 4, yeasts as a viewer.

68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
2 * Copyright (C) 2018-2022
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
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
23 var psugar = 0, // Percentage real sugars
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
24 pcara = 0, // Percentage cara/crystal malts
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
25 svg = 77, // Default attenuation
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
26 mashkg = 0, // Malt in mash weight
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
27 mash_infuse = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
28 dataRecord = {}, // Main recipe record
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
29 hop_flavour = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
30 hop_aroma = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
31 preboil_sg = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
32 last_base = '',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
33 last_acid = '',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
34 Ka1 = 0.0000004445,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
35 Ka2 = 0.0000000000468,
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
36 error_count = 0,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
37 MMCa = 40.048,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
38 MMMg = 24.305,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
39 MMNa = 22.98976928,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
40 MMCl = 35.453,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
41 MMSO4 = 96.0626,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
42 MMCO3 = 60.01684,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
43 MMHCO3 = 61.01684,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
44 MMCaSO4 = 172.171,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
45 MMCaCl2 = 147.015,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
46 MMCaCO3 = 100.087,
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
47 MMMgCl2 = 95.211, /* Since 27-06-2021 */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
48 MMMgSO4 = 246.475,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
49 MMNaHCO3 = 84.007,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
50 MMNa2CO3 = 105.996,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
51 MMNaCl = 58.443,
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
52 MMCaOH2 = 74.06268,
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
53 SpecificHeatWater = 1.0,
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
54 SpecificHeatMalt = 0.399, //cal/g.°C
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
55 SlakingHeat = 10.318, //cal/g.°C
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
56 eq_tun_weight = 2.0, // 2 Kg pot
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
57 eq_tun_specific_heat = 0.110, // Stainless Steel
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
58 data_loaded = 0;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
60 function hopFlavourContribution(bt, vol, use, amount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
61 var result;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
62
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
63 if (use == 4 || use == 5) // Whirlpool or Dry-hop
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
64 return 0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
65 if (use == 1) { // First wort
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
66 result = 0.15; // assume 15% flavourcontribution for fwh
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
67 } else if (bt > 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
68 result = 0.10; // assume 10% flavourcontribution as a minimum
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
69 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
70 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) / 6, 2));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
71 if (result < 0.10)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
72 result = 0.10; // assume 10% flavourcontribution as a minimum
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
73 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
74 return (result * amount * 1000) / vol;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
75 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
76
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
77
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
78 function hopAromaContribution(bt, vol, use, amount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
79 var result = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
80
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
81 if (use == 5) { // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
82 result = 1.33;
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
83 } else if (use == 4) { // Whirlpool
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
84 if (bt > 30)
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
85 bt = 30; // Max 30 minutes
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
86 result = 0.62 * bt / 30;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
87 } else if (bt > 20) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
88 result = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
89 } else if (bt > 7.5) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
90 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) / 4, 2));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
91 } else if (use == 2) { // Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
92 result = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
93 } else if (use == 3) { // Aroma
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
94 result = 1.2;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
95 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
96 return (result * amount * 1000) / vol;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
97 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
98
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
99
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
100 function setReadonly(ro) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
101 var rw = ! ro, w100 = 110, w80 = 80;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
102 if (ro) { // jqxNumberInput width -20 for no spinbuttons
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
103 w100 = 90;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
104 w80 = 60;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
105 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
106 $('#miscGrid').jqxGrid({ editable: rw });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
107 $('#maddrowbutton').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
108 $('#minstockbutton').jqxCheckBox({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
109 $('#mdeleterowbutton').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
110 $('#yeastGrid').jqxGrid({ editable: rw });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
111 $('#yaddrowbutton').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
112 $('#yinstockbutton').jqxCheckBox({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
113 $('#ydeleterowbutton').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
114 $('#mashGrid').jqxGrid({ editable: rw });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
115 $('#saddrowbutton').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
116 $('#sdeleterowbutton').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
117 $('#w1_name').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
118 $('#w2_name').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
119 $('#pr_name').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
120 $('#wa_cacl2').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
121 $('#wa_caso4').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
122 $('#wa_mgso4').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
123 $('#wa_nacl').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
124 $('#mash_ph').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
125 $('#calc_acid').jqxCheckBox({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
126 $('#wa_acid_name').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
127 $('#wa_acid').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
128 $('#wa_acid_perc').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w80 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
129 $('#sparge_temp').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
130 $('#sparge_volume').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
131 $('#sparge_ph').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
132 $('#sparge_source').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
133 $('#sparge_acid_type').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
134 $('#sparge_acid_perc').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
135 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
136
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
137
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
138 function calcPercentages() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
139
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
140 console.log('calcPercentages()');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
141 var tw, rowdata, percentage, i, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
142 if (rowscount > 1) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
143 tw = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
144 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
145 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
146 if (rowdata.f_added < 4)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
147 tw += Round(rowdata.f_amount, 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
148 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
149 tw = Round(tw, 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
150
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
151 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
152 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
153 if (rowdata.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
154 percentage = Round(rowdata.f_amount / tw * 100, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
155 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', percentage);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
156 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
157 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
158 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
159 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
160 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
161 $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
162 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
163 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
164
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
165
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
166 function calcFermentables() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
167 console.log('calcFermentables()');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
168 var i, row, rows, org, s = 0, d, x,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
169 sug, alc, cw, color, scolor, fig,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
170 sugarsf = 0, // fermentable sugars mash + boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
171 sugarsm = 0; // fermentable sugars in mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
172 vol = 0, // Volume sugars after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
173 addedS = 0, // Added sugars after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
174 addedmass = 0, // Added mass after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
175 mvol = 0, // mash volume
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
176 colort = 0, // Colors srm * vol totals
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
177 colorh = 0, // Colors ebc * vol * kt
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
178 colorn = 0, // Colors ebc * pt * pct
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
179 my_100 = false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
180 mashtime = 0, // Total mash time
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
181 mashtemp = 0, // Average mash temperature
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
182 bv = 0.925, // Bierverlies rendement
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
183 sr = 0.95, // Mash en spoel rendement
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
184 lintner = 0; // Total recipe lintner
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
185 /* Init global variables */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
186 psugar = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
187 pcara = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
188 mashkg = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
189
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
190 if ((rows = $('#mashGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
191 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
192 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
193 if (row.step_type == 0) // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
194 mvol += parseFloat(row.step_infuse_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
195 if (row.step_temp <= 75) { // Ignore mashout
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
196 mashtime += row.step_time;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
197 mashtemp += row.step_time * row.step_temp;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
198 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
199 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
200 mashtemp = mashtemp / mashtime;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
201 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
202
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
203 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
204 return; // grid not yet loaded.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
205 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
206
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
207 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
208 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
209 if (row.f_adjust_to_total_100)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
210 my_100 = true;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
211 if (row.f_type == 1 && row.f_added < 4) // Sugar
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
212 psugar += row.f_percentage;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
213 if (row.f_graintype == 2 && row.f_added < 4) // Crystal
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
214 pcara += row.f_percentage;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
215 d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
216 if (row.f_added == 0) { // Mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
217 if (mvol > 0) { // Only if mash already known
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
218 mvol += row.f_amount * row.f_moisture / 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
219 s += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
220 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
221 d = parseFloat(dataRecord.efficiency) / 100 * d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
222 sugarsm += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
223 mashkg += row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
224 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
225 if (row.f_added == 0 || row.f_added == 1) // Mash or Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
226 sugarsf += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
227 if (row.f_added == 2 || row.f_added == 3) { // Fermentation or lagering
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
228 x = (row.f_yield / 100) * (1 - row.f_moisture / 100);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
229 addedS += row.f_amount * x;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
230 addedmass += row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
231 vol += (x * sugardensity + (1 - x) * 1) * row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
232 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
233 if (row.f_added == 0 && (row.f_type == 0 || row.f_type == 4) && row.f_color < 50) { // Mash and Grain/Adjunct and Color < 50
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
234 lintner += row.f_diastatic_power * row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
235 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
236 if (row.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
237 colort += row.f_amount * ebc_to_srm(row.f_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
238 colorh += row.f_amount * row.f_color * get_kt(row.f_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
239 colorn += (row.f_percentage / 100) * row.f_color; // For 8.6 Pt wort.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
240 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
241 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
242 $('#ferm_lintner').val(Math.round(parseFloat(lintner / mashkg)));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
243 to_100 = my_100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
244
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
245 // Estimate total recipe OG.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
246 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
247 $('#est_og').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
248 $('#est_og2').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
249 org = dataRecord.est_og;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
250
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
251 // Estimate SG in kettle before boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
252 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
253
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
254 // Color of the wort
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
255 if (dataRecord.color_method == 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
256 color = Math.round(((sg_to_plato(dataRecord.est_og) / 8.6) * colorn) + (dataRecord.boil_time / 60));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
257 } else if (dataRecord.color_method == 3) { // Hans Halberstadt
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
258 color = Math.round((4.46 * bv * sr) / parseFloat(dataRecord.batch_size) * colorh);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
259 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
260 cw = colort / parseFloat(dataRecord.batch_size) * 8.34436;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
261 color = kw_to_ebc(dataRecord.color_method, cw);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
262 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
263 dataRecord.est_color = color;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
264 $('#est_color').val(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
265 $('#est_color2').val(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
266 scolor = ebc_to_color(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
267 document.getElementById('bcolor').style.background = scolor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
268 document.getElementById('bcolor2').style.background = scolor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
269
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
270 // Progress bars
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
271 pmalts = mashkg / (dataRecord.boil_size / 3) * 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
272 $('#perc_malts').jqxProgressBar('val', pmalts);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
273 $('#perc_sugars').jqxProgressBar('val', psugar);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
274 $('#perc_cara').jqxProgressBar('val', pcara);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
275
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
276 // Calculate estimated svg.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
277 svg = 0; // default.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
278 rows = $('#yeastGrid').jqxGrid('getrows');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
279 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
280 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
281 if (row.y_use == 0) { // Primary
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
282 if (parseFloat(row.y_attenuation) > svg)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
283 svg = parseFloat(row.y_attenuation); // Take the highest if multiple yeasts.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
284 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
285 // TODO: brett in secondary ??
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
286 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
287 if (svg == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
288 svg = 77;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
289
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
290 if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
291 dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
292 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
293 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
294 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
295 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
296 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
297 fig = dataRecord.est_fg;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
298
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
299 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
300 $('#est_abv').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
301 $('#est_abv2').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
302
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
303 // Calculate the calories in kcal/l (from brouwhulp)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
304 alc = 1881.22 * fig * (org - fig) / (1.775 - org);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
305 sug = 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
306 $('#kcal').val(Math.round((alc + sug) / (12 * 0.0295735296)));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
307 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
308
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
309
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
310 function swapMash(r1, r2) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
311
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
312 console.log('swap mash rows ' + r1 + ' ' + r2);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
313 var row1 = $('#mashGrid').jqxGrid('getrowdata', r1);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
314 var row2 = $('#mashGrid').jqxGrid('getrowdata', r2);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
315 var obj1 = { step_name: row1.step_name, step_type: row1.step_type, step_volume: row1.step_volume, step_infuse_amount: row1.step_infuse_amount,
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
316 step_infuse_temp: row1.step_infuse_temp, step_temp: row1.step_temp, step_time: row1.step_time,
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
317 ramp_time: row1.ramp_time, end_temp: row1.end_temp, step_wg_ratio: row1.step_wg_ratio };
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
318 var obj2 = { step_name: row2.step_name, step_type: row2.step_type, step_volume: row2.step_volume, step_infuse_amount: row2.step_infuse_amount,
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
319 step_infuse_temp: row2.step_infuse_temp, step_temp: row2.step_temp, step_time: row2.step_time,
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
320 ramp_time: row2.ramp_time, end_temp: row2.end_temp, step_wg_ratio: row2.step_wg_ratio };
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
321 $("#mashGrid").jqxGrid('updaterow', r1, obj2);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
322 $("#mashGrid").jqxGrid('updaterow', r2, obj1);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
323 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
324
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
325
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
326 function infusionVol(step_infused, step_mashkg, infuse_temp, step_temp, last_temp) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
327 var a = last_temp * (eq_tun_weight * eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
328 var b = step_temp * (eq_tun_weight * eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
329 var vol = Round(((b - a) / ((infuse_temp - step_temp) * SpecificHeatWater)), 2);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
330 console.log('infusionVol(' + step_infused + ', ' + step_mashkg + ', ' + infuse_temp + ', ' + step_temp + ', ' + last_temp + '): ' + vol);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
331 return vol;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
332 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
333
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
334
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
335 function decoctionVol(step_volume, step_temp, prev_temp) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
336 var a = (eq_tun_weight * eq_tun_specific_heat + step_volume * SpecificHeatWater) * (step_temp - prev_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
337 var b = SpecificHeatWater * (99 - step_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
338 var vol = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
339 if (b > 0)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
340 vol = Round(a / b, 6);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
341 console.log('decoctionVol(' + step_volume + ', ' + step_temp + ', ' + prev_temp + '): ' + vol);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
342 return vol;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
343 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
344
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
345
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
346 function calcMash() {
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
347 var infused = 0, vol, i, j, n, a, b, row, rows, temp;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
348 var lasttemp = 18.0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
349 var graintemp = 18.0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
350 var tuntemp = 18.0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
351
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
352 if ((rows = $('#mashGrid').jqxGrid('getrows')) && (mashkg > 0)) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
353 console.log('calcMash()');
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
354 for (i = 0; i < rows.length; i++) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
355 row = $('#mashGrid').jqxGrid('getrowdata', i);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
356 if (row.step_type == 0) { // Infusion
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
357 if (i == 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
358 // First mash step, temperature from the mashtun and malt.
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
359 n = 20; // tun is preheated.
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
360 tuntemp = row.step_temp;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
361 for (j = 0; j < n; j++) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
362 a = mashkg * graintemp * SpecificHeatMalt + eq_tun_weight * tuntemp * eq_tun_specific_heat;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
363 b = row.step_temp * (eq_tun_weight * eq_tun_specific_heat + row.step_infuse_amount * SpecificHeatWater + mashkg * SpecificHeatMalt) - SlakingHeat * mashkg;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
364 if (row.step_infuse_amount > 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
365 temp = (b - a) / (row.step_infuse_amount * SpecificHeatWater);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
366 } else {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
367 temp = 99;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
368 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
369 tuntemp += (temp - tuntemp) / 2;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
370 row.step_infuse_temp = Round(temp, 6);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
371 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
372 console.log('init infuse temp: ' + row.step_infuse_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
373 } else {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
374 // Calculate amount of infusion water.
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
375 row.step_infuse_amount = infusionVol(infused, mashkg, row.step_infuse_temp, row.step_temp, lasttemp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
376 //console.log('vol: ' + row.step_infuse_amount + ' temp: ' + row.step_infuse_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
377 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
378 infused += row.step_infuse_amount;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
379 } else if (row.step_type == 1) { // Temperature
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
380 if (i > 0)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
381 row.step_infuse_amount = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
382 row.step_infuse_temp = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
383 } else if (row.step_type == 2) { // Decoction
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
384 row.step_infuse_amount = decoctionVol(infused, row.step_temp, lasttemp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
385 row.step_infuse_temp = 99;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
386 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
387 row.step_volume = infused;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
388 //console.log(i + ' type: ' + row.step_type + ' volume: ' + row.step_infuse_amount + ' temp: ' + row.step_infuse_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
389 lasttemp = row.step_temp;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
390 mashtime += row.step_time + row.ramp_time;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
391 row.step_wg_ratio = Round(infused / mashkg, 6);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
392 $('#mashGrid').jqxGrid('updaterow', i, row);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
393 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
394 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
395 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
396
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
397
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
398 function calcIBUs() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
399 var total_ibus = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
400 rows = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
401 i, row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
402
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
403 hop_aroma = hop_flavour = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
404 if (!(rows = $('#hopGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
405 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
406 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
407 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
408 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
409 total_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, parseFloat(dataRecord.batch_size),
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
410 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method, 0, parseFloat(row.h_time), 0);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
411 hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), row.h_useat, parseFloat(row.h_amount));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
412 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), row.h_useat, parseFloat(row.h_amount));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
413 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
414 total_ibus = Round(total_ibus, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
415 hop_flavour = Round(hop_flavour * 100 / 5, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
416 hop_aroma = Round(hop_aroma * 100 / 6, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
417 if (hop_flavour > 100)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
418 hop_flavour = 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
419 if (hop_aroma > 100)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
420 hop_aroma = 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
421 console.log('calcIBUs(): ' + total_ibus + ' flavour: ' + hop_flavour + ' aroma: ' + hop_aroma);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
422 dataRecord.est_ibu = total_ibus;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
423 $('#est_ibu').val(total_ibus);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
424 $('#est_ibu2').val(total_ibus);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
425 $('#hop_flavour').jqxProgressBar('val', hop_flavour);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
426 $('#hop_aroma').jqxProgressBar('val', hop_aroma);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
427 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
428
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
429 /*
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
430 function adjustHops(factor) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
431
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
432 var i, row, amount, rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
433 if (rowscount == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
434 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
435
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
436 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
437 row = $('#hopGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
438 amount = row.h_amount * factor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
439 $('#hopGrid').jqxGrid('setcellvalue', i, 'h_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
440 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
441 }
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
442 */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
443
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
444 function adjustMiscs(factor) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
445
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
446 var i, row, amount, rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
447 if (rowscount == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
448 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
449
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
450 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
451 row = $('#miscGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
452 amount = row.m_amount * factor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
453 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
454 switch (row.m_name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
455 case 'CaCl2': $('#wa_cacl2').val(row.m_amount * 1000); break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
456 case 'CaSO4': $('#wa_caso4').val(row.m_amount * 1000); break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
457 case 'MgSO4': $('#wa_mgso4').val(row.m_amount * 1000); break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
458 case 'NaCl': $('#wa_nacl').val(row.m_amount * 1000); break;
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
459 case 'MgCl2': $('#wa_mgcl2').val(row.m_amount * 1000); break;
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
460 case 'NaHCO3': $('#wa_nahco3').val(row.m_amount * 1000); break;
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
461 case 'CaCO3': $('#wa_caco3').val(row.m_amount * 1000); break;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
462 case 'Melkzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
463 case 'Zoutzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
464 case 'Fosforzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
465 case 'Zwavelzuur': $('#wa_acid').val(row.m_amount * 1000); break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
466 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
467 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
468 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
469
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
470
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
471 function adjustYeasts(factor) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
472
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
473 var i, row, amount, rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
474 if (rowscount == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
475 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
476
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
477 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
478 row = $('#yeastGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
479 if (row.y_form == 1) { // Only adjust dry yeast
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
480 amount = row.y_amount * factor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
481 $('#yeastGrid').jqxGrid('setcellvalue', i, 'y_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
482 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
483 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
484 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
485
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
486
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
487 function adjustWaters(factor) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
488
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
489 var i, row, amount, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
490 if (rowscount == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
491 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
492 mash_infuse = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
493 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
494 row = $('#mashGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
495 if (row.step_type == 0) { // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
496 amount = Round(row.step_infuse_amount * factor, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
497 $('#mashGrid').jqxGrid('setcellvalue', i, 'step_infuse_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
498 mash_infuse += amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
499 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
500 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
501 if (dataRecord.w2_amount == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
502 dataRecord.w1_amount = mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
503 $('#w1_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
504 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
505 dataRecord.w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
506 dataRecord.w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
507 $('#w1_amount').val(dataRecord.w1_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
508 $('#w2_amount').val(dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
509 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
510 $('#wg_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
511 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
512
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
513
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
514 function GetBUGU() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
515 var gu = (dataRecord.est_og - 1) * 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
516 if (gu > 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
517 return dataRecord.est_ibu / gu;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
518 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
519 return 0.5;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
520 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
521
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
522
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
523 function GetOptSO4Clratio() {
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
524 if (parseFloat($('#pr_sulfate').jqxNumberInput('decimal')) > 0 && parseFloat($('#pr_chloride').jqxNumberInput('decimal'))) {
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
525 return (parseFloat($('#pr_sulfate').jqxNumberInput('decimal')) / parseFloat($('#pr_chloride').jqxNumberInput('decimal')));
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
526 } else {
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
527 var BUGU = GetBUGU();
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
528 return (-1.2 * BUGU + 1.4);
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
529 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
530 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
531
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
532
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
533
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
534 function setRangeIndicator(ion, rangeCode) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
535 if ((rangeCode == 'laag') || (rangeCode == 'hoog'))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
536 $('#wr_' + ion).html('<img src="images/dialog-error.png"><span style="vertical-align: top; font-size: 10px; font-style: italic;">' + rangeCode + '</span>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
537 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
538 $('#wr_' + ion).html('<img src="images/dialog-ok-apply.png">');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
539 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
540
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
541
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
542 function mix(v1, v2, c1, c2) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
543 if ((v1 + v2) > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
544 return ((v1 * c1) + (v2 * c2)) / (v1 + v2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
545 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
546 return 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
547 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
548
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
549
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
550 // mg/l as CaCO3
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
551 function ResidualAlkalinity(total_alkalinity, calcium, magnesium) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
552 return total_alkalinity - (calcium / 1.4 + magnesium / 1.7);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
553 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
554
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
555
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
556 function PartCO3(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
557 var H = Math.pow(10, -pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
558 return 100 * Ka1 * Ka2 / (H * H + H * Ka1 + Ka1 * Ka2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
559 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
560
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
561
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
562 function PartHCO3(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
563 var H = Math.pow(10, -pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
564 return 100 * Ka1 * H / (H * H + H * Ka1 + Ka1 * Ka2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
565 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
566
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
567
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
568 function Charge(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
569 return (-2 * PartCO3(pH) - PartHCO3(pH));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
570 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
571
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
572
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
573 //Z alkalinity is the amount of acid (in mEq/l) needed to bring water to the target pH (Z pH)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
574 function ZAlkalinity(pHZ) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
575 var C43 = Charge(4.3),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
576 Cw = Charge(parseFloat($('#wg_ph').jqxNumberInput('decimal'))),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
577 Cz = Charge(pHZ),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
578 DeltaCNaught = -C43 + Cw,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
579 CT = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')) / 50 / DeltaCNaught,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
580 DeltaCZ = -Cz + Cw;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
581 return CT * DeltaCZ;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
582 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
583
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
584
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
585 //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)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
586 function ZRA(pHZ) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
587 var Calc = parseFloat($('#wg_calcium').jqxNumberInput('decimal')) / (MMCa / 2),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
588 Magn = parseFloat($('#wg_magnesium').jqxNumberInput('decimal')) / (MMMg / 2),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
589 Z = ZAlkalinity(pHZ);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
590 return Z - (Calc / 3.5 + Magn / 7);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
591 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
592
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
593
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
594 function BufferCapacity(di_ph, acid_to_ph_57, ebc, graintype) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
595 C1 = 0;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
596 if ((di_ph != 5.7) && ((acid_to_ph_57 < - 0.1) || (acid_to_ph_57 > 0.1))) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
597 C1 = acid_to_ph_57 / (di_ph - 5.7);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
598 } else {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
599 // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid.
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
600 switch (graintype) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
601 case 0: // Base, Special, Kilned
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
602 case 3:
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
603 case 5: C1 = 0.014 * ebc - 34.192;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
604 break;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
605 case 2: C1 = -0.0597 * ebc - 32.457; // Crystal
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
606 break;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
607 case 1: C1 = 0.0107 * ebc - 54.768; // Roast
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
608 break;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
609 case 4: C1 = -149; // Sour malt
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
610 break;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
611 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
612 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
613 return C1;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
614 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
615
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
616
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
617 function ProtonDeficit(pHZ) {
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
618 var C1, i, rows, row, Result = ZRA(pHZ) * parseFloat($('#wg_amount').jqxNumberInput('decimal'));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
619 // proton deficit for the grist
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
620 if ((rows = $('#fermentableGrid').jqxGrid('getrows'))) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
621 for (i = 0; i < rows.length; i++) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
622 row = rows[i];
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
623 if (row.f_added == 0 && row.f_graintype != 6) { // Added == Mash && graintype != No Malt
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
624 C1 = BufferCapacity(row.f_di_ph, row.f_acid_to_ph_57, row.f_color, row.f_graintype);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
625 x = C1 * (pHZ - row.f_di_ph); // AcidRequired(ZpH)
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
626 Result += x * row.f_amount;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
627 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
628 }
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
629 } else {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
630 error_count++;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
631 if (error_count < 5)
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
632 console.log('ProtonDeficit(' + pHZ + ') invalid grist, return ' + Result);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
633 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
634 return Result;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
635 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
636
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
637
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
638 function MashpH() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
639 var n = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
640 pH = 5.4,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
641 deltapH = 0.001,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
642 deltapd = 0.1,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
643 pd = ProtonDeficit(pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
644 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
645 n++;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
646 if (pd < -deltapd)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
647 pH -= deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
648 else if (pd > deltapd)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
649 pH += deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
650 pd = ProtonDeficit(pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
651 }
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
652 pH = Round(pH, 6);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
653 //console.log('MashpH() n: ' + n + ' pH: ' + pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
654 return pH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
655 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
656
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
657
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
658
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
659
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
660 $(document).ready(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
661
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
662 var to_100 = false, // Fermentables adjust to 100%
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
663
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
664 fermentableRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
665 fermentableData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
666 hopRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
667 hopData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
668 miscRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
669 miscData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
670 yeastRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
671 yeastData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
672 mashRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
673 mashData = {},
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
674
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
675 url = 'includes/db_recipes.php',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
676 // prepare the data
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
677 source = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
678 datatype: 'json',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
679 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
680 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
681 { name: 'record', type: 'number' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
682 { name: 'uuid', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
683 { name: 'locked', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
684 { name: 'st_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
685 { name: 'st_letter', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
686 { name: 'st_guide', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
687 { name: 'st_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
688 { name: 'st_category', type: 'string' },
710
9646123ea063 Fixed st_category_namber to be an integer value instead of float. The calc_acid in a new recipe is integer. Added missing wg_ and wb_ fields in a new recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 667
diff changeset
689 { name: 'st_category_number', type: 'int' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
690 { name: 'st_og_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
691 { name: 'st_og_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
692 { name: 'st_fg_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
693 { name: 'st_fg_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
694 { name: 'st_ibu_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
695 { name: 'st_ibu_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
696 { name: 'st_color_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
697 { name: 'st_color_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
698 { name: 'st_carb_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
699 { name: 'st_carb_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
700 { name: 'st_abv_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
701 { name: 'st_abv_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
702 { name: 'name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
703 { name: 'notes', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
704 { name: 'type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
705 { name: 'batch_size', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
706 { name: 'boil_size', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
707 { name: 'boil_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
708 { name: 'efficiency', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
709 { name: 'est_og', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
710 { name: 'est_fg', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
711 { name: 'est_abv', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
712 { name: 'est_color', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
713 { name: 'color_method', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
714 { name: 'est_ibu', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
715 { name: 'ibu_method', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
716 { name: 'est_carb', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
717 { name: 'sparge_temp', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
718 { name: 'sparge_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
719 { name: 'sparge_volume', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
720 { name: 'sparge_source', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
721 { name: 'sparge_acid_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
722 { name: 'sparge_acid_perc', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
723 { name: 'sparge_acid_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
724 { name: 'mash_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
725 { name: 'mash_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
726 { name: 'calc_acid', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
727 { name: 'w1_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
728 { name: 'w1_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
729 { name: 'w1_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
730 { name: 'w1_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
731 { name: 'w1_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
732 { name: 'w1_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
733 { name: 'w1_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
734 { name: 'w1_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
735 { name: 'w1_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
736 { name: 'w1_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
737 { name: 'w2_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
738 { name: 'w2_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
739 { name: 'w2_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
740 { name: 'w2_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
741 { name: 'w2_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
742 { name: 'w2_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
743 { name: 'w2_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
744 { name: 'w2_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
745 { name: 'w2_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
746 { name: 'w2_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
747 { name: 'wg_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
748 { name: 'wg_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
749 { name: 'wg_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
750 { name: 'wg_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
751 { name: 'wg_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
752 { name: 'wg_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
753 { name: 'wg_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
754 { name: 'wg_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
755 { name: 'wb_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
756 { name: 'wb_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
757 { name: 'wb_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
758 { name: 'wb_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
759 { name: 'wb_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
760 { name: 'wb_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
761 { name: 'wb_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
762 { name: 'wa_acid_name', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
763 { name: 'wa_acid_perc', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
764 { name: 'wa_base_name', type: 'int' },
775
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
765 { name: 'fermentables', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
766 { name: 'hops', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
767 { name: 'miscs', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
768 { name: 'yeasts', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
769 { name: 'mashs', type: 'string' }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
770 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
771 id: 'record',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
772 url: url + '?record=' + my_record
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
773 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
774 // Load data and select one record.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
775 dataAdapter = new $.jqx.dataAdapter(source, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
776 loadComplete: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
777 var records = dataAdapter.records;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
778 dataRecord = records[0];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
779 // Hidden record uuid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
780 $('#name').val(dataRecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
781 $('#notes').val(dataRecord.notes);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
782 $('#locked').val(dataRecord.locked);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
783 $('#st_name').val(dataRecord.st_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
784 $('#st_letter').val(dataRecord.st_letter);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
785 $('#st_guide').val(dataRecord.st_guide);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
786 $('#st_category').val(dataRecord.st_category);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
787 $('#st_category_number').val(dataRecord.st_category_number);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
788 $('#st_type').val(StyleTypeData[dataRecord.st_type].nl);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
789 $('#type').val(RecipeTypeData[dataRecord.type].nl);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
790 $('#batch_size').val(dataRecord.batch_size);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
791 $('#boil_size').val(dataRecord.boil_size);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
792 $('#boil_time').val(dataRecord.boil_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
793 $('#efficiency').val(dataRecord.efficiency);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
794 $('#est_og').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
795 $('#est_og2').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
796 $('#st_og_min').val(dataRecord.st_og_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
797 $('#st_og_max').val(dataRecord.st_og_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
798 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
799 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
800 $('#st_fg_min').val(dataRecord.st_fg_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
801 $('#st_fg_max').val(dataRecord.st_fg_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
802 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
803 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
804 $('#st_fg_min').val(dataRecord.st_fg_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
805 $('#st_fg_max').val(dataRecord.st_fg_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
806 $('#est_color').val(dataRecord.est_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
807 $('#est_color2').val(dataRecord.est_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
808 $('#est_abv').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
809 $('#est_abv2').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
810 $('#st_abv_min').val(dataRecord.st_abv_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
811 $('#st_abv_max').val(dataRecord.st_abv_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
812 $('#st_color_min').val(dataRecord.st_color_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
813 $('#st_color_max').val(dataRecord.st_color_max);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
814 $('#color_method').val(ColorMethodData[dataRecord.color_method].nl);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
815 $('#est_ibu').val(dataRecord.est_ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
816 $('#est_ibu2').val(dataRecord.est_ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
817 $('#st_ibu_min').val(dataRecord.st_ibu_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
818 $('#st_ibu_max').val(dataRecord.st_ibu_max);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
819 $('#ibu_method').val(IBUmethodData[dataRecord.ibu_method].nl);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
820 $('#est_carb').val(dataRecord.est_carb);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
821 $('#st_carb_min').val(dataRecord.st_carb_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
822 $('#st_carb_max').val(dataRecord.st_carb_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
823 $('#mash_name').val(dataRecord.mash_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
824 $('#mash_ph').val(dataRecord.mash_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
825 $('#sparge_temp').val(dataRecord.sparge_temp);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
826 $('#sparge_ph').val(dataRecord.sparge_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
827 $('#sparge_volume').val(dataRecord.sparge_volume);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
828 $('#sparge_source').val(dataRecord.sparge_source);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
829 $('#sparge_acid_type').val(dataRecord.sparge_acid_type);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
830 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
831 $('#sparge_acid_amount').val(dataRecord.sparge_acid_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
832 $('#calc_acid').val(dataRecord.calc_acid);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
833 $('#w1_name').val(dataRecord.w1_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
834 $('#w1_amount').val(dataRecord.w1_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
835 $('#w1_calcium').val(dataRecord.w1_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
836 $('#w1_sulfate').val(dataRecord.w1_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
837 $('#w1_chloride').val(dataRecord.w1_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
838 $('#w1_sodium').val(dataRecord.w1_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
839 $('#w1_magnesium').val(dataRecord.w1_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
840 $('#w1_total_alkalinity').val(dataRecord.w1_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
841 $('#w1_ph').val(dataRecord.w1_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
842 $('#w1_cost').val(dataRecord.w1_cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
843 $('#w2_name').val(dataRecord.w2_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
844 $('#w2_amount').val(dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
845 $('#w2_calcium').val(dataRecord.w2_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
846 $('#w2_sulfate').val(dataRecord.w2_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
847 $('#w2_chloride').val(dataRecord.w2_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
848 $('#w2_sodium').val(dataRecord.w2_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
849 $('#w2_magnesium').val(dataRecord.w2_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
850 $('#w2_total_alkalinity').val(dataRecord.w2_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
851 $('#w2_ph').val(dataRecord.w2_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
852 $('#w2_cost').val(dataRecord.w2_cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
853 $('#wg_amount').val(dataRecord.wg_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
854 $('#wg_calcium').val(dataRecord.wg_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
855 $('#wg_sulfate').val(dataRecord.wg_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
856 $('#wg_chloride').val(dataRecord.wg_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
857 $('#wg_sodium').val(dataRecord.wg_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
858 $('#wg_magnesium').val(dataRecord.wg_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
859 $('#wg_total_alkalinity').val(dataRecord.wg_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
860 $('#wg_ph').val(dataRecord.wg_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
861 $('#wb_calcium').val(dataRecord.wb_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
862 $('#wb_sulfate').val(dataRecord.wb_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
863 $('#wb_chloride').val(dataRecord.wb_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
864 $('#wb_sodium').val(dataRecord.wb_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
865 $('#wb_magnesium').val(dataRecord.wb_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
866 $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
867 $('#wb_ph').val(dataRecord.wb_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
868 $('#wa_acid_name').val(dataRecord.wa_acid_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
869 $('#wa_acid_perc').val(dataRecord.wa_acid_perc);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
870 editFermentable(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
871 editHop(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
872 editMisc(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
873 editYeast(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
874 editMash(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
875 $('#jqxTabs').jqxTabs('next');
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
876 data_loaded = 1;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
877 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
878 loadError: function(jqXHR, status, error) {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
879 beforeLoadComplete: function(records) { $('#jqxLoader').jqxLoader('open'); }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
880 }),
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
881
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
882 // Inline fermentables editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
883 editFermentable = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
884 var fermentableSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
885 localdata: data.fermentables,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
886 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
887 { name: 'f_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
888 { name: 'f_origin', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
889 { name: 'f_supplier', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
890 { name: 'f_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
891 { name: 'f_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
892 { name: 'f_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
893 { name: 'f_yield', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
894 { name: 'f_color', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
895 { name: 'f_coarse_fine_diff', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
896 { name: 'f_moisture', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
897 { name: 'f_diastatic_power', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
898 { name: 'f_protein', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
899 { name: 'f_max_in_batch', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
900 { name: 'f_graintype', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
901 { name: 'f_added', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
902 { name: 'f_dissolved_protein', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
903 { name: 'f_recommend_mash', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
904 { name: 'f_add_after_boil', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
905 { name: 'f_adjust_to_total_100', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
906 { name: 'f_percentage', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
907 { name: 'f_di_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
908 { name: 'f_acid_to_ph_57', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
909 { name: 'f_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
910 { name: 'f_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
911 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
912 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
913 fermentableAdapter = new $.jqx.dataAdapter(fermentableSource);
263
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
914
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
915 $('#fermentableGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
916 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
917 height: 470,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
918 source: fermentableAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
919 theme: theme,
805
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
920 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
921 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
922 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
923 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
924 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
925 columns: [
805
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
926 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name' },
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
927 { text: 'Leverancier', datafield: 'f_supplier', width: 180 },
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
928 { text: 'Kleur', datafield: 'f_color', width: 90, align: 'right',
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
929 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
930 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value, 'f0') + ' EBC</span>';
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
931 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
932 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
933 { text: 'Type', width: 100, datafield: 'f_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
934 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
935 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + FermentableTypeData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
936 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
937 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
938 { text: 'Moment', width: 110, datafield: 'f_added',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
939 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
940 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + AddedData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
941 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
942 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
943 { text: 'Maxinbatch', datafield: 'f_max_in_batch', hidden: true },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
944 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
945 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
946 { text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
947 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
948 var color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
949 if (value > rowdata.f_max_in_batch)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
950 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
951 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
952 color + ';">' + fermentableAdapter.formatNumber(value, 'p1') + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
953 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
954 },
805
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
955 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
956 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
957 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
958 };
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
959
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
960 // Inline hops editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
961 var editHop = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
962 var hopSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
963 localdata: data.hops,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
964 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
965 { name: 'h_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
966 { name: 'h_origin', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
967 { name: 'h_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
968 { name: 'h_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
969 { name: 'h_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
970 { name: 'h_form', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
971 { name: 'h_useat', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
972 { name: 'h_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
973 { name: 'h_alpha', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
974 { name: 'h_beta', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
975 { name: 'h_hsi', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
976 { name: 'h_humulene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
977 { name: 'h_caryophyllene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
978 { name: 'h_cohumulone', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
979 { name: 'h_myrcene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
980 { name: 'h_total_oil', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
981 { name: 'h_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
982 { name: 'h_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
983 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
984 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
985 hopAdapter = new $.jqx.dataAdapter(hopSource);
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
986
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
987 $('#hopGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
988 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
989 height: 560,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
990 source: hopAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
991 theme: theme,
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
992 editable: false,
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
993 ready: function() { $('#jqxTabs').jqxTabs('next'); },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
994 columns: [
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
995 { text: 'Hop', datafield: 'h_name' },
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
996 { text: 'Origin', width: 180, datafield: 'h_origin' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
997 { text: 'Type', width: 90, datafield: 'h_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
998 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
999 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1000 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1001 },
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1002 { text: 'Vorm', width: 110, datafield: 'h_form',
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1003 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1004 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1005 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1006 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1007 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1008 { text: 'Gebruik', width: 110, datafield: 'h_useat',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1009 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1010 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopUseData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1011 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1012 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1013 { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1014 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1015 var duration = '';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1016 if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1017 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1018 else if (rowdata.h_useat == 5) // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1019 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1020 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1021 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1022 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1023 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1024 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1025 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat(dataRecord.batch_size),
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1026 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time),
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1027 parseFloat(rowdata.h_alpha), dataRecord.ibu_method, 0, parseFloat(rowdata.h_time), 0);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1028 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, 'f1') + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1029 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1030 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1031 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1032 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1033 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1034 if (value < 1)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1035 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1036 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1037 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1038 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1039 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1040 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1041 };
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
1042
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1043 // Inline miscs editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1044 var editMisc = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1045 var miscSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1046 localdata: data.miscs,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1047 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1048 { name: 'm_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1049 { name: 'm_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1050 { name: 'm_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1051 { name: 'm_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1052 { name: 'm_use_use', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1053 { name: 'm_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1054 { name: 'm_amount_is_weight', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1055 { name: 'm_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1056 { name: 'm_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1057 ],
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1058 // addrow: function(rowid, rowdata, position, commit) { commit(true); },
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1059 // deleterow: function(rowid, commit) { commit(true); },
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1060 // updaterow: function(rowid, rowdata, commit) { commit(true); }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1061 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1062 miscAdapter = new $.jqx.dataAdapter(miscSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1063 beforeLoadComplete: function(records) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1064 var i, row, data = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1065 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1066 row = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1067 data.push(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1068 // Initial set water agent values.
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1069 if (row.m_use_use == 1) { // Mash
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1070 switch (row.m_name) {
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1071 case 'CaCl2':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1072 $('#wa_cacl2').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1073 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1074 case 'CaSO4':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1075 $('#wa_caso4').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1076 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1077 case 'MgSO4':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1078 $('#wa_mgso4').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1079 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1080 case 'NaCl':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1081 $('#wa_nacl').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1082 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1083 case 'MgCl2':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1084 $('#wa_mgcl2').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1085 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1086 case 'NaHCO3':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1087 $('#wa_nahco3').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1088 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1089 case 'CaCO3':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1090 $('#wa_caco3').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1091 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1092 case 'Melkzuur':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1093 $('#wa_acid_name').val(0);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1094 $('#wa_acid').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1095 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1096 last_acid = 'Melkzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1097 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1098 case 'Zoutzuur':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1099 $('#wa_acid_name').val(1);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1100 $('#wa_acid').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1101 $('#wa_acid_perc').val(AcidTypeData[1].AcidPrc);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1102 last_acid = 'Zoutzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1103 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1104 case 'Fosforzuur':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1105 $('#wa_acid_name').val(2);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1106 $('#wa_acid').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1107 $('#wa_acid_perc').val(AcidTypeData[2].AcidPrc);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1108 last_acid = 'Fosforzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1109 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1110 case 'Zwavelzuur':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1111 $('#wa_acid_name').val(3);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1112 $('#wa_acid').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1113 $('#wa_acid_perc').val(AcidTypeData[3].AcidPrc);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1114 last_acid = 'Zwavelzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1115 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1116 }
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1117 }
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1118 if (row.m_use_use == 6) { // Sparge
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1119 /*switch (row.m_name) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1120 case 'CaCl2':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1121 $('#wa_cacl2').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1122 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1123 case 'CaSO4':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1124 $('#wa_caso4').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1125 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1126 case 'MgSO4':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1127 $('#wa_mgso4').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1128 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1129 case 'NaCl':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1130 $('#wa_nacl').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1131 break;
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1132 case 'MgCl2':
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1133 $('#wa_mgcl2').val(row.m_amount * 1000);
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1134 break;
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1135 case 'NaHCO3':
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1136 $('#wa_nahco3').val(row.m_amount * 1000);
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1137 break;
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1138 case 'CaCO3':
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1139 $('#wa_caco3').val(row.m_amount * 1000);
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1140 break;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1141 case 'Melkzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1142 $('#wa_acid_name').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1143 $('#wa_acid').val(row.m_amount * 1000);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1144 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc); // TODO: this ignores changed percentages.
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1145 last_acid = 'Melkzuur';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1146 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1147 case 'Zoutzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1148 $('#wa_acid_name').val(1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1149 $('#wa_acid').val(row.m_amount * 1000);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1150 $('#wa_acid_perc').val(AcidTypeData[1].AcidPrc);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1151 last_acid = 'Zoutzuur';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1152 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1153 case 'Fosforzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1154 $('#wa_acid_name').val(2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1155 $('#wa_acid').val(row.m_amount * 1000);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1156 $('#wa_acid_perc').val(AcidTypeData[2].AcidPrc);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1157 last_acid = 'Fosforzuur';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1158 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1159 case 'Zwavelzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1160 $('#wa_acid_name').val(3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1161 $('#wa_acid').val(row.m_amount * 1000);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1162 $('#wa_acid_perc').val(AcidTypeData[3].AcidPrc);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1163 last_acid = 'Zwavelzuur';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1164 break;
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1165 } */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1166 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1167 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1168 return data;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1169 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1170 loadError: function(jqXHR, status, error) {}
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1171 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1172 $('#miscGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1173 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1174 height: 575,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1175 source: miscAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1176 theme: theme,
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1177 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1178 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1179 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1180 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1181 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1182 { text: 'Ingredient', datafield: 'm_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1183 { text: 'Type', width: 140, datafield: 'm_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1184 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1185 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscTypeData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1186 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1187 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1188 { text: 'Gebruik', width: 140, datafield: 'm_use_use',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1189 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1190 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscUseData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1191 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1192 },
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1193 { text: 'Tijd', datafield: 'm_time', width: 140, align: 'right',
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1194 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1195 var duration = '';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1196 if (rowdata.m_use_use == 2) // Boil
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1197 duration = dataAdapter.formatNumber(value, 'f0') + ' minuten';
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1198 else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1199 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1200 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1201 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1202 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1203 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1204 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1205 var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1206 return '<span style="margin: 4px; margin-top: 6px; float: right;">' +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1207 dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1208 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1209 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1210 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1211 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1212 };
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
1213
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1214 // Inline yeasts editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1215 var editYeast = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1216 var yeastSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1217 localdata: data.yeasts,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1218 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1219 { name: 'y_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1220 { name: 'y_laboratory', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1221 { name: 'y_product_id', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1222 { name: 'y_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1223 { name: 'y_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1224 { name: 'y_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1225 { name: 'y_form', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1226 { name: 'y_flocculation', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1227 { name: 'y_min_temperature', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1228 { name: 'y_max_temperature', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1229 { name: 'y_attenuation', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1230 { name: 'y_use', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1231 { name: 'y_cells', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1232 { name: 'y_tolerance', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1233 { name: 'y_inventory', type: 'float' },
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1234 { name: 'y_sta1', type: 'int' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1235 { name: 'y_bacteria', type: 'int' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1236 { name: 'y_harvest_top', type: 'int' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1237 { name: 'y_harvest_time', type: 'int' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1238 { name: 'y_pitch_temperature', type: 'float' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1239 { name: 'y_pofpos', type: 'int' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1240 { name: 'y_zymocide', type: 'int' },
735
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1241 { name: 'y_gr_hl_lo', type: 'int' },
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1242 { name: 'y_sg_lo', type: 'float' },
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1243 { name: 'y_gr_hl_hi', type: 'int' },
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1244 { name: 'y_sg_hi', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1245 { name: 'y_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1246 ],
807
ffb16dafbc93 Phase 4, yeasts as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 806
diff changeset
1247 // addrow: function(rowid, rowdata, position, commit) { commit(true); },
ffb16dafbc93 Phase 4, yeasts as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 806
diff changeset
1248 // deleterow: function(rowid, commit) { commit(true); },
ffb16dafbc93 Phase 4, yeasts as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 806
diff changeset
1249 // updaterow: function(rowid, rowdata, commit) { commit(true); }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1250 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1251 yeastAdapter = new $.jqx.dataAdapter(yeastSource);
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
1252
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1253 $('#yeastGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1254 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1255 height: 350,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1256 source: yeastAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1257 theme: theme,
807
ffb16dafbc93 Phase 4, yeasts as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 806
diff changeset
1258 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1259 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1260 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1261 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1262 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1263 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1264 { text: 'Gist', datafield: 'y_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1265 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1266 { text: 'Code', width: 90, datafield: 'y_product_id' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1267 { text: 'Soort', width: 100, datafield: 'y_form',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1268 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1269 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastFormData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1270 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1271 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1272 { text: 'Min. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1273 { text: 'Max. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1274 { text: 'Tol. %', width: 60, align: 'right', cellsalign: 'right', datafield: 'y_tolerance',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1275 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1276 var amount = '', color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1277 if (value > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1278 amount = dataAdapter.formatNumber(value, 'f1');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1279 if (dataRecord.est_abv > value)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1280 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1281 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1282 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1283 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1284 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1285 { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1286 { text: 'Voor', width: 120, datafield: 'y_use',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1287 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1288 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastUseData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1289 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1290 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1291 { text: 'Hoeveel', datafield: 'y_amount', width: 90, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1292 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1293 var amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1294 if (rowdata.y_form == 0) // Liquid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1295 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1296 else if (rowdata.y_form == 1) // Dry
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1297 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1298 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1299 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1300 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1301 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1302 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1303 };
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
1304
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1305 // inline mash editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1306 var editMash = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1307 var mashSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1308 localdata: data.mashs,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1309 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1310 { name: 'step_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1311 { name: 'step_type', type: 'int' },
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1312 { name: 'step_volume', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1313 { name: 'step_infuse_amount', type: 'float' },
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1314 { name: 'step_infuse_temp', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1315 { name: 'step_temp', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1316 { name: 'step_time', type: 'float' },
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1317 { name: 'step_wg_ratio', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1318 { name: 'ramp_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1319 { name: 'end_temp', type: 'float' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1320 ],
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1321 addrow: function(rowid, rowdata, position, commit) { commit(true); },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1322 deleterow: function(rowid, commit) { commit(true); }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1323 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1324 mashAdapter = new $.jqx.dataAdapter(mashSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1325 beforeLoadComplete: function(records) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1326 mash_infuse = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1327 var row, i, data = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1328 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1329 row = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1330 if (row.step_type == 0) // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1331 mash_infuse += parseFloat(row.step_infuse_amount);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1332 row.step_wg_ratio = 0; // Init this field.
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1333 data.push(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1334 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1335 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1336 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1337 $('#mashGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1338 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1339 height: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1340 source: mashAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1341 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1342 selectionmode: 'singlerow',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1343 showtoolbar: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1344 rendertoolbar: function(toolbar) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1345 //var me = this;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1346 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1347 toolbar.append(container);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1348 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1349 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1350 $('#saddrowbutton').jqxButton({ template: 'primary', theme: theme, height: 27, width: 150 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1351 $('#saddrowbutton').on('click', function() {
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1352 var row = {}, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1353 row['step_name'] = 'Stap ' + (rowscount + 1);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1354 if (rowscount > 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1355 row['step_type'] = 1;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1356 row['step_infuse_amount'] = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1357 row['step_volume'] = mash_infuse;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1358 } else {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1359 row['step_type'] = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1360 row['step_infuse_amount'] = 15;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1361 row['step_volume'] = 15;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1362 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1363 row['step_infuse_temp'] = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1364 row['step_temp'] = 62.0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1365 row['step_time'] = 20.0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1366 row['step_wg_ratio'] = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1367 row['ramp_time'] = 1.0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1368 row['end_temp'] = 62.0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1369 $('#mashGrid').jqxGrid('addrow', null, datarow);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1370 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1371 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1372 // delete selected yeast.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1373 $('#sdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1374 $('#sdeleterowbutton').on('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1375 var id, rowscount, selectedrowindex = $('#mashGrid').jqxGrid('getselectedrowindex');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1376 rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1377 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1378 id = $('#mashGrid').jqxGrid('getrowid', selectedrowindex);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1379 $('#mashGrid').jqxGrid('deleterow', id);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1380 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1381 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1382 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1383 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1384 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1385 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1386 calcInit();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1387 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1388 $('#jqxLoader').jqxLoader('close');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1389 $('#jqxTabs').jqxTabs('first');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1390 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1391 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1392 { text: 'Stap naam', datafield: 'step_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1393 { text: 'Stap type', datafield: 'step_type', width: 175,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1394 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1395 return '<div style="margin: 4px;">' + MashStepTypeData[value].nl + '</div>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1396 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1397 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1398 { text: 'Start &deg;C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1399 { text: 'Eind &deg;C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1400 { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1401 { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' },
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1402 { text: 'Inf/dec L.', datafield: 'step_infuse_amount', width: 90, align: 'right',
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1403 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1404 if (rowdata.step_type == 1)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1405 return '<span></span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1406 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value, 'f1') + '</span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1407 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1408 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1409 { text: 'Inf/dec &deg;C', datafield: 'step_infuse_temp', width: 90, align: 'right',
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1410 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1411 if (rowdata.step_type == 1)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1412 return '<span></span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1413 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value, 'f2') + '</span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1414 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1415 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1416 { text: 'L/Kg.', datafield: 'step_wg_ratio', width: 90, align: 'right',
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1417 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1418 var color = '#ffffff';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1419 if (value < 2.0 || value > 6.0)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1420 color = '#ff4040';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1421 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + dataAdapter.formatNumber(value, 'f2') + '</span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1422 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1423 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1424 { text: '', columntype: 'button', width: 15, align: 'center',
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1425 cellsrenderer: function(row) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1426 if (row < 2)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1427 return ' ';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1428 return '▴';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1429 }, buttonclick: function(row) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1430 if (row >= 2) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1431 swapMash(row, row-1);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1432 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1433 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1434 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1435 { text: '', columntype: 'button', width: 15, align: 'center',
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1436 cellsrenderer: function(row) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1437 rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1438 if (row < 1 || row > (rowscount -2))
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1439 return ' ';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1440 return '▾';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1441 }, buttonclick: function(row) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1442 rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1443 if (row >= 1 && row <= (rowscount -2)) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1444 swapMash(row, row+1);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1445 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1446 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1447 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1448 { text: '', datafield: 'Edit', columntype: 'button', width: 80, align: 'center',
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1449 cellsrenderer: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1450 return 'Wijzig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1451 }, buttonclick: function(row) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1452 mashRow = row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1453 mashData = $('#mashGrid').jqxGrid('getrowdata', mashRow);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1454 if (mashRow == 0)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1455 $("#wstep_type").jqxDropDownList('disableAt', 2);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1456 else
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1457 $("#wstep_type").jqxDropDownList('enableAt', 2);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1458 $('#wstep_name').val(mashData.step_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1459 $('#wstep_type').val(mashData.step_type);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1460 $('#wstep_infuse_amount').val(mashData.step_infuse_amount);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1461 $('#wstep_infuse_temp').val(mashData.step_infuse_temp);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1462 $('#wstep_temp').val(mashData.step_temp);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1463 $('#wend_temp').val(mashData.end_temp);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1464 $('#wstep_time').val(mashData.step_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1465 $('#wramp_time').val(mashData.ramp_time);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1466 $('#wstep_infuse_amount').hide(); // Hide all untile we need it.
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1467 $('#wstep_infuse_temp').hide();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1468 $('#wstep_pmpt_amount').hide();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1469 $('#wstep_pmpt_temp').hide();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1470 if (mashData.step_type == 0) {
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1471 if (mashRow == 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1472 $('#wstep_infuse_amount').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1473 $('#wstep_pmpt_amount').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1474 } else {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1475 $('#wstep_infuse_temp').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1476 $('#wstep_pmpt_temp').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1477 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1478 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1479 // show the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1480 $('#popupMash').jqxWindow('open');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1481 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1482 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1483 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1484 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1485 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1486
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1487
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1488
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1489
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1490 /*
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1491 * Remove the top menu so that we MUST use the buttons to leave the editor.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1492 */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1493 $('#jqxMenu').jqxMenu('destroy');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1494
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1495 console.log('record:' + my_record + ' return:' + my_return + ' theme:' + theme);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1496 $('#jqxLoader').jqxLoader({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1497 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1498 height: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1499 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1500 text: 'Laden recept ...',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1501 theme: theme
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1502 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1503
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1504 function setWaterAgent(name, amount) {
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
1505
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1506 var record, records, miscs, i, id, row, found = false, rows = $('#miscGrid').jqxGrid('getrows');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1507 if (amount == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1508 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1509 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1510 if (row.m_name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1511 id = $('#miscGrid').jqxGrid('getrowid', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1512 $('#miscGrid').jqxGrid('deleterow', id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1513 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1514 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1515 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1516 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1517 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1518 if (row.m_name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1519 found = true;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1520 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount / 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1521 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1522 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1523 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1524 if (! found) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1525 miscs = new $.jqx.dataAdapter(miscInvSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1526 loadComplete: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1527 records = miscs.records;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1528 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1529 record = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1530 if (record.name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1531 row = {};
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1532 row['m_name'] = record.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1533 row['m_amount'] = amount / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1534 row['m_cost'] = record.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1535 row['m_type'] = record.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1536 row['m_use_use'] = record.use_use;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1537 row['m_time'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1538 row['m_amount_is_weight'] = record.amount_is_weight;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1539 row['m_inventory'] = record.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1540 row['m_avail'] = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1541 $('#miscGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1542 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1543 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1544 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1545 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1546 miscs.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1547 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1548 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1549 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1550 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1551
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1552
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1553 // Procedure TFrmWaterAdjustment.CalcWater2;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1554 function calcWater() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1555
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1556 if (! data_loaded) {
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1557 console.log('calcWater(): failsave');
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1558 return;
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1559 }
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1560
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1561 var liters = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1562 calcium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1563 magnesium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1564 sodium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1565 total_alkalinity = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1566 bicarbonate = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1567 chloride = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1568 sulfate = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1569 ph = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1570 RA = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1571 frac = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1572 TpH = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1573 protonDeficit = 0,
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1574 AT, BT,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1575 r1d, r2d, f1d, f2d, f3d,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1576 deltapH, deltapd, pd, n,
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1577 Res;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1578
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1579 if (dataRecord.w1_name == '') {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1580 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1581 }
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1582
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1583 // If there is a dillute water source, mix the waters.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1584 if (dataRecord.w2_name != '') {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1585 liters = dataRecord.w1_amount + dataRecord.w2_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1586 calcium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_calcium, dataRecord.w2_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1587 magnesium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_magnesium, dataRecord.w2_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1588 sodium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sodium, dataRecord.w2_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1589 chloride = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_chloride, dataRecord.w2_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1590 sulfate = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sulfate, dataRecord.w2_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1591 total_alkalinity = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_total_alkalinity, dataRecord.w2_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1592 ph = -Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1593 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1594 liters = dataRecord.w1_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1595 calcium = dataRecord.w1_calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1596 magnesium = dataRecord.w1_magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1597 sodium = dataRecord.w1_sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1598 chloride = dataRecord.w1_chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1599 sulfate = dataRecord.w1_sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1600 total_alkalinity = dataRecord.w1_total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1601 ph = dataRecord.w1_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1602 }
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1603 var bicarbonate = total_alkalinity * 1.22;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1604
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1605 /* Save mixed water ions for later */
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1606 var wg_calcium = calcium;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1607 var wg_sodium = sodium;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1608 var wg_total_alkalinity = total_alkalinity;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1609 var wg_chloride = chloride;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1610 var wg_sulfate = sulfate;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1611 var wg_bicarbonate = bicarbonate;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1612
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1613 $('#wg_amount').val(liters);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1614 $('#wg_calcium').val(Round(calcium, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1615 $('#wg_magnesium').val(Round(magnesium, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1616 $('#wg_sodium').val(Round(sodium, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1617 $('#wg_bicarbonate').val(Round(bicarbonate, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1618 $('#wg_total_alkalinity').val(Round(total_alkalinity, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1619 $('#wg_chloride').val(Round(chloride, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1620 $('#wg_sulfate').val(Round(sulfate, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1621 $('#wg_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1622
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1623 var mash_ph = Round(MashpH(), 3);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1624 console.log('Distilled water mash pH: ' + mash_ph);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1625
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1626 /* Calculate Salt additions */
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1627 if (liters > 0) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1628 calcium += (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 1000 +
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1629 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 1000 +
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1630 parseFloat($('#wa_caco3').jqxNumberInput('decimal')) * MMCa / MMCaCO3 * 1000) / liters;
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1631 magnesium += (parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMMg / MMMgSO4 * 1000 +
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1632 parseFloat($('#wa_mgcl2').jqxNumberInput('decimal')) * MMMg / MMMgCl2 * 1000) / liters;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1633 sodium += (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000 +
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1634 parseFloat($('#wa_nahco3').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 1000) / liters;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1635 sulfate += (parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 * 1000 +
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1636 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 * 1000) / liters;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1637 chloride += (2 * parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 * 1000 +
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1638 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl * 1000 +
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1639 parseFloat($('#wa_mgcl2').jqxNumberInput('decimal')) * MMCl / MMMgCl2 * 1000) / liters;
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1640 bicarbonate += (parseFloat($('#wa_nahco3').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 1000 +
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1641 parseFloat($('#wa_caco3').jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3 * 1000) / liters;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1642 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1643
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1644 if (dataRecord.wa_acid_name < 0 || dataRecord,wa_acid_name >= AcidTypeData.length) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1645 $('#wa_acid_name').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1646 dataRecord.wa_acid_name = 0;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1647 dataRecord.wa_acid_perc = AcidTypeData[0].AcidPrc;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1648 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1649 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1650 if (last_acid == '')
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1651 last_acid = AcidTypeData[dataRecord.wa_acid_name].nl;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1652
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1653 if (parseFloat(dataRecord.wa_acid_perc) == 0) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1654 dataRecord.wa_acid_perc = AcidTypeData[AT].AcidPrc;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1655 $('#wa_acid_perc').val(AcidTypeData[AT].AcidPrc);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1656 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1657
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1658 AT = dataRecord.wa_acid_name;
150
159d7a89fcef Better stage detection during product import from brouwhulp. Added tooltips for treated water.
Michiel Broek <mbroek@mbse.eu>
parents: 149
diff changeset
1659
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1660 /* Note that the next calculations do not correct the pH change by the added salts.
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1661 This pH change is at most 0.1 pH and is a minor difference in Acid amount. */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1662
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1663 if (dataRecord.calc_acid) {
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1664 $('.c_mashph').show();
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1665 /* Auto calculate pH */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1666 TpH = parseFloat(dataRecord.mash_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1667 protonDeficit = ProtonDeficit(TpH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1668 console.log('calc_acid tgt: ' + TpH + ' protonDeficit: ' + protonDeficit);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1669 if (protonDeficit > 0) { // Add acid
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1670 frac = CalcFrac(TpH, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1671 Acid = protonDeficit / frac;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1672 Acid *= AcidTypeData[AT].MolWt; // mg
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1673 Acidmg = Acid;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1674 Acid = Acid / AcidTypeData[AT].AcidSG; // ml
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1675 Acid = Round(Acid / (parseFloat(dataRecord.wa_acid_perc) / 100), 2); // ml
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1676 console.log('Mash auto Acid final ml: ' + Acid);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1677 $('#wa_acid').val(Acid);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1678 setWaterAgent(AcidTypeData[AT].nl, Acid);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1679
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1680 bicarbonate = bicarbonate - protonDeficit * frac / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1681 total_alkalinity = bicarbonate * 50 / 61;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1682 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1683 ph = TpH;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1684 $('#wb_ph').val(Round(ph, 2));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1685 $('#est_mash_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1686 } else { // Manual
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1687 /* Manual calculate pH */
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1688 $('.c_mashph').hide();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1689 console.log('calc_acid no');
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1690 pHa = Round(ph, 3); // Adjusted water pH
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1691 // Then calculate the new pH with added acids and malts
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1692 console.log('Mash pH: ' + pHa);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1693 Acid = AcidTypeData[AT].AcidSG * (parseFloat(dataRecord.wa_acid_perc) / 100); // ml
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1694 Acid *= parseFloat($('#wa_acid').jqxNumberInput('decimal'));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1695 Acid /= AcidTypeData[AT].MolWt; // mg
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1696 Acidmg = Acid;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1697
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1698 //find the pH where the protondeficit = protondeficit by the acid
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1699 frac = CalcFrac(pHa, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1700 protonDeficit = Round(Acid * frac, 3);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1701 //console.log('protonDeficit Acid: ' + protonDeficit + ' frac: ' + frac + ' pH: ' + pHa);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1702
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1703 deltapH = 0.001;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1704 deltapd = 0.1;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1705 pd = Round(ProtonDeficit(pHa), 6);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1706 n = 0;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1707 while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 4000)) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1708 n++;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1709 if (pd < (protonDeficit - deltapd))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1710 pHa -= deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1711 else if (pd > (protonDeficit + deltapd))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1712 pHa += deltapH;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1713 frac = CalcFrac(pHa, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1714 protonDeficit = Acid * frac;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1715 pd = ProtonDeficit(pHa);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1716 }
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1717 //console.log('n: ' + n + ' pd: ' + pd + ' protonDeficit: ' + protonDeficit + ' frac: ' + frac + ' pHa: ' + pHa);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1718 RA = wg_bicarbonate - protonDeficit * frac / liters;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1719 bicarbonate = RA;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1720 total_alkalinity = RA * 50 / 61;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1721 ph = pHa;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1722 $('#wb_ph').val(Round(ph, 2));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1723 $('#est_mash_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1724 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1725
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1726 if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1727 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1728 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1729 Acidmg / 1000 * MMSO4 / (MMSO4 + 2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1730 RA = 1000 * RA / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1731 sulfate = wg_sulfate + RA; // Not add to sulfate??
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1732 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1733 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1734 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1735 Acidmg / 1000 * MMCl / (MMCl + 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1736 RA = 1000 * RA / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1737 chloride = wg_chloride + RA;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1738 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1739
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1740 var BUGU = GetBUGU();
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1741 $('#tgt_bu').val(Round(BUGU, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1742 // From brouwhulp.
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1743 if (BUGU < 0.32)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1744 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig en zoet</span>");
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1745 else if (BUGU < 0.43)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1746 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig, zoet</span>");
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1747 else if (BUGU < 0.52)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1748 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>");
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1749 else if (BUGU < 0.63)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1750 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht hoppig, bitter</span>");
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1751 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1752 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Extra hoppig, zeer bitter</span>");
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1753
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1754 // Sulfate to Chloride ratio (Palmer).
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1755 var OptSO4Clratio = GetOptSO4Clratio();
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1756 $('#tgt_so4_cl').val(Round(OptSO4Clratio, 1));
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1757 if (OptSO4Clratio < 0.4)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1758 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Te moutig</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1759 else if (OptSO4Clratio < 0.6)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1760 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1761 else if (OptSO4Clratio < 0.8)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1762 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1763 else if (OptSO4Clratio < 1.5)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1764 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Gebalanceerd</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1765 else if (OptSO4Clratio < 2.0)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1766 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht bitter</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1767 else if (OptSO4Clratio < 4.0)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1768 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Bitter</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1769 else if (OptSO4Clratio < 9.0)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1770 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer bitter</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1771 else
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1772 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Te bitter</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1773 if (chloride > 0)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1774 RA = sulfate / chloride;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1775 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1776 RA = 10;
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1777 $('#got_so4_cl').val(Round(RA, 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1778 Res = 'normaal';
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1779 if (RA < (0.8 * OptSO4Clratio))
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1780 Res = 'laag';
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1781 else if (RA > (1.2 * OptSO4Clratio))
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1782 Res = 'hoog';
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1783 setRangeIndicator('so4_cl', Res);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1784
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1785 $('#wb_calcium').val(Round(calcium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1786 $('#wb_magnesium').val(Round(magnesium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1787 $('#wb_sodium').val(Round(sodium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1788 $('#wb_sulfate').val(Round(sulfate, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1789 $('#wb_chloride').val(Round(chloride, 1));
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1790 $('#wb_bicarbonate').val(Round(bicarbonate, 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1791 $('#wb_total_alkalinity').val(Round(total_alkalinity, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1792
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1793 if (calcium < 40) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1794 setRangeIndicator('calcium', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1795 } else if (calcium > 150) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1796 setRangeIndicator('calcium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1797 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1798 setRangeIndicator('calcium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1799 }
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1800 if (magnesium < 5) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1801 setRangeIndicator('magnesium', 'laag');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1802 } else if (magnesium > 40) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1803 setRangeIndicator('magnesium', 'hoog');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1804 } else {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1805 setRangeIndicator('magnesium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1806 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1807 if (sodium <= 150) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1808 setRangeIndicator('sodium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1809 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1810 setRangeIndicator('sodium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1811 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1812 // Both chloride and sulfate should be above 50 according to
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1813 // John Palmer. So the Cl/SO4 ratio calculation will work.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1814 if (chloride <= 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1815 setRangeIndicator('chloride', 'laag');
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1816 } else if (chloride <= 150) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1817 setRangeIndicator('chloride', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1818 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1819 setRangeIndicator('chloride', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1820 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1821 if (sulfate <= 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1822 setRangeIndicator('sulfate', 'laag');
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1823 } else if (sulfate <= 400) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1824 setRangeIndicator('sulfate', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1825 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1826 setRangeIndicator('sulfate', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1827 }
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1828 // (cloride + sulfate) > 500 is too high
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1829 if ((chloride + sulfate) > 500) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1830 setRangeIndicator('chloride', 'hoog');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1831 setRangeIndicator('sulfate', 'hoog');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1832 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1833 if (ph < 5.2) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1834 setRangeIndicator('ph', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1835 } else if (ph > 5.6) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1836 setRangeIndicator('ph', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1837 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1838 setRangeIndicator('ph', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1839 }
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1840 if (bicarbonate > 250) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1841 setRangeIndicator('bicarbonate', 'hoog');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1842 } else {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1843 setRangeIndicator('bicarbonate', 'normaal');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1844 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1845 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1846 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1847
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
1848
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1849 function calcSparge() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1850
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1851 /* Based on the work of ajDeLange. */
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1852 var TargetpH = dataRecord.sparge_ph;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1853 var Source_pH = dataRecord.w1_ph;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1854 var Source_alkalinity = dataRecord.w1_total_alkalinity;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1855 // Select watersource or fallback to the first source.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1856 if (dataRecord.sparge_source == 1) { // Source 2
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1857 if (dataRecord.w2_ph > 0.0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1858 Source_pH = dataRecord.w2_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1859 Source_alkalinity = dataRecord.w2_total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1860 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1861 dataRecord.sparge_source = 0; // Source 1
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1862 $('#sparge_source').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1863 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1864 } else if (dataRecord.sparge_source == 2) { // Mixed
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1865 if (dataRecord.w2_ph > 0.0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1866 Source_pH = parseFloat($('#wg_ph').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1867 Source_alkalinity = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1868 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1869 dataRecord.sparge_source = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1870 $('#sparge_source').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1871 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1872 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1873
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1874 // Step 1: Compute the mole fractions of carbonic (f1o), bicarbonate (f2o) and carbonate(f3o) at the water pH
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1875 var r1 = Math.pow(10, Source_pH - 6.35);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1876 var r2 = Math.pow(10, Source_pH - 10.33);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1877 var d = 1 + r1 + r1 * r2;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1878 var f1 = 1 / d;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1879 var f3 = r1 * r2 / d;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1880
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1881 //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity)
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1882 var r143 = Math.pow(10, 4.3 - 6.35);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1883 var r243 = Math.pow(10, 4.3 - 10.33);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1884 var d43 = 1 + r143 + r143 * r243;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1885 var f143 = 1 / d43;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1886 var f343 = r143 * r243 / d43;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1887
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1888 //Step 4. Solve
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1889 //var Ct = (alkalinity - 1000 * (Math.pow(10, -4.3) - Math.pow(10, -Source_pH))) / ((f143 - f1) + (f3 - f343));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1890 var Ct = Source_alkalinity / 50 / ((f143 - f1) + (f3 - f343));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1891
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1892 //Step 5. Compute mole fractions at desired pH
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1893 var r1g = Math.pow(10, TargetpH - 6.35);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1894 var r2g = Math.pow(10, TargetpH - 10.33);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1895 var dg = 1 + r1g + r1g * r2g;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1896 var f1g = 1 / dg;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1897 var f3g = r1g * r2g / dg;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1898
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1899 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L)
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1900 var Acid = Ct * ((f1g - f1) + (f3 - f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1901 Acid += 0.01; // Add acid that would be required for distilled water.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1902
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1903 //Step 8. Get the acid data.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1904 AT = dataRecord.sparge_acid_type;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1905 if (AT < 0 || AT >= AcidTypeData.length) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1906 AT = 0;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1907 dataRecord.sparge_acid_type = 0;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1908 $('#sparge_acid_type').val(0);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1909 dataRecord.sparge_acid_perc = AcidTypeData[0].AcidPrc;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1910 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1911 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1912 var fract = CalcFrac(TargetpH, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1913
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1914 //Step 9. Now divide the mEq required by the "fraction". This is the required number of moles of acid.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1915 Acid /= fract;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1916
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1917 //Step 10. Multiply by molecular weight of the acid
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1918 Acid *= AcidTypeData[AT].MolWt; //mg
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1919
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1920 //Step 11. Divide by Specific Gravity and Percentage to get the final ml.
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1921 Acid = Acid / AcidTypeData[AT].AcidSG / (dataRecord.sparge_acid_perc / 100); //ml
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1922 Acid *= dataRecord.sparge_volume; //ml acid total
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1923 Acid = Round(Acid, 2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1924 dataRecord.sparge_acid_amount = Acid / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1925 $('#sparge_acid_amount').val(Acid);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1926 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1927
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1928 function calcInit() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1929 console.log('calc.init()');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1930
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1931 $('#calc_acid').on('checked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1932 dataRecord.calc_acid = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1933 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1934 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1935 $('#calc_acid').on('unchecked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1936 dataRecord.calc_acid = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1937 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1938 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1939 $('#w1_name').jqxDropDownList('selectItem', dataRecord.w1_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1940 $('#w2_name').jqxDropDownList('selectItem', dataRecord.w2_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1941 // Fix tap water if zero using mash infuse amount.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1942 if (parseFloat($('#w1_amount').jqxNumberInput('decimal')) == 0 && mash_infuse > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1943 $('#w1_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1944 dataRecord.w1_amount = mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1945 $('#wg_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1946 $('#w2_amount').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1947 dataRecord.w2_amount = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1948 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1949 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1950 $('#w2_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1951 var newval = parseFloat(event.args.value);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1952
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1953 if (newval > mash_infuse) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1954 $('#w2_amount').val(dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1955 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1956 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1957 dataRecord.w1_amount = parseFloat($('#wg_amount').jqxNumberInput('decimal')) - newval;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1958 $('#w1_amount').val(dataRecord.w1_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1959 dataRecord.w2_amount = newval;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1960 console.log('new: ' + event.args.value + ' w1: ' + dataRecord.w1_amount + ' w2: ' + dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1961 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1962 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1963 $('#wa_cacl2').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1964 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1965 setWaterAgent('CaCl2', 0); // This can prevent double entries.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1966 setWaterAgent('CaCl2', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1967 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1968 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1969 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1970 $('#wa_caso4').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1971 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1972 setWaterAgent('CaSO4', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1973 setWaterAgent('CaSO4', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1974 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1975 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1976 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1977 $('#wa_mgso4').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1978 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1979 setWaterAgent('MgSO4', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1980 setWaterAgent('MgSO4', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1981 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1982 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1983 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1984 $('#wa_nacl').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1985 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1986 setWaterAgent('NaCl', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1987 setWaterAgent('NaCl', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1988 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1989 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1990 });
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1991 $('#wa_mgcl2').on('change', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1992 if (event.args) {
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1993 setWaterAgent('MgCl2', 0);
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1994 setWaterAgent('MgCl2', event.args.value);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1995 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1996 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1997 });
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1998 $('#wa_nahco3').on('change', function(event) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1999 if (event.args) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2000 setWaterAgent('NaHCO3', 0);
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2001 setWaterAgent('NaHCO3', event.args.value);
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2002 calcWater();
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2003 }
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2004 });
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2005 $('#wa_caco3').on('change', function(event) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2006 if (event.args) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2007 setWaterAgent('CaCO3', 0);
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2008 setWaterAgent('CaCO3', event.args.value);
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2009 calcWater();
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2010 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2011 });
642
9d1af81b20ef Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 561
diff changeset
2012 $('#wa_acid_name').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2013 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2014 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2015 setWaterAgent(last_acid, 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2016 last_acid = AcidTypeData[index].nl;
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2017 dataRecord.wa_acid_name = index;
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2018 dataRecord.wa_acid_perc = AcidTypeData[index].AcidPrc;
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2019 $('#wa_acid_perc').val(dataRecord.wa_acid_perc);
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2020 calcWater();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2021 setWaterAgent(last_acid, parseFloat($('#wa_acid').jqxNumberInput('decimal')));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2022 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2023 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2024 $('#wa_acid').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2025 var name = AcidTypeData[$('#wa_acid_name').val()].nl;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2026 setWaterAgent(name, parseFloat(event.args.value));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2027 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2028 });
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2029 $('#wa_acid_perc').on('change', function(event) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2030 dataRecord.wa_acid_perc = parseFloat(event.args.value);
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2031 calcWater();
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2032 });
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
2033
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2034 $('#mash_ph').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2035 dataRecord.mash_ph = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2036 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2037 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2038
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2039 $('#sparge_ph').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2040 dataRecord.sparge_ph = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2041 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2042 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2043 $('#sparge_volume').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2044 dataRecord.sparge_volume = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2045 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2046 });
642
9d1af81b20ef Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 561
diff changeset
2047 $('#sparge_source').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2048 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2049 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2050 dataRecord.sparge_source = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2051 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2052 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2053 });
642
9d1af81b20ef Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 561
diff changeset
2054 $('#sparge_acid_type').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2055 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2056 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2057 dataRecord.sparge_acid_type = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2058 console.log('new sparge_acid_type: ' + dataRecord.sparge_acid_type);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2059 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2060 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2061 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2062 $('#sparge_acid_perc').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2063 dataRecord.sparge_acid_perc = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2064 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2065 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2066 $('#locked').on('checked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2067 dataRecord.locked = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2068 setReadonly(true);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2069 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2070 $('#locked').on('unchecked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2071 dataRecord.locked = 0;
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2072 setReadonly(true);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2073 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2074 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2075
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2076 function saveRecord(goback) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2077 var row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2078 record: my_record,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2079 uuid: dataRecord.uuid,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2080 name: $('#name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2081 locked: dataRecord.locked,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2082 notes: $('#notes').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2083 st_name: $('#st_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2084 st_letter: $('#st_letter').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2085 st_guide: $('#st_guide').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2086 st_type: dataRecord.st_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2087 st_category: $('#st_category').val(),
710
9646123ea063 Fixed st_category_namber to be an integer value instead of float. The calc_acid in a new recipe is integer. Added missing wg_ and wb_ fields in a new recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 667
diff changeset
2088 st_category_number: $('#st_category_number').val(),
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2089 st_og_min: parseFloat($('#st_og_min').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2090 st_og_max: parseFloat($('#st_og_max').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2091 st_fg_min: parseFloat($('#st_fg_min').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2092 st_fg_max: parseFloat($('#st_fg_max').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2093 st_ibu_min: parseFloat($('#st_ibu_min').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2094 st_ibu_max: parseFloat($('#st_ibu_max').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2095 st_color_min: parseFloat($('#st_color_min').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2096 st_color_max: parseFloat($('#st_color_max').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2097 st_carb_min: parseFloat($('#st_carb_min').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2098 st_carb_max: parseFloat($('#st_carb_max').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2099 st_abv_min: parseFloat($('#st_abv_min').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2100 st_abv_max: parseFloat($('#st_abv_max').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2101 type: $('#type').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2102 batch_size: parseFloat($('#batch_size').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2103 boil_size: parseFloat($('#boil_size').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2104 boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2105 efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2106 est_og: parseFloat($('#est_og').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2107 est_fg: parseFloat($('#est_fg').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2108 est_abv: parseFloat($('#est_abv').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2109 est_color: parseFloat($('#est_color').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2110 color_method: $('#color_method').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2111 est_ibu: parseFloat($('#est_ibu').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2112 ibu_method: $('#ibu_method').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2113 est_carb: parseFloat($('#est_carb').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2114 mash_name: $('#mash_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2115 mash_ph: parseFloat($('#mash_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2116 sparge_temp: parseFloat($('#sparge_temp').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2117 sparge_ph: parseFloat($('#sparge_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2118 sparge_volume: parseFloat($('#sparge_volume').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2119 sparge_source: $('#sparge_source').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2120 sparge_acid_type: $('#sparge_acid_type').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2121 sparge_acid_perc: parseFloat($('#sparge_acid_perc').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2122 sparge_acid_amount: dataRecord.sparge_acid_amount,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2123 calc_acid: dataRecord.calc_acid,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2124 w1_name: $('#w1_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2125 w1_amount: parseFloat($('#w1_amount').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2126 w1_calcium: parseFloat($('#w1_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2127 w1_sulfate: parseFloat($('#w1_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2128 w1_chloride: parseFloat($('#w1_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2129 w1_sodium: parseFloat($('#w1_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2130 w1_magnesium: parseFloat($('#w1_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2131 w1_total_alkalinity: parseFloat($('#w1_total_alkalinity').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2132 w1_ph: parseFloat($('#w1_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2133 w1_cost: dataRecord.w1_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2134 w2_name: $('#w2_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2135 w2_amount: parseFloat($('#w2_amount').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2136 w2_calcium: parseFloat($('#w2_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2137 w2_sulfate: parseFloat($('#w2_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2138 w2_chloride: parseFloat($('#w2_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2139 w2_sodium: parseFloat($('#w2_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2140 w2_magnesium: parseFloat($('#w2_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2141 w2_total_alkalinity: parseFloat($('#w2_total_alkalinity').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2142 w2_ph: parseFloat($('#w2_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2143 w2_cost: dataRecord.w2_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2144 wg_amount: parseFloat($('#wg_amount').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2145 wg_calcium: parseFloat($('#wg_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2146 wg_sulfate: parseFloat($('#wg_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2147 wg_chloride: parseFloat($('#wg_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2148 wg_sodium: parseFloat($('#wg_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2149 wg_magnesium: parseFloat($('#wg_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2150 wg_total_alkalinity: parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2151 wg_ph: parseFloat($('#wg_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2152 wb_calcium: parseFloat($('#wb_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2153 wb_sulfate: parseFloat($('#wb_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2154 wb_chloride: parseFloat($('#wb_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2155 wb_sodium: parseFloat($('#wb_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2156 wb_magnesium: parseFloat($('#wb_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2157 wb_total_alkalinity: parseFloat($('#wb_total_alkalinity').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2158 wb_ph: parseFloat($('#wb_ph').jqxNumberInput('decimal')),
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2159 wa_acid_name: parseInt($('#wa_acid_name').val()),
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2160 wa_acid_perc: parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')),
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2161 wa_base_name: 0,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2162 fermentables: $('#fermentableGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2163 hops: $('#hopGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2164 miscs: $('#miscGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2165 yeasts: $('#yeastGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2166 mashs: $('#mashGrid').jqxGrid('getrows')
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2167 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2168 data = 'update=true&' + $.param(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2169 $.ajax({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2170 dataType: 'json',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2171 url: url,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2172 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2173 async: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2174 data: data,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2175 type: 'POST',
777
daf55c944fb0 Recipes backport for new dry-yeast fields and SQL error handlers.
Michiel Broek <mbroek@mbse.eu>
parents: 775
diff changeset
2176 success: function(data) {
daf55c944fb0 Recipes backport for new dry-yeast fields and SQL error handlers.
Michiel Broek <mbroek@mbse.eu>
parents: 775
diff changeset
2177 if (data.error) {
daf55c944fb0 Recipes backport for new dry-yeast fields and SQL error handlers.
Michiel Broek <mbroek@mbse.eu>
parents: 775
diff changeset
2178 console.log('saveRecord(' + goback + ') error ' + data.msg);
daf55c944fb0 Recipes backport for new dry-yeast fields and SQL error handlers.
Michiel Broek <mbroek@mbse.eu>
parents: 775
diff changeset
2179 alert('SQL fout: ' + data.msg);
daf55c944fb0 Recipes backport for new dry-yeast fields and SQL error handlers.
Michiel Broek <mbroek@mbse.eu>
parents: 775
diff changeset
2180 } else {
daf55c944fb0 Recipes backport for new dry-yeast fields and SQL error handlers.
Michiel Broek <mbroek@mbse.eu>
parents: 775
diff changeset
2181 console.log('saveRecord(' + goback + ') success');
daf55c944fb0 Recipes backport for new dry-yeast fields and SQL error handlers.
Michiel Broek <mbroek@mbse.eu>
parents: 775
diff changeset
2182 }
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2183 // if (goback)
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2184 window.location.href = my_return;
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2185 // else
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2186 // window.location.href = 'rec_export.php?record=' + my_record + '&return=' + my_return + '&name=' + dataRecord.name;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2187 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2188 error: function(jqXHR, textStatus, errorThrown) {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2189 console.log('saveRecord() ' + textStatus);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2190 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2191 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2192 };
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2193
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2194 dataAdapter.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2195
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2196 // initialize the input fields.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2197 // Tab 1, Algemeen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2198 $('#name').jqxTooltip({ content: 'De naam voor dit recept.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2199 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2200 $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2201 $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2202 $('#notes').jqxInput({ theme: theme, width: 960, height: 200 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2203 $('#type').jqxTooltip({ content: 'Het brouw type van dit recept.' });
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2204 $('#type').jqxInput({ theme: theme, width: 180, height: 23 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2205 $('#efficiency').jqxTooltip({ content: 'Het rendement van maischen en koken.' });
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2206 $('#efficiency').jqxNumberInput(Show1dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2207 $('#batch_size').jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' });
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2208 $('#batch_size').jqxNumberInput(Show1dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2209 $('#batch_size').jqxNumberInput({ min: 4 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2210 $('#boil_size').jqxTooltip({ content: 'Het volume van het wort voor het koken.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2211 $('#boil_size').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2212 $('#boil_time').jqxTooltip({ content: 'De kooktijd in minuten.' });
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2213 $('#boil_time').jqxNumberInput(Show0dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2214 $('#boil_time').jqxNumberInput({ min: 4, max: 360 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2215
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2216 $('#st_name').jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2217 $('#st_name').jqxInput({ theme: theme, width: 250, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2218 $('#st_letter').jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2219 $('#st_letter').jqxInput({ theme: theme, width: 90, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2220 $('#st_guide').jqxTooltip({ content: 'De bierstijl gids voor dit recept.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2221 $('#st_guide').jqxInput({ theme: theme, width: 250, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2222 $('#st_category').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2223 $('#st_category').jqxInput({ theme: theme, width: 250, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2224 $('#st_category_number').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2225 $('#st_category_number').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2226 $('#st_type').jqxTooltip({ content: 'Het bierstijl type.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2227 $('#st_type').jqxInput({ theme: theme, width: 250, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2228
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2229 $('#est_og').jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2230 $('#est_og').jqxNumberInput(Show3dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2231 $('#st_og_min').jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2232 $('#st_og_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2233 $('#st_og_max').jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2234 $('#st_og_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2235
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2236 $('#est_fg').jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2237 $('#est_fg').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2238 $('#st_fg_min').jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2239 $('#st_fg_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2240 $('#st_fg_max').jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2241 $('#st_fg_max').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
2242
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2243 $('#est_abv').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2244 $('#est_abv').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2245 $('#st_abv_min').jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2246 $('#st_abv_min').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2247 $('#st_abv_max').jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2248 $('#st_abv_max').jqxNumberInput(Smal1dec);
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
2249
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2250 $('#est_color').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2251 $('#est_color').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2252 $('#st_color_min').jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2253 $('#st_color_min').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2254 $('#st_color_max').jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2255 $('#st_color_max').jqxNumberInput(Smal0dec);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2256 $('#color_method').jqxInput({ theme: theme, width: 180, height: 23 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2257 $('#est_ibu').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2258 $('#est_ibu').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2259 $('#st_ibu_min').jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2260 $('#st_ibu_min').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2261 $('#st_ibu_max').jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2262 $('#st_ibu_max').jqxNumberInput(Smal0dec);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2263
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2264 $('#ibu_method').jqxInput({ theme: theme, width: 180, height: 23 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2265 $('#kcal').jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2266 $('#kcal').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2267 $('#est_carb').jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2268 $('#est_carb').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2269 $('#st_carb_min').jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2270 $('#st_carb_min').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2271 $('#st_carb_max').jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2272 $('#st_carb_max').jqxNumberInput(Smal1dec);
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
2273
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2274 // Tab 2, Vergistbaar
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2275 $('#est_color2').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2276 $('#est_color2').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2277 $('#est_og2').jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2278 $('#est_og2').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2279 $('#perc_malts').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2280 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2281 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2282 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2283 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2284 max: 120,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2285 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2286 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2287 { stop: 90, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2288 { stop: 100, color: '#EB7331' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2289 { stop: 120, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2290 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2291 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2292 return (Math.round(parseInt(text) * 1.2)) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2293 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2294 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2295 $('#perc_sugars').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2296 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2297 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2298 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2299 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2300 max: 50,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2301 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2302 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2303 { stop: 20, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2304 { stop: 50, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2305 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2306 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2307 return (Math.round(parseInt(text) * 5) / 10) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2308 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2309 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2310 $('#perc_cara').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2311 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2312 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2313 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2314 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2315 max: 50,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2316 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2317 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2318 { stop: 25, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2319 { stop: 50, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2320 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2321 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2322 return (Math.round(parseInt(text) * 5) / 10) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2323 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2324 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2325 $('#ferm_lintner').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2326 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2327 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2328 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2329 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2330 max: 200,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2331 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2332 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2333 { stop: 30, color: '#FF0000' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2334 { stop: 40, color: '#EB7331' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2335 { stop: 200, color: '#008C00' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2336 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2337 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2338 return (parseInt(text) * 2) + ' lintner';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2339 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2340 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2341
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2342 // Tab 3, Hoppen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2343 $('#est_ibu2').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2344 $('#est_ibu2').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2345 $('#hop_flavour').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2346 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2347 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2348 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2349 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2350 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2351 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2352 { stop: 20, color: '#004D00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2353 { stop: 40, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2354 { stop: 60, color: '#00BF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2355 { stop: 80, color: '#00FF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2356 { stop: 100, color: '#80FF80' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2357 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2358 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2359 var val = parseInt(text);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2360 if (val < 20)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2361 return 'Weinig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2362 else if (val < 40)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2363 return 'Matig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2364 else if (val < 60)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2365 return 'Redelijk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2366 else if (val < 80)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2367 return 'Veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2368 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2369 return 'Zeer veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2370 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2371 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2372 $('#hop_aroma').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2373 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2374 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2375 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2376 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2377 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2378 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2379 { stop: 20, color: '#004D00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2380 { stop: 40, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2381 { stop: 60, color: '#00BF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2382 { stop: 80, color: '#00FF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2383 { stop: 100, color: '#80FF80' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2384 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2385 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2386 var val = parseInt(text);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2387 if (val < 20)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2388 return 'Weinig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2389 else if (val < 40)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2390 return 'Matig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2391 else if (val < 60)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2392 return 'Redelijk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2393 else if (val < 80)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2394 return 'Veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2395 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2396 return 'Zeer veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2397 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2398 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2399
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2400 // Tab 4, Diversen
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2401
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2402 // Tab 5, Gist
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2403 $('#est_fg2').jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2404 $('#est_fg2').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2405 $('#est_abv2').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2406 $('#est_abv2').jqxNumberInput(Smal1dec);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2407
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2408 // Tab 6, Maischen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2409 $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2410 $('#mash_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2411 placeHolder: 'Kies schema:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2412 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2413 source: mashlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2414 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2415 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2416 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2417 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2418 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2419 dropDownHorizontalAlignment: 'right'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2420 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2421 $('#mash_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2422 if (event.args) {
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2423 var infused = 0, data, datarecord, i, row, rows, rowIDs, index = event.args.index;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2424 // First delete all current steps
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2425 rowIDs = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2426 rows = $('#mashGrid').jqxGrid('getdisplayrows');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2427 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2428 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2429 rowIDs.push(row.uid);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2430 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2431 $('#mashGrid').jqxGrid('deleterow', rowIDs);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2432 // Then add the new steps
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2433 datarecord = mashlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2434 $('#mash_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2435 for (i = 0; i < datarecord.steps.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2436 data = datarecord.steps[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2437 row = {};
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2438 row['step_name'] = data.step_name;
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2439 row['step_type'] = parseInt(data.step_type);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2440 row['step_temp'] = parseFloat(data.step_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2441 row['end_temp'] = parseFloat(data.end_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2442 row['step_time'] = parseFloat(data.step_time);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2443 row['ramp_time'] = parseFloat(data.ramp_time);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2444 row['step_infuse_temp'] = 0.0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2445 row['step_infuse_amount'] = 0.0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2446 if (mash_infuse == 0 && dataRecord.wg_amount > 0)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2447 mash_infuse = dataRecord.wg_amount;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2448 if (data.step_type == 0) { // Infusion
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2449 if (i == 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2450 row['step_infuse_amount'] = parseFloat(mash_infuse);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2451 } else {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2452 row['step_infuse_temp'] = 99.0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2453 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2454 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2455 //console.log(i + ' type: ' + row['step_type'] + ' start infusion: ' + parseFloat(row['step_infuse_amount']) + ' mash_infuse: ' + mash_infuse);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2456 infused += parseFloat(row['step_infuse_amount']);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2457 row['step_volume'] = infused;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2458 if (mashkg > 0)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2459 row['step_wg_ratio'] = Round(parseFloat(mash_infuse / mashkg), 2);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2460 else
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2461 row['step_wg_ratio'] = 0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2462 $('#mashGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2463 }
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2464 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2465 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2466 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2467 $('#popupMash').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2468 width: 800,
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2469 height: 375,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2470 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2471 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2472 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2473 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2474 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2475 cancelButton: $('#MashReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2476 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2477 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2478 $('#MashReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2479 $('#MashReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2480 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2481 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2482 $('#wstep_name').jqxInput({ theme: theme, width: 320, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2483 $('#wstep_name').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2484 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2485 rowdata.step_name = $('#wstep_name').val();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2486 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2487 $('#wstep_type').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2488 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2489 source: MashStepTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2490 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2491 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2492 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2493 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2494 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2495 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2496 $('#wstep_type').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2497 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2498 var rowdata, rows, i, row, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2499 rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2500 if (rowdata.step_type != index) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2501 rowdata.step_type = index;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2502 $('#wstep_infuse_amount').hide();
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2503 $('#wstep_infuse_temp').hide();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2504 $('#wstep_pmpt_amount').hide();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2505 $('#wstep_pmpt_temp').hide();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2506 if (index == 0) { // Infusion
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2507 if (mashRow == 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2508 $('#wstep_infuse_amount').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2509 $('#wstep_pmpt_amount').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2510 } else {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2511 $('#wstep_infuse_temp').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2512 $('#wstep_pmpt_temp').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2513 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2514 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2515 if (index == 1) { // Temperature
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2516 if (mashRow > 0)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2517 rowdata.step_infuse_amount = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2518 rowdata.step_infuse_temp = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2519 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2520 if (index == 2) { // Decoction
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2521 var rowprev = $('#mashGrid').jqxGrid('getrowdata', mashRow-1);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2522 rowdata.step_infuse_temp = 99;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2523 rowdata.step_infuse_amount = decoctionVol(rowdata.step_volume, rowdata.step_temp, rowprev.end_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2524 console.log('decoction: ' + rowdata.step_infuse_amount + '/' + rowdata.step_infuse_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2525 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2526 $('#mashGrid').jqxGrid('updaterow', mashRow, rowdata);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2527 mash_infuse = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2528 rows = $('#mashGrid').jqxGrid('getrows');
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2529 for (i = 0; i < rows.length; i++) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2530 row = rows[i];
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2531 if (row.step_type == 0) // Infusion
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2532 mash_infuse += parseFloat(row.step_infuse_amount);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2533 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2534 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2535 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2536 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2537 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2538 $('#wstep_temp').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2539 $('#wstep_temp').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2540 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2541 if (rowdata.step_type == 2) { // Decoction
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2542 var rowprev = $('#mashGrid').jqxGrid('getrowdata', mashRow-1);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2543 var a = (eq_tun_weight * eq_tun_specific_heat + rowdata.step_volume * SpecificHeatWater) *
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2544 (parseFloat(event.args.value) - rowprev.end_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2545 var b = SpecificHeatWater * (99 - parseFloat(event.args.value));
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2546 if (b > 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2547 rowdata.step_temp = parseFloat(event.args.value);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2548 rowdata.step_infuse_amount = Round(a / b, 2);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2549 } else
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2550 rowdata.step_infuse_amount = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2551 console.log('change temp ' + rowdata.step_temp + ' decoction: ' + rowdata.step_infuse_amount + '/' + rowdata.step_infuse_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2552 } else {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2553 rowdata.step_temp = parseFloat(event.args.value);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2554 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2555 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2556 $('#wend_temp').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2557 $('#wend_temp').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2558 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2559 rowdata.end_temp = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2560 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2561 $('#wstep_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2562 $('#wstep_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2563 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2564 rowdata.step_time = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2565 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2566 $('#wramp_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2567 $('#wramp_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2568 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2569 rowdata.ramp_time = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2570 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2571 $('#wstep_infuse_amount').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2572 $('#wstep_infuse_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2573 var i, rows, row, rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2574 rowdata.step_infuse_amount = parseFloat(event.args.value);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2575 if (mashRow == 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2576 rowdata.step_infuse_amount = parseFloat(event.args.value);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2577 mash_infuse = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2578 rows = $('#mashGrid').jqxGrid('getrows');
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2579 for (i = 0; i < rows.length; i++) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2580 row = rows[i];
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2581 if (row.step_type == 0) // Infusion
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2582 mash_infuse += parseFloat(row.step_infuse_amount);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2583 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2584 if (dataRecord.w2_amount == 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2585 dataRecord.w1_amount = mash_infuse;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2586 $('#w1_amount').val(mash_infuse);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2587 } else {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2588 var w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2589 var w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2590 dataRecord.w1_amount = Round(w1_amount, 3);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2591 dataRecord.w2_amount = Round(w2_amount, 3);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2592 $('#w1_amount').val(dataRecord.w1_amount);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2593 $('#w2_amount').val(dataRecord.w2_amount);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2594 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2595 $('#wg_amount').val(mash_infuse);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2596 console.log('new infuse amount: ' + mash_infuse);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2597 calcWater();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2598 }
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2599 });
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2600 $('#wstep_infuse_temp').jqxNumberInput(Spin1dec);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2601 $('#wstep_infuse_temp').on('change', function(event) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2602 var prevdata = $('#mashGrid').jqxGrid('getrowdata', mashRow-1);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2603 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2604 rowdata.step_infuse_temp = parseFloat(event.args.value);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2605 var vol = infusionVol(prevdata.step_volume, mashkg, rowdata.step_infuse_temp, rowdata.step_temp, prevdata.end_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2606 console.log('new vol: ' + vol);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2607 rowdata.step_infuse_amount = vol;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2608 $('#wstep_infuse_amount').val(vol);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2609 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2610
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2611 // Tab 7, Water
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2612 $('#tgt_bu').jqxNumberInput(Show2wat);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2613 $('#tgt_so4_cl,#got_so4_cl').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
2614
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2615 // Water source 1
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2616 $('#w1_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2617 placeHolder: 'Kies hoofd water:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2618 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2619 source: waterlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2620 displayMember: 'name',
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2621 width: 200,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2622 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2623 dropDownWidth: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2624 dropDownHeight: 400
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2625 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2626 $('#w1_name').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2627 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2628 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2629 datarecord = waterlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2630 dataRecord.w1_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2631 $('#w1_calcium').val(datarecord.calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2632 dataRecord.w1_calcium = datarecord.calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2633 $('#w1_sulfate').val(datarecord.sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2634 dataRecord.w1_sulfate = datarecord.sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2635 $('#w1_chloride').val(datarecord.chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2636 dataRecord.w1_chloride = datarecord.chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2637 $('#w1_sodium').val(datarecord.sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2638 dataRecord.w1_sodium = datarecord.sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2639 $('#w1_magnesium').val(datarecord.magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2640 dataRecord.w1_magnesium = datarecord.magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2641 $('#w1_total_alkalinity').val(datarecord.total_alkalinity);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2642 $('#w1_bicarbonate').val(datarecord.total_alkalinity * 1.22);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2643 dataRecord.w1_total_alkalinity = datarecord.total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2644 $('#w1_ph').val(datarecord.ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2645 dataRecord.w1_ph = datarecord.ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2646 $('#w1_cost').val(datarecord.cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2647 dataRecord.w1_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2648 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2649 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2650 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2651 $('#w1_amount').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2652 $('#w1_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2653 $('#w1_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2654 $('#w1_sodium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2655 $('#w1_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2656 $('#w1_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2657 $('#w1_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2658 $('#w1_sulfate').jqxNumberInput(Show1wat);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2659 $('#w1_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2660 // Water source 2
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2661 $('#w2_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2662 placeHolder: 'Kies meng water:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2663 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2664 source: waterlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2665 displayMember: 'name',
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2666 width: 200,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2667 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2668 dropDownWidth: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2669 dropDownHeight: 400
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2670 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2671 $('#w2_name').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2672 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2673 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2674 datarecord = waterlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2675 dataRecord.w2_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2676 $('#w2_calcium').val(datarecord.calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2677 dataRecord.w2_calcium = datarecord.calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2678 $('#w2_sulfate').val(datarecord.sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2679 dataRecord.w2_sulfate = datarecord.sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2680 $('#w2_chloride').val(datarecord.chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2681 dataRecord.w2_chloride = datarecord.chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2682 $('#w2_sodium').val(datarecord.sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2683 dataRecord.w2_sodium = datarecord.sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2684 $('#w2_magnesium').val(datarecord.magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2685 dataRecord.w2_magnesium = datarecord.magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2686 $('#w2_total_alkalinity').val(datarecord.total_alkalinity);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2687 $('#w2_bicarbonate').val(datarecord.total_alkalinity * 1.22);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2688 dataRecord.w2_total_alkalinity = datarecord.total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2689 $('#w2_ph').val(datarecord.ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2690 dataRecord.w2_ph = datarecord.ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2691 $('#w2_cost').val(datarecord.cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2692 dataRecord.w2_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2693 $('#w2_amount').jqxNumberInput({ max: 100000, readOnly: false }); // Set high max to enable the spinbuttons.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2694 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2695 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2696 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2697 $('#w2_amount').jqxTooltip({ content: 'De verdeling van het hoofd en meng water. Het totale maisch water volume blijft gelijk.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2698 $('#w2_amount').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 94, height: 23, min: 0, decimalDigits: 1, spinButtons: true, readOnly: true });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2699 $('#w2_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2700 $('#w2_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2701 $('#w2_sodium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2702 $('#w2_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2703 $('#w2_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2704 $('#w2_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2705 $('#w2_sulfate').jqxNumberInput(Show1wat);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2706 $('#w2_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2707 // Water mixed
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2708 $('#wg_amount').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2709 $('#wg_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2710 $('#wg_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2711 $('#wg_sodium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2712 $('#wg_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2713 $('#wg_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2714 $('#wg_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2715 $('#wg_sulfate').jqxNumberInput(Show1wat);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2716 $('#wg_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2717 // Water treated
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2718 $('#wb_calcium').jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2719 $('#wb_calcium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2720 $('#wb_magnesium').jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is tussen 5 en 40.'});
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2721 $('#wb_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2722 $('#wb_sodium').jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2723 $('#wb_sodium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2724 $('#wb_chloride').jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 150. Samen met Sulfaat minder dan 500.'});
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2725 $('#wb_chloride').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2726 $('#wb_sulfate').jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 400. Samen met Sulfaat minder dan 500.'});
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2727 $('#wb_sulfate').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2728 $('#wb_bicarbonate').jqxTooltip({ content: '0 tot 50 lichte bieren, 50 tot 150 amber bieren, 150 tot 250 donkere bieren.'});
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2729 $('#wb_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2730 $('#wb_total_alkalinity').jqxNumberInput(Show1wat);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2731 $('#wb_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2732 // Water target profile
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2733 $('#pr_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2734 placeHolder: 'Kies doel profiel:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2735 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2736 source: waterprofiles,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2737 displayMember: 'name',
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2738 width: 200,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2739 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2740 dropDownWidth: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2741 dropDownHeight: 300
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2742 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2743 $('#pr_name').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2744 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2745 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2746 datarecord = waterprofiles.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2747 $('#pr_calcium').val(datarecord.calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2748 $('#pr_sulfate').val(datarecord.sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2749 $('#pr_chloride').val(datarecord.chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2750 $('#pr_sodium').val(datarecord.sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2751 $('#pr_magnesium').val(datarecord.magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2752 $('#pr_total_alkalinity').val(datarecord.total_alkalinity);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2753 $('#pr_bicarbonate').val(datarecord.total_alkalinity * 1.22);
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
2754 calcWater();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2755 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2756 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2757 $('#pr_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2758 $('#pr_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2759 $('#pr_sodium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2760 $('#pr_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2761 $('#pr_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2762 $('#pr_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2763 $('#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
2764
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2765 // Water agents
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2766 $('#wa_cacl2').jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2767 $('#wa_cacl2').jqxNumberInput(Spin1dec);
524
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2768 $('#wa_caso4').jqxTooltip({
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2769 content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.'
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2770 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2771 $('#wa_caso4').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2772 $('#wa_mgso4').jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2773 $('#wa_mgso4').jqxNumberInput(Spin1dec);
524
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2774 $('#wa_nacl').jqxTooltip({
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2775 content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. ' +
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2776 'Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.'
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2777 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2778 $('#wa_nacl').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2779 $('#mash_ph').jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2780 $('#mash_ph').jqxNumberInput(SpinpH);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2781 $('#wa_mgcl2').jqxTooltip({ content: 'Magnesiumchloride'});
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2782 $('#wa_nahco3').jqxTooltip({ content: 'Baksoda'});
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2783 $('#wa_caco3').jqxTooltip({ content: 'Kalk'});
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2784 $('#wa_mgcl2,#wa_nahco3,#wa_caco3').jqxNumberInput(Spin1dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2785 $('#calc_acid').jqxCheckBox({ theme: theme, width: 120, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2786 $('#wa_acid_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2787 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2788 source: AcidTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2789 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2790 displayMember: 'nl',
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2791 width: 130,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2792 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2793 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2794 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2795 $('#wa_acid').jqxNumberInput(Spin2dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2796 $('#wa_acid').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2797 $('#wa_acid_perc').jqxNumberInput(Perc0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2798 $('#wa_acid_perc').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2799 // Sparge water
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2800 $('#sparge_temp').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2801 $('#sparge_volume').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2802 $('#sparge_ph').jqxNumberInput(SpinpH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2803 $('#sparge_source').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2804 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2805 source: SpargeSourceAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2806 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2807 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2808 width: 110,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2809 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2810 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2811 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2812 $('#sparge_acid_amount').jqxNumberInput(Spin2dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2813 $('#sparge_acid_amount').jqxNumberInput({ spinButtons: false, readOnly: true, symbol: ' ml', symbolPosition: 'right' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2814 $('#sparge_acid_type').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2815 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2816 source: AcidTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2817 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2818 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2819 width: 110,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2820 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2821 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2822 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2823 $('#sparge_acid_perc').jqxNumberInput(Perc0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2824 $('#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
2825
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2826 // Tabs inside the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2827 $('#jqxTabs').jqxTabs({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2828 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2829 width: 1280,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2830 height: 660,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2831 autoHeight: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2832 position: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2833 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2834
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2835 // Buttons below
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2836
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2837 $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2838 $('#Cancel').bind('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2839 window.location.href = my_return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2840 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2841
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2842 $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2843 $('#Save').bind('click', function() {
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2844 window.location.href = my_return;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2845 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2846 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2847

mercurial