www/js/rec_edit.js

Wed, 06 May 2020 14:14:14 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 06 May 2020 14:14:14 +0200
changeset 667
1246550451ca
parent 662
4bb005694ce7
child 710
9646123ea063
permissions
-rw-r--r--

Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.

68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
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
2 * Copyright (C) 2018-2020
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,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
47 MMMgSO4 = 246.475,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
48 MMNaHCO3 = 84.007,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
49 MMNa2CO3 = 105.996,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
50 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
51 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
52 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
53 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
54 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
55 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
56 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
57 data_loaded = 0;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 function createDelElements() {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
60 $('#eventWindow').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
61 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
62 position: { x: 490, y: 210 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
63 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
64 height: 175,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
65 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
66 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
67 modalOpacity: 0.4,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
68 okButton: $('#delOk'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
69 cancelButton: $('#delCancel'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
70 initContent: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
71 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
72 $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
73 $('#delCancel').focus();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
74 }
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 $('#eventWindow').jqxWindow('hide');
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
79
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
80 function hopFlavourContribution(bt, vol, use, amount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
81 var result;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
82
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
83 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
84 return 0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
85 if (use == 1) { // First wort
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
86 result = 0.15; // assume 15% flavourcontribution for fwh
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
87 } else if (bt > 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
88 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
89 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
90 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
91 if (result < 0.10)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
92 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
93 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
94 return (result * amount * 1000) / vol;
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
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 function hopAromaContribution(bt, vol, use, amount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
99 var result = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
100
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
101 if (use == 5) { // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
102 result = 1.33;
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
103 } else if (use == 4) { // Whirlpool
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
104 if (bt > 30)
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
105 bt = 30; // Max 30 minutes
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
106 result = 0.62 * bt / 30;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
107 } else if (bt > 20) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
108 result = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
109 } else if (bt > 7.5) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
110 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
111 } else if (use == 2) { // Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
112 result = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
113 } else if (use == 3) { // Aroma
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
114 result = 1.2;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
115 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
116 return (result * amount * 1000) / vol;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
117 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
118
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
119
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
120 function setReadonly(ro) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
121 var rw = ! ro, w100 = 110, w80 = 80;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
122 if (ro) { // jqxNumberInput width -20 for no spinbuttons
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
123 w100 = 90;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
124 w80 = 60;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
125 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
126 $('#batch_size').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
127 $('#boil_size').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
128 $('#boil_time').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
129 $('#efficiency').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
130 $('#est_og').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
131 // id="st_fg_min" margin-left 15/35 maken
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
132 $('#type').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
133 $('#styleSelect').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
134 $('#color_method').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
135 $('#ibu_method').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
136 $('#Delete').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
137 $('#fermentableGrid').jqxGrid({ editable: rw });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
138 $('#faddrowbutton').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
139 $('#finstockbutton').jqxCheckBox({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
140 $('#fdeleterowbutton').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
141 $('#hopGrid').jqxGrid({ editable: rw });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
142 $('#haddrowbutton').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
143 $('#hinstockbutton').jqxCheckBox({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
144 $('#hdeleterowbutton').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
145 $('#miscGrid').jqxGrid({ editable: rw });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
146 $('#maddrowbutton').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
147 $('#minstockbutton').jqxCheckBox({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
148 $('#mdeleterowbutton').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
149 $('#yeastGrid').jqxGrid({ editable: rw });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
150 $('#yaddrowbutton').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
151 $('#yinstockbutton').jqxCheckBox({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
152 $('#ydeleterowbutton').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
153 $('#mashGrid').jqxGrid({ editable: rw });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
154 $('#saddrowbutton').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
155 $('#sdeleterowbutton').jqxButton({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
156 $('#w1_name').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
157 $('#w2_name').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
158 $('#pr_name').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
159 $('#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
160 $('#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
161 $('#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
162 $('#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
163 $('#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
164 $('#calc_acid').jqxCheckBox({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
165 $('#wa_base_name').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
166 $('#wa_base').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
167 $('#wa_acid_name').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
168 $('#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
169 $('#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
170 $('#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
171 $('#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
172 $('#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
173 $('#sparge_source').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
174 $('#sparge_acid_type').jqxDropDownList({ disabled: ro });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
175 $('#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
176 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
177
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
178
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
179 function calcPercentages() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
180
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
181 console.log('calcPercentages()');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
182 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
183 if (rowscount > 1) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
184 tw = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
185 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
186 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
187 if (rowdata.f_added < 4)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
188 tw += Round(rowdata.f_amount, 3);
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 tw = Round(tw, 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
191
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
192 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
193 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
194 if (rowdata.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
195 percentage = Round(rowdata.f_amount / tw * 100, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
196 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', percentage);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
197 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
198 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0);
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 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
201 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
202 $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
203 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
204 }
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 function calcFermentables() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
208 console.log('calcFermentables()');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
209 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
210 sug, alc, cw, color, scolor, fig,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
211 sugarsf = 0, // fermentable sugars mash + boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
212 sugarsm = 0; // fermentable sugars in mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
213 vol = 0, // Volume sugars after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
214 addedS = 0, // Added sugars after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
215 addedmass = 0, // Added mass after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
216 mvol = 0, // mash volume
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
217 colort = 0, // Colors srm * vol totals
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
218 colorh = 0, // Colors ebc * vol * kt
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
219 colorn = 0, // Colors ebc * pt * pct
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
220 my_100 = false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
221 mashtime = 0, // Total mash time
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
222 mashtemp = 0, // Average mash temperature
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
223 bv = 0.925, // Bierverlies rendement
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
224 sr = 0.95, // Mash en spoel rendement
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
225 lintner = 0; // Total recipe lintner
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
226 /* Init global variables */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
227 psugar = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
228 pcara = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
229 mashkg = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
230
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
231 if ((rows = $('#mashGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
232 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
233 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
234 if (row.step_type == 0) // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
235 mvol += parseFloat(row.step_infuse_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
236 if (row.step_temp <= 75) { // Ignore mashout
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
237 mashtime += row.step_time;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
238 mashtemp += row.step_time * row.step_temp;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
239 }
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 mashtemp = mashtemp / mashtime;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
242 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
243
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
244 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
245 return; // grid not yet loaded.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
246 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
247
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
248 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
249 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
250 if (row.f_adjust_to_total_100)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
251 my_100 = true;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
252 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
253 psugar += row.f_percentage;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
254 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
255 pcara += row.f_percentage;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
256 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
257 if (row.f_added == 0) { // Mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
258 if (mvol > 0) { // Only if mash already known
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
259 mvol += row.f_amount * row.f_moisture / 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
260 s += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
261 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
262 d = parseFloat(dataRecord.efficiency) / 100 * d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
263 sugarsm += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
264 mashkg += row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
265 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
266 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
267 sugarsf += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
268 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
269 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
270 addedS += row.f_amount * x;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
271 addedmass += row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
272 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
273 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
274 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
275 lintner += row.f_diastatic_power * row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
276 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
277 if (row.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
278 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
279 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
280 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
281 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
282 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
283 $('#ferm_lintner').val(Math.round(parseFloat(lintner / mashkg)));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
284 to_100 = my_100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
285 if (to_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
286 $('#wf_amount').jqxNumberInput({ width: 90, readOnly: true, spinButtons: false });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
287 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
288 $('#wf_amount').jqxNumberInput({ width: 110, readOnly: false, spinButtons: true });
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
291 // Estimate total recipe OG.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
292 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
293 $('#est_og').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
294 $('#est_og2').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
295 org = dataRecord.est_og;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
296
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
297 // Estimate SG in kettle before boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
298 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
299
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
300 // Color of the wort
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
301 if (dataRecord.color_method == 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
302 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
303 } else if (dataRecord.color_method == 3) { // Hans Halberstadt
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
304 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
305 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
306 cw = colort / parseFloat(dataRecord.batch_size) * 8.34436;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
307 color = kw_to_ebc(dataRecord.color_method, cw);
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 dataRecord.est_color = color;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
310 $('#est_color').val(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
311 $('#est_color2').val(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
312 scolor = ebc_to_color(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
313 document.getElementById('bcolor').style.background = scolor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
314 document.getElementById('bcolor2').style.background = scolor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
315
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
316 // Progress bars
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
317 pmalts = mashkg / (dataRecord.boil_size / 3) * 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
318 $('#perc_malts').jqxProgressBar('val', pmalts);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
319 $('#perc_sugars').jqxProgressBar('val', psugar);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
320 $('#perc_cara').jqxProgressBar('val', pcara);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
321
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
322 // Calculate estimated svg.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
323 svg = 0; // default.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
324 rows = $('#yeastGrid').jqxGrid('getrows');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
325 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
326 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
327 if (row.y_use == 0) { // Primary
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
328 if (parseFloat(row.y_attenuation) > svg)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
329 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
330 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
331 // TODO: brett in secondary ??
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
332 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
333 if (svg == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
334 svg = 77;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
335
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
336 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
337 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
338 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
339 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
340 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
341 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
342 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
343 fig = dataRecord.est_fg;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
344
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
345 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
346 $('#est_abv').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
347 $('#est_abv2').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
348
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
349 // Calculate the calories in kcal/l (from brouwhulp)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
350 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
351 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
352 $('#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
353 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
354
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
355
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
356 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
357
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 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
359 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
360 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
361 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
362 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
363 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
364 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
365 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
366 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
367 $("#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
368 $("#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
369 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 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
373 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
374 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
375 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
376 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
377 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
378 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 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
382 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
383 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
384 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
385 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
386 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
387 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
388 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
389 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
392 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
393 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
394 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
395 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
396 var tuntemp = 18.0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
397
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
398 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
399 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
400 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
401 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
402 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
403 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
404 // 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
405 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
406 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
407 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
408 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
409 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
410 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
411 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
412 } 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
413 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
414 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
415 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
416 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
417 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
418 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
419 } 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
420 // 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
421 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
422 //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
423 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
424 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
425 } 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
426 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
427 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
428 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
429 } 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
430 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
431 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
432 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
433 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
434 //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
435 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
436 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
437 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
438 $('#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
439 }
474
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 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
442
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 calcIBUs() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
445 var total_ibus = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
446 rows = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
447 i, row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
448
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
449 hop_aroma = hop_flavour = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
450 if (!(rows = $('#hopGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
451 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
452 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
453 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
454 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
455 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
456 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
457 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
458 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
459 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
460 total_ibus = Round(total_ibus, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
461 hop_flavour = Round(hop_flavour * 100 / 5, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
462 hop_aroma = Round(hop_aroma * 100 / 6, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
463 if (hop_flavour > 100)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
464 hop_flavour = 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
465 if (hop_aroma > 100)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
466 hop_aroma = 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
467 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
468 dataRecord.est_ibu = total_ibus;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
469 $('#est_ibu').val(total_ibus);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
470 $('#est_ibu2').val(total_ibus);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
471 $('#hop_flavour').jqxProgressBar('val', hop_flavour);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
472 $('#hop_aroma').jqxProgressBar('val', hop_aroma);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
473 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
475
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
476 function adjustHops(factor) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
477
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
478 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
479 if (rowscount == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
480 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
481
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
482 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
483 row = $('#hopGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
484 amount = row.h_amount * factor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
485 $('#hopGrid').jqxGrid('setcellvalue', i, 'h_amount', amount);
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 }
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
490 function adjustMiscs(factor) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
491
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
492 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
493 if (rowscount == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
494 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
495
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
496 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
497 row = $('#miscGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
498 amount = row.m_amount * factor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
499 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
500 switch (row.m_name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
501 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
502 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
503 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
504 case 'NaCl': $('#wa_nacl').val(row.m_amount * 1000); break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
505 case 'Melkzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
506 case 'Zoutzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
507 case 'Fosforzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
508 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
509 case 'NaHCO3':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
510 case 'Na2CO3':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
511 case 'CaCO3':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
512 case 'Ca(OH)2': $('#wa_base').val(row.m_amount * 1000); break;
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 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
515 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
516
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
517
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
518 function adjustYeasts(factor) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
519
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
520 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
521 if (rowscount == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
522 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
523
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
524 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
525 row = $('#yeastGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
526 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
527 amount = row.y_amount * factor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
528 $('#yeastGrid').jqxGrid('setcellvalue', i, 'y_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
529 }
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 adjustWaters(factor) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
535
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
536 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
537 if (rowscount == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
538 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
539 mash_infuse = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
540 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
541 row = $('#mashGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
542 if (row.step_type == 0) { // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
543 amount = Round(row.step_infuse_amount * factor, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
544 $('#mashGrid').jqxGrid('setcellvalue', i, 'step_infuse_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
545 mash_infuse += amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
546 }
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 if (dataRecord.w2_amount == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
549 dataRecord.w1_amount = mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
550 $('#w1_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
551 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
552 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
553 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
554 $('#w1_amount').val(dataRecord.w1_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
555 $('#w2_amount').val(dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
556 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
557 $('#wg_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
558 }
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 function GetBUGU() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
562 var gu = (dataRecord.est_og - 1) * 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
563 if (gu > 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
564 return dataRecord.est_ibu / gu;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
565 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
566 return 0.5;
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
569
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
570 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
571 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
572 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
573 } 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
574 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
575 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
576 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
577 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
578
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
579
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
580
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
581 function setRangeIndicator(ion, rangeCode) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
582 if ((rangeCode == 'laag') || (rangeCode == 'hoog'))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
583 $('#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
584 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
585 $('#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
586 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
587
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
588
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
589 function mix(v1, v2, c1, c2) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
590 if ((v1 + v2) > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
591 return ((v1 * c1) + (v2 * c2)) / (v1 + v2);
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 return 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
594 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
595
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
596
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
597 // mg/l as CaCO3
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
598 function ResidualAlkalinity(total_alkalinity, calcium, magnesium) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
599 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
600 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
601
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
602
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
603 function PartCO3(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
604 var H = Math.pow(10, -pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
605 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
606 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
607
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
608
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
609 function PartHCO3(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
610 var H = Math.pow(10, -pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
611 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
612 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
613
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
614
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
615 function Charge(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
616 return (-2 * PartCO3(pH) - PartHCO3(pH));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
617 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
618
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
619
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
620 //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
621 function ZAlkalinity(pHZ) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
622 var C43 = Charge(4.3),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
623 Cw = Charge(parseFloat($('#wg_ph').jqxNumberInput('decimal'))),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
624 Cz = Charge(pHZ),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
625 DeltaCNaught = -C43 + Cw,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
626 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
627 DeltaCZ = -Cz + Cw;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
628 return CT * DeltaCZ;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
629 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
630
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
631
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
632 //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
633 function ZRA(pHZ) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
634 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
635 Magn = parseFloat($('#wg_magnesium').jqxNumberInput('decimal')) / (MMMg / 2),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
636 Z = ZAlkalinity(pHZ);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
637 return Z - (Calc / 3.5 + Magn / 7);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
638 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
639
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
640
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
641 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
642 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
643 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
644 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
645 } 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
646 // 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
647 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
648 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
649 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
650 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
651 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
652 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
653 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
654 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
655 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
656 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
657 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
658 }
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
659 }
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
660 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
661 }
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
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
663
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
664 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
665 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
666 // 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
667 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
668 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
669 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
670 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
671 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
672 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
673 Result += x * row.f_amount;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
674 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
675 }
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
676 } 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
677 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
678 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
679 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
680 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
681 return Result;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
682 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
683
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
684
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
685 function MashpH() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
686 var n = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
687 pH = 5.4,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
688 deltapH = 0.001,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
689 deltapd = 0.1,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
690 pd = ProtonDeficit(pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
691 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
692 n++;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
693 if (pd < -deltapd)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
694 pH -= deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
695 else if (pd > deltapd)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
696 pH += deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
697 pd = ProtonDeficit(pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
698 }
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
699 pH = Round(pH, 6);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
700 //console.log('MashpH() n: ' + n + ' pH: ' + pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
701 return pH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
702 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
703
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
704
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
705
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
706
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
707 $(document).ready(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
708
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
709 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
710
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
711 fermentableRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
712 fermentableData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
713 hopRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
714 hopData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
715 miscRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
716 miscData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
717 yeastRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
718 yeastData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
719 mashRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
720 mashData = {},
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
721
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
722 url = 'includes/db_recipes.php',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
723 // prepare the data
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
724 source = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
725 datatype: 'json',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
726 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
727 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
728 { name: 'record', type: 'number' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
729 { name: 'uuid', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
730 { name: 'locked', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
731 { name: 'st_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
732 { name: 'st_letter', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
733 { name: 'st_guide', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
734 { name: 'st_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
735 { name: 'st_category', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
736 { name: 'st_category_number', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
737 { name: 'st_og_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
738 { name: 'st_og_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
739 { name: 'st_fg_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
740 { name: 'st_fg_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
741 { name: 'st_ibu_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
742 { name: 'st_ibu_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
743 { name: 'st_color_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
744 { name: 'st_color_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
745 { name: 'st_carb_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
746 { name: 'st_carb_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
747 { name: 'st_abv_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
748 { name: 'st_abv_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
749 { name: 'name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
750 { name: 'notes', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
751 { name: 'type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
752 { name: 'batch_size', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
753 { name: 'boil_size', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
754 { name: 'boil_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
755 { name: 'efficiency', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
756 { name: 'est_og', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
757 { name: 'est_fg', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
758 { name: 'est_abv', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
759 { name: 'est_color', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
760 { name: 'color_method', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
761 { name: 'est_ibu', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
762 { name: 'ibu_method', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
763 { name: 'est_carb', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
764 { name: 'sparge_temp', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
765 { name: 'sparge_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
766 { name: 'sparge_volume', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
767 { name: 'sparge_source', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
768 { name: 'sparge_acid_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
769 { name: 'sparge_acid_perc', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
770 { name: 'sparge_acid_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
771 { name: 'mash_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
772 { name: 'mash_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
773 { name: 'calc_acid', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
774 { name: 'w1_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
775 { name: 'w1_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
776 { name: 'w1_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
777 { name: 'w1_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
778 { name: 'w1_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
779 { name: 'w1_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
780 { name: 'w1_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
781 { name: 'w1_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
782 { name: 'w1_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
783 { name: 'w1_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
784 { name: 'w2_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
785 { name: 'w2_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
786 { name: 'w2_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
787 { name: 'w2_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
788 { name: 'w2_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
789 { name: 'w2_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
790 { name: 'w2_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
791 { name: 'w2_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
792 { name: 'w2_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
793 { name: 'w2_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
794 { name: 'wg_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
795 { name: 'wg_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
796 { name: 'wg_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
797 { name: 'wg_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
798 { name: 'wg_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
799 { name: 'wg_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
800 { name: 'wg_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
801 { name: 'wg_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
802 { name: 'wb_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
803 { name: 'wb_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
804 { name: 'wb_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
805 { name: 'wb_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
806 { name: 'wb_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
807 { name: 'wb_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
808 { name: 'wb_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
809 { name: 'wa_acid_name', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
810 { name: 'wa_acid_perc', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
811 { name: 'wa_base_name', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
812 { name: 'fermentables', type: 'array' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
813 { name: 'hops', type: 'array' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
814 { name: 'miscs', type: 'array' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
815 { name: 'yeasts', type: 'array' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
816 { name: 'mashs', type: 'array' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
817 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
818 id: 'record',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
819 url: url + '?record=' + my_record
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
820 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
821 // Load data and select one record.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
822 dataAdapter = new $.jqx.dataAdapter(source, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
823 loadComplete: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
824 var records = dataAdapter.records;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
825 dataRecord = records[0];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
826 // Hidden record uuid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
827 $('#name').val(dataRecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
828 $('#notes').val(dataRecord.notes);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
829 $('#locked').val(dataRecord.locked);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
830 $('#st_name').val(dataRecord.st_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
831 $('#st_letter').val(dataRecord.st_letter);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
832 $('#st_guide').val(dataRecord.st_guide);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
833 $('#st_category').val(dataRecord.st_category);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
834 $('#st_category_number').val(dataRecord.st_category_number);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
835 $('#st_type').val(StyleTypeData[dataRecord.st_type].nl);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
836 $('#type').val(dataRecord.type);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
837 $('#batch_size').val(dataRecord.batch_size);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
838 $('#boil_size').val(dataRecord.boil_size);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
839 $('#boil_time').val(dataRecord.boil_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
840 $('#efficiency').val(dataRecord.efficiency);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
841 $('#est_og').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
842 $('#est_og2').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
843 $('#st_og_min').val(dataRecord.st_og_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
844 $('#st_og_max').val(dataRecord.st_og_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
845 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
846 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
847 $('#st_fg_min').val(dataRecord.st_fg_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
848 $('#st_fg_max').val(dataRecord.st_fg_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
849 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
850 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
851 $('#st_fg_min').val(dataRecord.st_fg_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
852 $('#st_fg_max').val(dataRecord.st_fg_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
853 $('#est_color').val(dataRecord.est_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
854 $('#est_color2').val(dataRecord.est_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
855 $('#est_abv').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
856 $('#est_abv2').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
857 $('#st_abv_min').val(dataRecord.st_abv_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
858 $('#st_abv_max').val(dataRecord.st_abv_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
859 $('#st_color_min').val(dataRecord.st_color_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
860 $('#st_color_max').val(dataRecord.st_color_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
861 $('#color_method').val(dataRecord.color_method);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
862 $('#est_ibu').val(dataRecord.est_ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
863 $('#est_ibu2').val(dataRecord.est_ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
864 $('#st_ibu_min').val(dataRecord.st_ibu_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
865 $('#st_ibu_max').val(dataRecord.st_ibu_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
866 $('#ibu_method').val(dataRecord.ibu_method);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
867 $('#est_carb').val(dataRecord.est_carb);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
868 $('#st_carb_min').val(dataRecord.st_carb_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
869 $('#st_carb_max').val(dataRecord.st_carb_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
870 $('#mash_name').val(dataRecord.mash_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
871 $('#mash_ph').val(dataRecord.mash_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
872 $('#sparge_temp').val(dataRecord.sparge_temp);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
873 $('#sparge_ph').val(dataRecord.sparge_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
874 $('#sparge_volume').val(dataRecord.sparge_volume);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
875 $('#sparge_source').val(dataRecord.sparge_source);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
876 $('#sparge_acid_type').val(dataRecord.sparge_acid_type);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
877 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
878 $('#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
879 $('#calc_acid').val(dataRecord.calc_acid);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
880 $('#w1_name').val(dataRecord.w1_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
881 $('#w1_amount').val(dataRecord.w1_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
882 $('#w1_calcium').val(dataRecord.w1_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
883 $('#w1_sulfate').val(dataRecord.w1_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
884 $('#w1_chloride').val(dataRecord.w1_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
885 $('#w1_sodium').val(dataRecord.w1_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
886 $('#w1_magnesium').val(dataRecord.w1_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
887 $('#w1_total_alkalinity').val(dataRecord.w1_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
888 $('#w1_ph').val(dataRecord.w1_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
889 $('#w1_cost').val(dataRecord.w1_cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
890 $('#w2_name').val(dataRecord.w2_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
891 $('#w2_amount').val(dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
892 $('#w2_calcium').val(dataRecord.w2_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
893 $('#w2_sulfate').val(dataRecord.w2_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
894 $('#w2_chloride').val(dataRecord.w2_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
895 $('#w2_sodium').val(dataRecord.w2_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
896 $('#w2_magnesium').val(dataRecord.w2_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
897 $('#w2_total_alkalinity').val(dataRecord.w2_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
898 $('#w2_ph').val(dataRecord.w2_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
899 $('#w2_cost').val(dataRecord.w2_cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
900 $('#wg_amount').val(dataRecord.wg_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
901 $('#wg_calcium').val(dataRecord.wg_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
902 $('#wg_sulfate').val(dataRecord.wg_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
903 $('#wg_chloride').val(dataRecord.wg_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
904 $('#wg_sodium').val(dataRecord.wg_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
905 $('#wg_magnesium').val(dataRecord.wg_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
906 $('#wg_total_alkalinity').val(dataRecord.wg_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
907 $('#wg_ph').val(dataRecord.wg_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
908 $('#wb_calcium').val(dataRecord.wb_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
909 $('#wb_sulfate').val(dataRecord.wb_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
910 $('#wb_chloride').val(dataRecord.wb_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
911 $('#wb_sodium').val(dataRecord.wb_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
912 $('#wb_magnesium').val(dataRecord.wb_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
913 $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
914 $('#wb_ph').val(dataRecord.wb_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
915 $('#wa_acid_name').val(dataRecord.wa_acid_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
916 $('#wa_acid_perc').val(dataRecord.wa_acid_perc);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
917 $('#wa_base_name').val(dataRecord.wa_base_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
918 editFermentable(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
919 editHop(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
920 editMisc(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
921 editYeast(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
922 editMash(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
923 $('#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
924 data_loaded = 1;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
925 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
926 loadError: function(jqXHR, status, error) {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
927 beforeLoadComplete: function(records) { $('#jqxLoader').jqxLoader('open'); }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
928 }),
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
929
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
930 // Inline fermentables editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
931 editFermentable = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
932 var fermentableSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
933 localdata: data.fermentables,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
934 datatype: 'local',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
935 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
936 async: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
937 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
938 { name: 'f_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
939 { name: 'f_origin', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
940 { name: 'f_supplier', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
941 { name: 'f_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
942 { name: 'f_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
943 { name: 'f_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
944 { name: 'f_yield', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
945 { name: 'f_color', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
946 { name: 'f_coarse_fine_diff', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
947 { name: 'f_moisture', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
948 { name: 'f_diastatic_power', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
949 { name: 'f_protein', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
950 { name: 'f_max_in_batch', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
951 { name: 'f_graintype', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
952 { name: 'f_added', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
953 { name: 'f_dissolved_protein', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
954 { name: 'f_recommend_mash', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
955 { name: 'f_add_after_boil', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
956 { name: 'f_adjust_to_total_100', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
957 { name: 'f_percentage', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
958 { name: 'f_di_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
959 { name: 'f_acid_to_ph_57', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
960 { name: 'f_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
961 { name: 'f_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
962 ],
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
963 addrow: function(rowid, rowdata, position, commit) { commit(true); },
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
964 deleterow: function(rowid, commit) { commit(true); },
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
965 updaterow: function(rowid, rowdata, commit) { commit(true); }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
966 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
967 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
968
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
969 $('#fermentableGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
970 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
971 height: 470,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
972 source: fermentableAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
973 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
974 selectionmode: 'singlerow',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
975 showtoolbar: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
976 rendertoolbar: function(toolbar) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
977 //var me = this;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
978 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
979 toolbar.append(container);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
980 container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
981 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
982 container.append('<div style="float: left; margin-left: 10px;" id="finstockbutton"></div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
983 container.append('<input style="float: left; margin-left: 400px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
984 // add fermentable from dropdownlist.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
985 $('#faddrowbutton').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
986 placeHolder: 'Kies mout:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
987 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
988 template: 'primary',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
989 source: fermentablelist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
990 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
991 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
992 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
993 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
994 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
995 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
996 var datarecord = fermentablelist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
997 return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC)';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
998 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
999 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1000 $('#faddrowbutton').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1001 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1002 var index, datarecord, row = {}, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1003 index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1004 datarecord = fermentablelist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1005 row['f_name'] = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1006 row['f_origin'] = datarecord.origin;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1007 row['f_supplier'] = datarecord.supplier;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1008 row['f_amount'] = 0;
549
21705ae9dff2 Fixed fatal bug in recipe fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
1009 row['f_cost'] = datarecord.cost;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1010 row['f_type'] = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1011 row['f_yield'] = datarecord.yield;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1012 row['f_color'] = datarecord.color;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1013 row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1014 row['f_moisture'] = datarecord.moisture;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1015 row['f_diastatic_power'] = datarecord.diastatic_power;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1016 row['f_protein'] = datarecord.protein;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1017 row['f_max_in_batch'] = datarecord.max_in_batch;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1018 row['f_graintype'] = datarecord.graintype;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1019 if (datarecord.add_after_boil) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1020 row['f_added'] = 2; // Fermentation
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1021 } else if ((datarecord.type == 1) || (datarecord.type == 4)) { // Sugar or Adjunct
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1022 row['f_added'] = 1; // Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1023 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1024 row['f_added'] = 0; // Mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1025 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1026 row['f_dissolved_protein'] = datarecord.dissolved_protein;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1027 row['f_recommend_mash'] = datarecord.recommend_mash;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1028 row['f_add_after_boil'] = datarecord.add_after_boil;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1029 if (rowscount == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1030 // The first fermentable
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1031 row['f_adjust_to_total_100'] = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1032 row['f_percentage'] = 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1033 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1034 row['f_adjust_to_total_100'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1035 row['f_percentage'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1036 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1037 row['f_di_ph'] = datarecord.di_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1038 row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1039 row['f_inventory'] = datarecord.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1040 $('#fermentableGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1041 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1042 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1043 $('#finstockbutton').jqxCheckBox({ theme: theme, height: 27 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1044 $('#finstockbutton').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1045 fermentableinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1046 fermentablelist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1047 });
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
1048
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1049 // delete selected fermentable.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1050 $('#fdeleterowbutton').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
1051 $('#fdeleterowbutton').on('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1052 var id, percent, amount, i, rowdata, rowscount, selectedrowindex = $('#fermentableGrid').jqxGrid('getselectedrowindex');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1053 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1054 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1055 id = $('#fermentableGrid').jqxGrid('getrowid', selectedrowindex);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1056 percent = $('#fermentableGrid').jqxGrid('getcellvalue', id, 'f_percentage');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1057 amount = $('#fermentableGrid').jqxGrid('getcellvalue', id, 'f_amount');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1058 $('#fermentableGrid').jqxGrid('deleterow', id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1059 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1060 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1061 if (rowscount > 1) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1062 if (to_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1063 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1064 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1065 if (rowdata.f_adjust_to_total_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1066 rowdata.f_percentage += percent;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1067 rowdata.f_amount += amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1068 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1069 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1070 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1071 calcPercentages();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1072 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1073 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1074 $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1075 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1076 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1077 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1078 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1079 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1080 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1081 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1082 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1083 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1084 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1085 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1086 cellsrenderer: function(index, datafield, value, defaulvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1087 return '<span style="margin: 3px; margin-top: 6px; float: left;">' +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1088 rowdata.f_supplier + ' / ' + rowdata.f_name + ' (' + rowdata.f_color + ' EBC)</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1089 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1090 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1091 { text: 'Type', width: 100, datafield: 'f_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1092 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1093 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
1094 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1095 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1096 { text: 'Moment', width: 110, datafield: 'f_added',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1097 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1098 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
1099 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1101 { 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
1102 { 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
1103 { 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
1104 { text: 'Voorr. Kg', datafield: 'f_inventory', width: 120, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1105 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1106 var color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1107 if (value < rowdata.f_amount)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1108 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1109 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
1110 color + ';">' + fermentableAdapter.formatNumber(value, 'f3') + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1111 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1112 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1113 { 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
1114 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1115 var color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1116 if (value > rowdata.f_max_in_batch)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1117 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1118 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
1119 color + ';">' + fermentableAdapter.formatNumber(value, 'p1') + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1120 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1121 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1122 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1123 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1124 return 'Wijzig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1125 }, buttonclick: function(row) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1126 fermentableRow = row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1127 fermentableData = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1128 $('#wf_name').val(fermentableData.f_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1129 $('#wf_amount').val(fermentableData.f_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1130 $('#wf_percentage').val(fermentableData.f_percentage);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1131 $('#wf_max_in_batch').val(fermentableData.f_max_in_batch);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1132 $('#wf_adjust_to_total_100').val(fermentableData.f_adjust_to_total_100);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1133 $('#wf_added').val(fermentableData.f_added);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1134 // show the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1135 $('#popupFermentable').jqxWindow('open');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1136 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1137 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1138 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1139 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1140 };
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
1141
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1142 // Inline hops editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1143 var editHop = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1144 var hopSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1145 localdata: data.hops,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1146 datatype: 'local',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1147 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1148 async: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1149 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1150 { name: 'h_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1151 { name: 'h_origin', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1152 { name: 'h_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1153 { name: 'h_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1154 { name: 'h_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1155 { name: 'h_form', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1156 { name: 'h_useat', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1157 { name: 'h_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1158 { name: 'h_alpha', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1159 { name: 'h_beta', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1160 { name: 'h_hsi', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1161 { name: 'h_humulene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1162 { name: 'h_caryophyllene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1163 { name: 'h_cohumulone', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1164 { name: 'h_myrcene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1165 { name: 'h_total_oil', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1166 { name: 'h_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1167 { name: 'h_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1168 ],
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1169 addrow: function(rowid, rowdata, position, commit) { commit(true); },
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1170 deleterow: function(rowid, commit) { commit(true); },
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1171 updaterow: function(rowid, rowdata, commit) { commit(true); }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1172 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1173 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
1174
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1175 $('#hopGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1176 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1177 height: 560,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1178 source: hopAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1179 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1180 selectionmode: 'singlerow',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1181 showtoolbar: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1182 rendertoolbar: function(toolbar) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1183 //var me = this;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1184 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
1185 toolbar.append(container);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1186 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1187 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1188 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1189 container.append('<input style="float: left; margin-left: 400px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1190 // add hop from dropdownlist.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1191 $('#haddrowbutton').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1192 placeHolder: 'Kies hop:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1193 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1194 template: 'primary',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1195 source: hoplist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1196 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1197 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1198 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1199 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1200 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1201 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1202 var datarecord = hoplist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1203 return datarecord.origin + ' / ' + datarecord.name + ' (' + datarecord.alpha + '% &alpha;)';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1204 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1205 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1206 $('#haddrowbutton').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1207 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1208 var datarecord, row = {}, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1209 datarecord = hoplist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1210 row['h_name'] = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1211 row['h_origin'] = datarecord.origin;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1212 row['h_amount'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1213 row['h_cost'] = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1214 row['h_type'] = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1215 row['h_form'] = datarecord.form;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1216 row['h_useat'] = 2; // Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1217 row['h_time'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1218 row['h_alpha'] = datarecord.alpha;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1219 row['h_beta'] = datarecord.beta;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1220 row['h_hsi'] = datarecord.hsi;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1221 row['h_humulene'] = datarecord.humulene;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1222 row['h_caryophyllene'] = datarecord.caryophyllene;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1223 row['h_cohumulone'] = datarecord.cohumulone;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1224 row['h_myrcene'] = datarecord.myrcene;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1225 row['h_total_oil'] = datarecord.total_oil;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1226 row['h_inventory'] = datarecord.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1227 $('#hopGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1228 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1229 $('#haddrowbutton').jqxDropDownList('clearSelection');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1230 });
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
1231
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1232 $('#hinstockbutton').jqxCheckBox({ theme: theme, height: 27 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1233 $('#hinstockbutton').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1234 hopinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1235 hoplist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1236 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1237
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1238 // delete selected hop.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1239 $('#hdeleterowbutton').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
1240 $('#hdeleterowbutton').on('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1241 var rowscount, id, selectedrowindex = $('#hopGrid').jqxGrid('getselectedrowindex');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1242 rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1243 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1244 id = $('#hopGrid').jqxGrid('getrowid', selectedrowindex);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1245 $('#hopGrid').jqxGrid('deleterow', id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1246 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1247 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1248 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1249 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1250 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1251 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1252 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1253 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1254 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1255 { text: 'Hop', datafield: 'h_name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1256 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1257 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.h_origin + ' / ' + rowdata.h_name + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1258 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1259 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1260 { text: 'Type', width: 90, datafield: 'h_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1261 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1262 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
1263 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1264 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1265 { text: 'Vorm', width: 90, datafield: 'h_form',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1266 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1267 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
1268 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1269 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1270 { 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
1271 { text: 'Gebruik', width: 110, datafield: 'h_useat',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1272 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1273 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
1274 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1275 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1276 { 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
1277 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1278 var duration = '';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1279 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
1280 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1281 else if (rowdata.h_useat == 5) // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1282 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1283 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
1284 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1285 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1286 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right',
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 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1289 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time),
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
1290 parseFloat(rowdata.h_alpha), $('#ibu_method').val(), 0, parseFloat(rowdata.h_time), 0);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1291 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
1292 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1293 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1294 { 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
1295 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1296 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1297 if (value < 1)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1298 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1299 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
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 { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1303 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1304 var amount, color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1305 if (value < rowdata.h_amount)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1306 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1307 amount = dataAdapter.formatNumber(value, 'f1') + ' kg';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1308 if (value < 1)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1309 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1310 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
1311 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1312 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1313 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1314 cellsrenderer: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1315 return 'Wijzig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1316 }, buttonclick: function(row) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1317 hopRow = row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1318 hopData = $('#hopGrid').jqxGrid('getrowdata', hopRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1319 $('#wh_name').val(hopData.h_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1320 $('#wh_amount').val(hopData.h_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1321 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1322 parseFloat($('#batch_size').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1323 parseFloat(hopData.h_amount), parseFloat(hopData.h_time),
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
1324 parseFloat(hopData.h_alpha), $('#ibu_method').val(),
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
1325 0, parseFloat(hopData.h_time), 0
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1326 );
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1327 $('#wh_ibu').val(ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1328 if (hopData.h_useat == 5) // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1329 $('#wh_time').val(hopData.h_time / 1440);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1330 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1331 $('#wh_time').val(hopData.h_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1332 $('#wh_useat').val(hopData.h_useat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1333 // show the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1334 $('#popupHop').jqxWindow('open');
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 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1338 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1339 };
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
1340
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1341 // Inline miscs editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1342 var editMisc = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1343 var miscSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1344 localdata: data.miscs,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1345 datatype: 'local',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1346 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1347 async: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1348 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1349 { name: 'm_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1350 { name: 'm_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1351 { name: 'm_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1352 { name: 'm_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1353 { name: 'm_use_use', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1354 { name: 'm_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1355 { name: 'm_amount_is_weight', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1356 { name: 'm_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1357 { name: 'm_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1358 ],
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1359 addrow: function(rowid, rowdata, position, commit) { commit(true); },
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1360 deleterow: function(rowid, commit) { commit(true); },
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1361 updaterow: function(rowid, rowdata, commit) { commit(true); }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1362 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1363 miscAdapter = new $.jqx.dataAdapter(miscSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1364 beforeLoadComplete: function(records) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1365 var i, row, data = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1366 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1367 row = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1368 data.push(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1369 // Initial set water agent values.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1370 switch (row.m_name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1371 case 'CaCl2':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1372 $('#wa_cacl2').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1373 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1374 case 'CaSO4':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1375 $('#wa_caso4').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1376 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1377 case 'MgSO4':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1378 $('#wa_mgso4').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1379 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1380 case 'NaCl':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1381 $('#wa_nacl').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1382 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1383 case 'Melkzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1384 $('#wa_acid_name').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1385 $('#wa_acid').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1386 $('#wa_acid_perc').val(80);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1387 last_acid = 'Melkzuur';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1388 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1389 case 'Zoutzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1390 $('#wa_acid_name').val(1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1391 $('#wa_acid').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1392 $('#wa_acid_perc').val(80);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1393 last_acid = 'Zoutzuur';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1394 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1395 case 'Fosforzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1396 $('#wa_acid_name').val(2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1397 $('#wa_acid').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1398 $('#wa_acid_perc').val(80);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1399 last_acid = 'Fosforzuur';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1400 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1401 case 'Zwavelzuur':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1402 $('#wa_acid_name').val(3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1403 $('#wa_acid').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1404 $('#wa_acid_perc').val(80);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1405 last_acid = 'Zwavelzuur';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1406 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1407 case 'NaHCO3':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1408 $('#wa_base_name').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1409 $('#wa_base').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1410 last_base = 'NaHCO3';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1411 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1412 case 'Na2CO3':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1413 $('#wa_base_name').val(1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1414 $('#wa_base').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1415 last_base = 'Na2CO3';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1416 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1417 case 'CaCO3':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1418 $('#wa_base_name').val(2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1419 $('#wa_base').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1420 last_base = 'CaCO3';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1421 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1422 case 'Ca(OH)2':
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1423 $('#wa_base_name').val(3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1424 $('#wa_base').val(row.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1425 last_base = 'Ca(OH)2';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1426 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1427 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1428 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1429 return data;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1430 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1431 loadError: function(jqXHR, status, error) {}
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1432 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1433 $('#miscGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1434 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1435 height: 575,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1436 source: miscAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1437 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1438 selectionmode: 'singlerow',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1439 showtoolbar: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1440 rendertoolbar: function(toolbar) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1441 //var me = this;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1442 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
1443 toolbar.append(container);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1444 container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1445 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1446 container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1447 container.append('<input style="float: left; margin-left: 400px;" id="mdeleterowbutton" type="button" value="Verwijder ingredi&euml;nt" />');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1448 // add misc from dropdownlist.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1449 $('#maddrowbutton').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1450 placeHolder: 'Kies ingredi&euml;nt:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1451 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1452 template: 'primary',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1453 source: misclist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1454 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1455 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1456 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1457 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1458 dropDownHeight: 500
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1459 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1460 $('#maddrowbutton').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1461 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1462 var datarecord, row = {}, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1463 datarecord = misclist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1464 row['m_name'] = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1465 row['m_amount'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1466 row['m_cost'] = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1467 row['m_type'] = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1468 row['m_use_use'] = datarecord.use_use;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1469 row['m_time'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1470 row['m_amount_is_weight'] = datarecord.amount_is_weight;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1471 row['m_inventory'] = datarecord.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1472 $('#miscGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1473 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1474 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1475 $('#minstockbutton').jqxCheckBox({ theme: theme, height: 27 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1476 $('#minstockbutton').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1477 miscinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1478 misclist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1479 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1480 // delete selected misc.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1481 $('#mdeleterowbutton').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
1482 $('#mdeleterowbutton').on('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1483 var rowscount, type, id, selectedrowindex = $('#miscGrid').jqxGrid('getselectedrowindex');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1484 rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1485 type = $('#miscGrid').jqxGrid('getcellvalue', selectedrowindex, 'm_type');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1486 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1487 id = $('#miscGrid').jqxGrid('getrowid', selectedrowindex);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1488 $('#miscGrid').jqxGrid('deleterow', id);
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 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1492 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1493 $('#jqxTabs').jqxTabs('next');
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 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1496 { text: 'Ingredient', datafield: 'm_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1497 { text: 'Type', width: 140, datafield: 'm_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1498 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1499 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
1500 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1501 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1502 { text: 'Gebruik', width: 140, datafield: 'm_use_use',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1503 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1504 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
1505 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1506 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1507 { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1508 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1509 var duration = '';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1510 if (rowdata.m_use_use == 2) // Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1511 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1512 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
1513 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1514 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
1515 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1516 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1517 { 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
1518 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1519 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
1520 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
1521 dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>';
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 { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1525 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1526 var amount, color = '#ffffff', vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1527 if (value < rowdata.m_amount)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1528 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1529 amount = dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1530 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
1531 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1532 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1533 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1534 cellsrenderer: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1535 return 'Wijzig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1536 }, buttonclick: function(row) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1537 miscRow = row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1538 miscData = $('#miscGrid').jqxGrid('getrowdata', miscRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1539 if (miscData.m_type == 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1540 alert('Brouwzouten wijzigen in de water tab.');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1541 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1542 if (miscData.m_amount_is_weight)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1543 $('#wm_pmpt_amount').html('Gewicht gram:');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1544 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1545 $('#wm_pmpt_amount').html('Volume ml:');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1546 $('#wm_name').val(miscData.m_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1547 $('#wm_amount').val(miscData.m_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1548 if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1549 $('#wm_time').val(miscData.m_time / 1440);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1550 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1551 $('#wm_time').val(miscData.m_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1552 $('#wm_use_use').val(miscData.m_use_use);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1553 // show the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1554 $('#popupMisc').jqxWindow('open');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1555 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1556 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1557 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1558 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1559 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1560 };
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
1561
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1562 // Inline yeasts editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1563 var editYeast = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1564 var yeastSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1565 localdata: data.yeasts,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1566 datatype: 'local',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1567 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1568 async: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1569 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1570 { name: 'y_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1571 { name: 'y_laboratory', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1572 { name: 'y_product_id', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1573 { name: 'y_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1574 { name: 'y_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1575 { name: 'y_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1576 { name: 'y_form', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1577 { name: 'y_flocculation', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1578 { name: 'y_min_temperature', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1579 { name: 'y_max_temperature', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1580 { name: 'y_attenuation', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1581 { name: 'y_use', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1582 { name: 'y_cells', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1583 { name: 'y_tolerance', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1584 { 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
1585 { 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
1586 { 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
1587 { 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
1588 { 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
1589 { 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
1590 { 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
1591 { name: 'y_zymocide', type: 'int' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1592 { name: 'y_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1593 ],
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1594 addrow: function(rowid, rowdata, position, commit) { commit(true); },
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1595 deleterow: function(rowid, commit) { commit(true); },
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1596 updaterow: function(rowid, rowdata, commit) { commit(true); }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1597 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1598 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
1599
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1600 $('#yeastGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1601 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1602 height: 350,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1603 source: yeastAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1604 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1605 selectionmode: 'singlerow',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1606 showtoolbar: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1607 rendertoolbar: function(toolbar) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1608 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
1609 toolbar.append(container);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1610 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1611 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1612 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1613 container.append('<input style="float: left; margin-left: 400px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1614 // add yeast from dropdownlist.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1615 $('#yaddrowbutton').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1616 placeHolder: 'Kies gist:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1617 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1618 source: yeastlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1619 template: 'primary',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1620 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1621 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1622 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1623 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1624 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1625 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1626 var datarecord = yeastlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1627 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1628 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1629 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1630 $('#yaddrowbutton').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1631 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1632 var datarecord, row = {}, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1633 datarecord = yeastlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1634 row['y_name'] = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1635 row['y_laboratory'] = datarecord.laboratory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1636 row['y_product_id'] = datarecord.product_id;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1637 row['y_type'] = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1638 row['y_form'] = datarecord.form;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1639 row['y_amount'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1640 row['y_cost'] = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1641 row['y_use'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1642 row['y_min_temperature'] = datarecord.min_temperature;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1643 row['y_max_temperature'] = datarecord.max_temperature;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1644 row['y_attenuation'] = datarecord.attenuation;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1645 row['y_flocculation'] = datarecord.flocculation;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1646 row['y_cells'] = datarecord.cells;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1647 row['y_tolerance'] = datarecord.tolerance;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1648 row['y_inventory'] = datarecord.inventory;
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
1649 row['y_sta1'] = datarecord.sta1;
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1650 row['y_bacteria'] = datarecord.bacteria;
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1651 row['y_harvest_top'] = datarecord.harvest_top;
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1652 row['y_harvest_time'] = datarecord.harvest_time;
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1653 row['y_pitch_temperature'] = datarecord.pitch_temperature;
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1654 row['y_pofpos'] = datarecord.pofpos;
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1655 row['y_zymocide'] = datarecord.zymocide;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1656 $('#yeastGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1657 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1658 $('#yaddrowbutton').jqxDropDownList('clearSelection');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1659 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1660 $('#yinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1661 $('#yinstockbutton').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1662 yeastinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1663 yeastlist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1664 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1665 // delete selected yeast.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1666 $('#ydeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1667 $('#ydeleterowbutton').on('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1668 var id, rowscount, selectedrowindex = $('#yeastGrid').jqxGrid('getselectedrowindex');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1669 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1670 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1671 id = $('#yeastGrid').jqxGrid('getrowid', selectedrowindex);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1672 $('#yeastGrid').jqxGrid('deleterow', id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1673 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1674 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1675 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1676 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1677 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1678 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1679 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1680 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1681 { text: 'Gist', datafield: 'y_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1682 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1683 { text: 'Code', width: 90, datafield: 'y_product_id' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1684 { text: 'Soort', width: 100, datafield: 'y_form',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1685 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1686 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
1687 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1688 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1689 { 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
1690 { 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
1691 { 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
1692 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1693 var amount = '', color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1694 if (value > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1695 amount = dataAdapter.formatNumber(value, 'f1');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1696 if (dataRecord.est_abv > value)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1697 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1698 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1699 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
1700 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1701 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1702 { 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
1703 { text: 'Voor', width: 120, datafield: 'y_use',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1704 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1705 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
1706 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1707 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1708 { 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
1709 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1710 var amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1711 if (rowdata.y_form == 0) // Liquid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1712 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1713 else if (rowdata.y_form == 1) // Dry
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1714 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1715 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
1716 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1717 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1718 { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1719 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1720 var color, amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1721 color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1722 if (value < rowdata.y_amount)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1723 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1724 amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1725 if (rowdata.y_form == 0) // Liquid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1726 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1727 else if (rowdata.y_form == 1) // Dry
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1728 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1729 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
1730 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1731 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1732 { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1733 cellsrenderer: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1734 return 'Wijzig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1735 }, buttonclick: function(row) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1736 yeastRow = row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1737 yeastData = $('#yeastGrid').jqxGrid('getrowdata', yeastRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1738 if (yeastData.y_form == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1739 $('#wy_pmpt_amount').html('Pak(ken):');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1740 $('#wy_amount').val(yeastData.y_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1741 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1742 } else if (yeastData.y_form == 1) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1743 $('#wy_pmpt_amount').html('Gewicht gram:');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1744 $('#wy_amount').val(yeastData.y_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1745 $('#wy_amount').jqxNumberInput({ decimalDigits: 1 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1746 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1747 $('#wy_pmpt_amount').html('Volume ml:');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1748 $('#wy_amount').val(yeastData.y_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1749 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1750 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1751 $('#wy_name').val(yeastData.y_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1752 $('#wy_laboratory').val(yeastData.y_laboratory);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1753 $('#wy_product_id').val(yeastData.y_product_id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1754 $('#wy_use').val(yeastData.y_use);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1755 // show the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1756 $('#popupYeast').jqxWindow('open');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1757 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1758 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1759 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1760 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1761 };
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
1762
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1763 // inline mash editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1764 var editMash = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1765 var mashSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1766 localdata: data.mashs,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1767 datatype: 'local',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1768 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1769 async: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1770 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1771 { name: 'step_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1772 { 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
1773 { name: 'step_volume', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1774 { 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
1775 { name: 'step_infuse_temp', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1776 { name: 'step_temp', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1777 { 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
1778 { name: 'step_wg_ratio', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1779 { name: 'ramp_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1780 { name: 'end_temp', type: 'float' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1781 ],
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
1782 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
1783 deleterow: function(rowid, commit) { commit(true); }
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 mashAdapter = new $.jqx.dataAdapter(mashSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1786 beforeLoadComplete: function(records) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1787 mash_infuse = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1788 var row, i, data = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1789 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1790 row = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1791 if (row.step_type == 0) // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1792 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
1793 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
1794 data.push(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1795 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1796 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1797 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1798 $('#mashGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1799 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1800 height: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1801 source: mashAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1802 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1803 selectionmode: 'singlerow',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1804 showtoolbar: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1805 rendertoolbar: function(toolbar) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1806 //var me = this;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1807 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
1808 toolbar.append(container);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1809 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
1810 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
1811 $('#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
1812 $('#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
1813 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
1814 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
1815 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
1816 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
1817 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
1818 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
1819 } 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
1820 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
1821 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
1822 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
1823 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1824 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
1825 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
1826 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
1827 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
1828 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
1829 row['end_temp'] = 62.0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1830 $('#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
1831 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1832 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1833 // delete selected yeast.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1834 $('#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
1835 $('#sdeleterowbutton').on('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1836 var id, rowscount, selectedrowindex = $('#mashGrid').jqxGrid('getselectedrowindex');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1837 rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1838 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1839 id = $('#mashGrid').jqxGrid('getrowid', selectedrowindex);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1840 $('#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
1841 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1842 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1843 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1844 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1845 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1846 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1847 calcInit();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1848 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1849 $('#jqxLoader').jqxLoader('close');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1850 $('#jqxTabs').jqxTabs('first');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1851 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1852 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1853 { text: 'Stap naam', datafield: 'step_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1854 { text: 'Stap type', datafield: 'step_type', width: 175,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1855 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1856 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
1857 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1858 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1859 { 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
1860 { 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
1861 { 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
1862 { 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
1863 { 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
1864 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
1865 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
1866 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
1867 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
1868 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1869 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1870 { 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
1871 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
1872 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
1873 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
1874 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
1875 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1876 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1877 { 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
1878 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
1879 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
1880 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
1881 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
1882 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
1883 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1884 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1885 { 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
1886 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
1887 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
1888 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
1889 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
1890 }, 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
1891 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
1892 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
1893 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1894 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1895 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1896 { 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
1897 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
1898 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
1899 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
1900 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
1901 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
1902 }, 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
1903 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
1904 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
1905 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
1906 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1907 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1908 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1909 { 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
1910 cellsrenderer: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1911 return 'Wijzig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1912 }, buttonclick: function(row) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1913 mashRow = row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1914 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
1915 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
1916 $("#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
1917 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
1918 $("#wstep_type").jqxDropDownList('enableAt', 2);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1919 $('#wstep_name').val(mashData.step_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1920 $('#wstep_type').val(mashData.step_type);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1921 $('#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
1922 $('#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
1923 $('#wstep_temp').val(mashData.step_temp);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1924 $('#wend_temp').val(mashData.end_temp);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1925 $('#wstep_time').val(mashData.step_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1926 $('#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
1927 $('#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
1928 $('#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
1929 $('#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
1930 $('#wstep_pmpt_temp').hide();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1931 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
1932 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
1933 $('#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
1934 $('#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
1935 } 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
1936 $('#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
1937 $('#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
1938 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1939 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1940 // show the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1941 $('#popupMash').jqxWindow('open');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1942 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1943 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1944 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1945 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1946 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1947
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1950
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1951 /*
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1952 * 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
1953 */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1954 $('#jqxMenu').jqxMenu('destroy');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1955
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1956 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
1957 $('#jqxLoader').jqxLoader({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1958 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1959 height: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1960 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1961 text: 'Laden recept ...',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1962 theme: theme
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1963 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1964
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1965 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
1966
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1967 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
1968 if (amount == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1969 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1970 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1971 if (row.m_name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1972 id = $('#miscGrid').jqxGrid('getrowid', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1973 $('#miscGrid').jqxGrid('deleterow', id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1974 }
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 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1977 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1978 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1979 if (row.m_name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1980 found = true;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1981 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount / 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1982 break;
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 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1985 if (! found) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1986 miscs = new $.jqx.dataAdapter(miscInvSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1987 loadComplete: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1988 records = miscs.records;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1989 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1990 record = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1991 if (record.name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1992 row = {};
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1993 row['m_name'] = record.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1994 row['m_amount'] = amount / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1995 row['m_cost'] = record.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1996 row['m_type'] = record.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1997 row['m_use_use'] = record.use_use;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1998 row['m_time'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1999 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
2000 row['m_inventory'] = record.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2001 row['m_avail'] = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2002 $('#miscGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2003 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2004 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2005 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2006 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2007 miscs.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2008 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2009 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2010 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2011 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2012
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2013
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2014 // Procedure TFrmWaterAdjustment.CalcWater2;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2015 function calcWater() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2016
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
2017 if (! data_loaded) {
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
2018 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
2019 return;
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
2020 }
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
2021
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2022 var liters = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2023 calcium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2024 magnesium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2025 sodium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2026 total_alkalinity = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2027 bicarbonate = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2028 chloride = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2029 sulfate = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2030 ph = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2031 RA = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2032 frac = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2033 TpH = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2034 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
2035 AT, BT,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2036 r1d, r2d, f1d, f2d, f3d,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2037 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
2038 Res;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2039
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2040 if (dataRecord.w1_name == '') {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2041 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2042 }
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
2043
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2044 // 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
2045 if (dataRecord.w2_name != '') {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2046 liters = dataRecord.w1_amount + dataRecord.w2_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2047 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
2048 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
2049 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
2050 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
2051 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
2052 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
2053 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
2054 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2055 liters = dataRecord.w1_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2056 calcium = dataRecord.w1_calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2057 magnesium = dataRecord.w1_magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2058 sodium = dataRecord.w1_sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2059 chloride = dataRecord.w1_chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2060 sulfate = dataRecord.w1_sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2061 total_alkalinity = dataRecord.w1_total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2062 ph = dataRecord.w1_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2063 }
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
2064 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
2065
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
2066 /* 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
2067 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
2068 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
2069 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
2070 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
2071 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
2072 var wg_bicarbonate = bicarbonate;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2073
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
2074 $('#wg_amount').val(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
2075 $('#wg_calcium').val(Math.round(calcium * 10) / 10);
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
2076 $('#wg_magnesium').val(Math.round(magnesium * 10) / 10);
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
2077 $('#wg_sodium').val(Math.round(sodium * 10) / 10);
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
2078 $('#wg_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10);
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
2079 $('#wg_chloride').val(Math.round(chloride * 10) / 10);
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
2080 $('#wg_sulfate').val(Math.round(sulfate * 10) / 10);
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
2081 $('#wg_ph').val(Round(ph, 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2082
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
2083 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
2084 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
2085
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
2086 /* 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
2087 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
2088 calcium += (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 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
2089 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 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
2090 magnesium += (parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMMg / 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
2091 sodium += (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 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
2092 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 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
2093 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
2094 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
2095 chloride += (2 * parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 * 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
2096 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl * 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
2097 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2098
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
2099 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
2100 $('#wa_acid_name').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2101 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
2102 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
2103 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2104 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2105 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
2106 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
2107
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
2108 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
2109 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
2110 $('#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
2111 }
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
2112
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
2113 if (dataRecord.wa_base_name < 0 || dataRecord.wa_base_name > 3) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2114 $('#wa_base_name').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2115 dataRecord.wa_base_name = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2116 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2117 if (last_base == '')
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
2118 last_base = BaseTypeData[dataRecord.wa_base_name].nl;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2119
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2120 AT = dataRecord.wa_acid_name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2121 BT = dataRecord.wa_base_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
2122
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
2123 /* 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
2124 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
2125
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2126 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
2127 $('.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
2128 /* Auto calculate pH */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2129 TpH = parseFloat(dataRecord.mash_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2130 protonDeficit = ProtonDeficit(TpH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2131 console.log('calc_acid tgt: ' + TpH + ' protonDeficit: ' + protonDeficit);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2132 if (protonDeficit > 0) { // Add acid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2133 $('#wa_base').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2134 setWaterAgent(last_base, 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
2135 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
2136 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
2137 Acid *= AcidTypeData[AT].MolWt; // mg
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2138 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
2139 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
2140 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
2141 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
2142 $('#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
2143 setWaterAgent(AcidTypeData[AT].nl, Acid);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2144
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2145 bicarbonate = bicarbonate - protonDeficit * frac / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2146 total_alkalinity = bicarbonate * 50 / 61;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2147 } else if (protonDeficit < 0) { //Add base
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2148 $('#wa_acid').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2149 setWaterAgent(last_acid, 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
2150 r1d = Math.pow(10, (TpH - 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
2151 r2d = Math.pow(10, (TpH - 10.33));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2152 f1d = 1 / (1 + r1d + r1d * r2d);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2153 f2d = f1d * r1d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2154 f3d = f2d * r2d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2155 switch (BT) {
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
2156 case 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
2157 RA = -protonDeficit / (f1d - f3d); //Sodiumbicarbonate, mmol totaal
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
2158 RA = RA * MMNaHCO3 / 1000; //gram
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
2159 $('#wa_base').val(Round(RA, 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
2160 setWaterAgent('NaHCO3', Round(RA, 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
2161 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
2162 // Na
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
2163 RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 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
2164 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 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
2165 sodium = wg_sodium + 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
2166 // HCO3
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
2167 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 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
2168 bicarbonate = wg_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
2169 total_alkalinity = bicarbonate * 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
2170 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
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
2171 }
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
2172 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
2173 case 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
2174 RA = -protonDeficit / (2 * f1d + f2d); // Sodiumcarbonate, mmol totaal
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
2175 RA = RA * MMNa2CO3 / 1000; //gram
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
2176 $('#wa_base').val(Round(RA, 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
2177 setWaterAgent('Na2CO3', Round(RA, 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
2178 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
2179 RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 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
2180 parseFloat($('#wa_base').jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3 * 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
2181 sodium = wg_sodium + 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
2182 // HCO3
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
2183 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3 * 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
2184 bicarbonate = wg_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
2185 total_alkalinity = bicarbonate * 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
2186 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
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
2187 }
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
2188 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
2189 case 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
2190 RA = -protonDeficit * (f1d - f3d); // Calciumcarbonate, mmol totaal
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
2191 RA = RA * MMCaCO3 / 1000; //gram
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
2192 //but only 1/3 is effective, so add 3 times as much
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
2193 RA = 3 * 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
2194 $('#wa_base').val(Round(RA, 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
2195 setWaterAgent('CaCO3', Round(RA, 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
2196 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
2197 //Bicarbonate
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
2198 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3 * 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
2199 bicarbonate = wg_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
2200 total_alkalinity = bicarbonate * 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
2201 //Ca precipitates out as Ca10(PO4)6(OH)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
2202 RA = (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 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
2203 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / 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
2204 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaCO3 * 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
2205 calcium = wg_calcium + 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
2206 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
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
2207 }
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
2208 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
2209 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
2210 RA = -protonDeficit / 19.3; // Calciumhydroxide
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
2211 $('#wa_base').val(Round(RA, 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
2212 setWaterAgent('Ca(OH)2', Round(RA, 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
2213 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
2214 // Bicarbonate
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
2215 RA = -protonDeficit / 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
2216 total_alkalinity = wg_total_alkalinity + 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
2217 bicarbonate = total_alkalinity * 61 / 50;
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
2218 // 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
2219 RA = (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 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
2220 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / 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
2221 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaOH2 * 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
2222 calcium = wg_calcium + 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
2223 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
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
2224 }
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
2225 break;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2226 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2227 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2228 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
2229 $('#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
2230 $('#est_mash_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2231 } 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
2232 /* 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
2233 $('.c_mashph').hide();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2234 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
2235 if (parseFloat($('#wa_base').jqxNumberInput('decimal')) > 0 && 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
2236 /* First add the base 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
2237 switch (BT) {
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
2238 case 0: // Sodiumbicarbonate, Na
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
2239 RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 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
2240 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 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
2241 sodium = wg_sodium + 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
2242 // HCO3
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
2243 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 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
2244 bicarbonate = wg_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
2245 total_alkalinity = bicarbonate * 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
2246 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
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
2247 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
2248 case 1: // Sodiumcarbonate
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
2249 RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 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
2250 parseFloat($('#wa_base').jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3 * 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
2251 sodium = wg_sodium + 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
2252 // HCO3
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
2253 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3 * 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
2254 bicarbonate = wg_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
2255 total_alkalinity = bicarbonate * 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
2256 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
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
2257 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
2258 case 2: // Calciumcarbonate: Bicarbonate
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
2259 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 * 1000 / MMCaCO3) / 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
2260 bicarbonate = wg_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
2261 total_alkalinity = bicarbonate * 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
2262 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
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
2263 // Ca
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
2264 RA = (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa * 1000 / MMCaCl2 +
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
2265 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa * 1000 / MMCaSO4 +
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
2266 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa * 1000 / MMCaCO3) / 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
2267 calcium = wg_calcium + 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
2268 break;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2269 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2270 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2271
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
2272 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
2273 // 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
2274 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
2275 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
2276 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
2277 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
2278 Acidmg = Acid;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2279
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
2280 //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
2281 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
2282 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
2283 //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
2284
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
2285 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
2286 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
2287 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
2288 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
2289 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
2290 n++;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2291 if (pd < (protonDeficit - deltapd))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2292 pHa -= deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2293 else if (pd > (protonDeficit + deltapd))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2294 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
2295 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
2296 protonDeficit = Acid * frac;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2297 pd = ProtonDeficit(pHa);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2298 }
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
2299 //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
2300 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
2301 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
2302 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
2303 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
2304 $('#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
2305 $('#est_mash_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2306 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2307
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2308 if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2309 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2310 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2311 Acidmg / 1000 * MMSO4 / (MMSO4 + 2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2312 RA = 1000 * RA / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2313 sulfate = wg_sulfate + RA; // Not add to sulfate??
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2314 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2315 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2316 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2317 Acidmg / 1000 * MMCl / (MMCl + 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2318 RA = 1000 * RA / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2319 chloride = wg_chloride + RA;
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
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
2322 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
2323 $('#tgt_bu').val(Round(BUGU, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2324 // 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
2325 if (BUGU < 0.32)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2326 $('#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
2327 else if (BUGU < 0.43)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2328 $('#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
2329 else if (BUGU < 0.52)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2330 $('#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
2331 else if (BUGU < 0.63)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2332 $('#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
2333 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2334 $('#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
2335
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
2336 // 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
2337 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
2338 $('#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
2339 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
2340 $('#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
2341 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
2342 $('#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
2343 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
2344 $('#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
2345 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
2346 $('#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
2347 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
2348 $('#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
2349 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
2350 $('#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
2351 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
2352 $('#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
2353 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
2354 $('#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
2355 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
2356 RA = sulfate / chloride;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2357 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2358 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
2359 $('#got_so4_cl').val(Round(RA, 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2360 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
2361 if (RA < (0.8 * OptSO4Clratio))
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2362 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
2363 else if (RA > (1.2 * OptSO4Clratio))
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2364 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
2365 setRangeIndicator('so4_cl', Res);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2366
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2367 $('#wb_calcium').val(Round(calcium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2368 $('#wb_magnesium').val(Round(magnesium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2369 $('#wb_sodium').val(Round(sodium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2370 $('#wb_sulfate').val(Round(sulfate, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2371 $('#wb_chloride').val(Round(chloride, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2372 $('#wb_total_alkalinity').val(Round(total_alkalinity, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2373
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2374 if (calcium < 40) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2375 setRangeIndicator('calcium', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2376 } else if (calcium > 150) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2377 setRangeIndicator('calcium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2378 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2379 setRangeIndicator('calcium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2380 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2381 if (magnesium >= 0 && magnesium <= 30) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2382 setRangeIndicator('magnesium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2383 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2384 setRangeIndicator('magnesium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2385 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2386 if (sodium <= 150) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2387 setRangeIndicator('sodium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2388 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2389 setRangeIndicator('sodium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2390 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2391 // 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
2392 // 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
2393 if (chloride <= 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2394 setRangeIndicator('chloride', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2395 } else if (chloride <= 100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2396 setRangeIndicator('chloride', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2397 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2398 setRangeIndicator('chloride', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2399 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2400 if (sulfate <= 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2401 setRangeIndicator('sulfate', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2402 } else if (sulfate <= 350) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2403 setRangeIndicator('sulfate', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2404 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2405 setRangeIndicator('sulfate', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2406 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2407 if (ph < 5.2) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2408 setRangeIndicator('ph', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2409 } else if (ph > 5.6) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2410 setRangeIndicator('ph', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2411 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2412 setRangeIndicator('ph', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2413 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2414 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2415 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2416
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
2417
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2418 function calcSparge() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2419
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
2420 /* 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
2421 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
2422 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
2423 var Source_alkalinity = dataRecord.w1_total_alkalinity;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2424 // Select watersource or fallback to the first source.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2425 if (dataRecord.sparge_source == 1) { // Source 2
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2426 if (dataRecord.w2_ph > 0.0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2427 Source_pH = dataRecord.w2_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2428 Source_alkalinity = dataRecord.w2_total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2429 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2430 dataRecord.sparge_source = 0; // Source 1
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2431 $('#sparge_source').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2432 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2433 } else if (dataRecord.sparge_source == 2) { // Mixed
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2434 if (dataRecord.w2_ph > 0.0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2435 Source_pH = parseFloat($('#wg_ph').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2436 Source_alkalinity = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2437 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2438 dataRecord.sparge_source = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2439 $('#sparge_source').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2440 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2441 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2442
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2443 // 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
2444 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
2445 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
2446 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
2447 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
2448 var f3 = r1 * r2 / d;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2449
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2450 //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
2451 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
2452 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
2453 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
2454 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
2455 var f343 = r143 * r243 / d43;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2456
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2457 //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
2458 //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
2459 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
2460
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2461 //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
2462 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
2463 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
2464 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
2465 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
2466 var f3g = r1g * r2g / dg;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2467
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2468 //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
2469 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
2470 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
2471
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2472 //Step 8. Get the acid data.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2473 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
2474 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
2475 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
2476 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
2477 $('#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
2478 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
2479 $('#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
2480 }
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
2481 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
2482
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2483 //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
2484 Acid /= fract;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2485
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2486 //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
2487 Acid *= AcidTypeData[AT].MolWt; //mg
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2488
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
2489 //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
2490 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
2491 Acid *= dataRecord.sparge_volume; //ml acid total
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2492 Acid = Round(Acid, 2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2493 dataRecord.sparge_acid_amount = Acid / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2494 $('#sparge_acid_amount').val(Acid);
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2497 /*
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2498 * Change OG of recipe but keep the water volumes.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2499 */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2500 function calcFermentablesFromOG(OG) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2501
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2502 console.log('calcFermentablesFromOG(' + OG + ')');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2503 var amount, row, d, i, sug, tot = 0, totmass = 0, rowscount, efficiency = parseFloat($('#efficiency').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2504 sug = sg_to_plato(OG) * parseFloat($('#batch_size').jqxNumberInput('decimal')) * OG / 100; //total amount of sugars in kg
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2505 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2506
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2507 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2508 row = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2509 if (row.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2510 d = row.f_percentage / 100 * (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
2511 if (row.f_added == 0) // Mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2512 d = efficiency / 100 * d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2513 tot += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2514 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2515 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2516 if (tot)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2517 totmass = Math.round((sug / tot) * 1000) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2518
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2519 if (totmass) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2520 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2521 row = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2522 if (row.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2523 amount = Math.round(row.f_percentage * 10 * totmass) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2524 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2525 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2526 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2527 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2528 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2529
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2530 function calcInit() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2531 console.log('calc.init()');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2532
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2533 $('#calc_acid').on('checked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2534 dataRecord.calc_acid = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2535 calcWater();
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 $('#calc_acid').on('unchecked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2538 dataRecord.calc_acid = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2539 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2540 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2541 $('#w1_name').jqxDropDownList('selectItem', dataRecord.w1_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2542 $('#w2_name').jqxDropDownList('selectItem', dataRecord.w2_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2543 // 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
2544 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
2545 $('#w1_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2546 dataRecord.w1_amount = mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2547 $('#wg_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2548 $('#w2_amount').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2549 dataRecord.w2_amount = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2550 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2551 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2552 $('#w2_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2553 var newval = parseFloat(event.args.value);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2554
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2555 if (newval > mash_infuse) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2556 $('#w2_amount').val(dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2557 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2558 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2559 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
2560 $('#w1_amount').val(dataRecord.w1_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2561 dataRecord.w2_amount = newval;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2562 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
2563 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2564 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2565 $('#wa_cacl2').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2566 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2567 setWaterAgent('CaCl2', 0); // This can prevent double entries.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2568 setWaterAgent('CaCl2', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2569 calcWater();
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 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2572 $('#wa_caso4').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2573 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2574 setWaterAgent('CaSO4', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2575 setWaterAgent('CaSO4', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2576 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2577 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2578 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2579 $('#wa_mgso4').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2580 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2581 setWaterAgent('MgSO4', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2582 setWaterAgent('MgSO4', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2583 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2584 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2585 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2586 $('#wa_nacl').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2587 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2588 setWaterAgent('NaCl', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2589 setWaterAgent('NaCl', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2590 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2591 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2592 });
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
2593 $('#wa_base_name').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2594 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2595 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2596 setWaterAgent(last_base, 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2597 last_base = BaseTypeData[index].nl;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2598 setWaterAgent(last_base, parseFloat($('#wa_base').jqxNumberInput('decimal')));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2599 dataRecord.wa_base_name = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2600 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2601 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2602 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2603 $('#wa_base').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2604 var name = BaseTypeData[$('#wa_base_name').val()].nl;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2605 setWaterAgent(name, parseFloat(event.args.value));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2606 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2607 });
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
2608 $('#wa_acid_name').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2609 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2610 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2611 setWaterAgent(last_acid, 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2612 last_acid = AcidTypeData[index].nl;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2613 setWaterAgent(last_acid, parseFloat($('#wa_acid').jqxNumberInput('decimal')));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2614 dataRecord.wa_acid_name = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2615 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2616 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2617 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2618 $('#wa_acid').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2619 var name = AcidTypeData[$('#wa_acid_name').val()].nl;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2620 setWaterAgent(name, parseFloat(event.args.value));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2621 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2622 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2623 $('#wa_acid_perc').on('change', function(event) { calcWater(); });
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
2624
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
2625 $('#color_method').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2626 dataRecord.color_method = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2627 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2628 });
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
2629 $('#ibu_method').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2630 dataRecord.ibu_method = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2631 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2632 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2633 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2634 $('#batch_size').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2635 console.log('batch_size change:' + event.args.value + ' old:' + dataRecord.batch_size);
660
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2636 var evap = (0.1 * parseFloat(event.args.value)) * dataRecord.boil_time / 60;
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2637 dataRecord.boil_size = parseFloat(event.args.value) + evap;
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2638 var factor = parseFloat(event.args.value) / dataRecord.batch_size;
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2639 $('#boil_size').val(Round(dataRecord.boil_size, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2640 dataRecord.sparge_volume *= factor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2641 $('#sparge_volume').val(dataRecord.sparge_volume);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2642 dataRecord.batch_size = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2643 calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2644 adjustWaters(factor);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2645 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2646 adjustHops(factor);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2647 adjustMiscs(factor);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2648 adjustYeasts(factor);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2649 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2650 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2651 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2652 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2653 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2654 $('#boil_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2655 console.log('boil_time change:' + parseFloat(event.args.value) + ' old:' + dataRecord.boil_time);
660
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2656 var new_evap = (0.1 * parseFloat(dataRecord.batch_size)) * parseFloat(event.args.value) / 60;
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2657 dataRecord.boil_size = parseFloat(dataRecord.batch_size) + new_evap;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2658 dataRecord.boil_time = parseFloat(event.args.value);
660
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2659 $('#boil_size').val(Round(dataRecord.boil_size, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2660 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2661 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2662 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2663 $('#efficiency').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2664 var estog = parseFloat($('#est_og').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2665 dataRecord.efficiency = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2666 console.log('efficiency change:' + dataRecord.efficiency);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2667 calcFermentablesFromOG(estog); // Keep the OG
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2668 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2669 calcIBUs();
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 $('#est_og').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2672 dataRecord.est_og = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2673 console.log('est_og change:' + dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2674 calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2675 calcFermentables(); // Update the recipe details
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2676 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2677 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2678 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2679 $('#mash_ph').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2680 dataRecord.mash_ph = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2681 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2682 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2683
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2684 $('#sparge_ph').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2685 dataRecord.sparge_ph = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2686 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2687 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2688 $('#sparge_volume').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2689 dataRecord.sparge_volume = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2690 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2691 });
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
2692 $('#sparge_source').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2693 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2694 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2695 dataRecord.sparge_source = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2696 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2697 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2698 });
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
2699 $('#sparge_acid_type').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2700 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2701 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2702 dataRecord.sparge_acid_type = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2703 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
2704 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2705 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2706 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2707 $('#sparge_acid_perc').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2708 dataRecord.sparge_acid_perc = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2709 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2710 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2711 $('#locked').on('checked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2712 dataRecord.locked = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2713 setReadonly(true);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2714 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2715 $('#locked').on('unchecked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2716 dataRecord.locked = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2717 setReadonly(false);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2718 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2719 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2720
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2721 $('#styleSelect').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2722 placeHolder: 'Kies bierstijl:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2723 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2724 source: styleslist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2725 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2726 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2727 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2728 dropDownVerticalAlignment: 'top',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2729 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2730 dropDownHeight: 350,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2731 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2732 var datarecord = styleslist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2733 return datarecord.style_guide + ' ' + datarecord.style_letter + ' ' + datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2734 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2735 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2736 $('#styleSelect').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2737 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2738 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2739 datarecord = styleslist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2740 $('#st_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2741 $('#st_category').val(datarecord.category);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2742 $('#st_category_number').val(datarecord.category_number);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2743 $('#st_letter').val(datarecord.style_letter);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2744 $('#st_guide').val(datarecord.style_guide);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2745 $('#st_type').val(StyleTypeData[datarecord.type].nl);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2746 $('#st_og_min').val(datarecord.og_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2747 $('#st_og_max').val(datarecord.og_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2748 $('#st_fg_min').val(datarecord.fg_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2749 $('#st_fg_max').val(datarecord.fg_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2750 $('#st_ibu_min').val(datarecord.ibu_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2751 $('#st_ibu_max').val(datarecord.ibu_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2752 $('#st_color_min').val(datarecord.color_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2753 $('#st_color_max').val(datarecord.color_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2754 $('#st_carb_min').val(datarecord.carb_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2755 $('#st_carb_max').val(datarecord.carb_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2756 $('#st_abv_min').val(datarecord.abv_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2757 $('#st_abv_max').val(datarecord.abv_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2758 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2759 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2760
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2761 function saveRecord(goback) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2762 var row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2763 record: my_record,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2764 uuid: dataRecord.uuid,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2765 name: $('#name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2766 locked: dataRecord.locked,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2767 notes: $('#notes').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2768 st_name: $('#st_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2769 st_letter: $('#st_letter').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2770 st_guide: $('#st_guide').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2771 st_type: dataRecord.st_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2772 st_category: $('#st_category').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2773 st_category_number: parseFloat($('#st_category_number').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2774 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
2775 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
2776 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
2777 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
2778 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
2779 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
2780 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
2781 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
2782 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
2783 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
2784 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
2785 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
2786 type: $('#type').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2787 batch_size: parseFloat($('#batch_size').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2788 boil_size: parseFloat($('#boil_size').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2789 boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2790 efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2791 est_og: parseFloat($('#est_og').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2792 est_fg: parseFloat($('#est_fg').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2793 est_abv: parseFloat($('#est_abv').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2794 est_color: parseFloat($('#est_color').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2795 color_method: $('#color_method').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2796 est_ibu: parseFloat($('#est_ibu').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2797 ibu_method: $('#ibu_method').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2798 est_carb: parseFloat($('#est_carb').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2799 mash_name: $('#mash_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2800 mash_ph: parseFloat($('#mash_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2801 sparge_temp: parseFloat($('#sparge_temp').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2802 sparge_ph: parseFloat($('#sparge_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2803 sparge_volume: parseFloat($('#sparge_volume').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2804 sparge_source: $('#sparge_source').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2805 sparge_acid_type: $('#sparge_acid_type').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2806 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
2807 sparge_acid_amount: dataRecord.sparge_acid_amount,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2808 calc_acid: dataRecord.calc_acid,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2809 w1_name: $('#w1_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2810 w1_amount: parseFloat($('#w1_amount').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2811 w1_calcium: parseFloat($('#w1_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2812 w1_sulfate: parseFloat($('#w1_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2813 w1_chloride: parseFloat($('#w1_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2814 w1_sodium: parseFloat($('#w1_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2815 w1_magnesium: parseFloat($('#w1_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2816 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
2817 w1_ph: parseFloat($('#w1_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2818 w1_cost: dataRecord.w1_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2819 w2_name: $('#w2_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2820 w2_amount: parseFloat($('#w2_amount').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2821 w2_calcium: parseFloat($('#w2_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2822 w2_sulfate: parseFloat($('#w2_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2823 w2_chloride: parseFloat($('#w2_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2824 w2_sodium: parseFloat($('#w2_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2825 w2_magnesium: parseFloat($('#w2_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2826 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
2827 w2_ph: parseFloat($('#w2_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2828 w2_cost: dataRecord.w2_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2829 wg_amount: parseFloat($('#wg_amount').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2830 wg_calcium: parseFloat($('#wg_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2831 wg_sulfate: parseFloat($('#wg_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2832 wg_chloride: parseFloat($('#wg_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2833 wg_sodium: parseFloat($('#wg_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2834 wg_magnesium: parseFloat($('#wg_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2835 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
2836 wg_ph: parseFloat($('#wg_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2837 wb_calcium: parseFloat($('#wb_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2838 wb_sulfate: parseFloat($('#wb_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2839 wb_chloride: parseFloat($('#wb_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2840 wb_sodium: parseFloat($('#wb_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2841 wb_magnesium: parseFloat($('#wb_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2842 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
2843 wb_ph: parseFloat($('#wb_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2844 wa_acid_name: $('#wa_acid_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2845 wa_acid_perc: parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2846 wa_base_name: $('#wa_base_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2847 fermentables: $('#fermentableGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2848 hops: $('#hopGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2849 miscs: $('#miscGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2850 yeasts: $('#yeastGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2851 mashs: $('#mashGrid').jqxGrid('getrows')
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2852 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2853 data = 'update=true&' + $.param(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2854 $.ajax({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2855 dataType: 'json',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2856 url: url,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2857 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2858 async: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2859 data: data,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2860 type: 'POST',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2861 success: function(data, status, xhr) {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2862 console.log('saveRecord(' + goback + ') success');
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2863 if (goback)
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2864 window.location.href = my_return;
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2865 else
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2866 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
2867 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2868 error: function(jqXHR, textStatus, errorThrown) {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2869 console.log('saveRecord() ' + textStatus);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2870 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2871 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2872 };
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2873
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2874 dataAdapter.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2875
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2876 // initialize the input fields.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2877 // Tab 1, Algemeen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2878 $('#name').jqxTooltip({ content: 'De naam voor dit recept.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2879 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2880 $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2881 $('#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
2882 $('#notes').jqxInput({ theme: theme, width: 960, height: 200 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2883 $('#type').jqxTooltip({ content: 'Het brouw type van dit recept.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2884 $('#type').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2885 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2886 source: RecipeTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2887 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2888 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2889 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2890 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2891 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2892 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2893 $('#efficiency').jqxTooltip({ content: 'Het rendement van maischen en koken.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2894 $('#efficiency').jqxNumberInput(Perc1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2895 $('#batch_size').jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2896 $('#batch_size').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2897 $('#batch_size').jqxNumberInput({ min: 4 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2898 $('#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
2899 $('#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
2900 $('#boil_time').jqxTooltip({ content: 'De kooktijd in minuten.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2901 $('#boil_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2902 $('#boil_time').jqxNumberInput({ min: 4, max: 360 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2903
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2904 $('#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
2905 $('#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
2906 $('#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
2907 $('#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
2908 $('#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
2909 $('#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
2910 $('#st_category').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2911 $('#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
2912 $('#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
2913 $('#st_category_number').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2914 $('#st_type').jqxTooltip({ content: 'Het bierstijl type.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2915 $('#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
2916
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2917 $('#est_og').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
2918 $('#est_og').jqxNumberInput(SGopts);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2919 $('#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
2920 $('#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
2921 $('#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
2922 $('#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
2923
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2924 $('#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
2925 $('#est_fg').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2926 $('#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
2927 $('#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
2928 $('#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
2929 $('#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
2930
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2931 $('#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
2932 $('#est_abv').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2933 $('#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
2934 $('#st_abv_min').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2935 $('#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
2936 $('#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
2937
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2938 $('#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
2939 $('#est_color').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2940 $('#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
2941 $('#st_color_min').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2942 $('#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
2943 $('#st_color_max').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2944 $('#color_method').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2945 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2946 source: ColorMethodAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2947 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2948 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2949 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2950 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2951 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2952 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2953 $('#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
2954 $('#est_ibu').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2955 $('#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
2956 $('#st_ibu_min').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2957 $('#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
2958 $('#st_ibu_max').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2959 $('#ibu_method').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2960 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2961 source: IBUmethodAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2962 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2963 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2964 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2965 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2966 autoDropDownHeight: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2967 dropDownVerticalAlignment: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2968 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2969 $('#kcal').jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2970 $('#kcal').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2971 $('#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
2972 $('#est_carb').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2973 $('#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
2974 $('#st_carb_min').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2975 $('#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
2976 $('#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
2977
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2978 // Tab 2, Vergistbaar
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2979 $('#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
2980 $('#est_color2').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2981 $('#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
2982 $('#est_og2').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2983 $('#perc_malts').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2984 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2985 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2986 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2987 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2988 max: 120,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2989 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2990 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2991 { stop: 90, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2992 { stop: 100, color: '#EB7331' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2993 { stop: 120, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2994 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2995 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2996 return (Math.round(parseInt(text) * 1.2)) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2997 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2998 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2999 $('#perc_sugars').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3000 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3001 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3002 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3003 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3004 max: 50,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3005 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3006 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3007 { stop: 20, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3008 { stop: 50, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3009 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3010 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3011 return (Math.round(parseInt(text) * 5) / 10) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3012 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3013 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3014 $('#perc_cara').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3015 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3016 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3017 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3018 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3019 max: 50,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3020 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3021 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3022 { stop: 25, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3023 { stop: 50, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3024 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3025 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3026 return (Math.round(parseInt(text) * 5) / 10) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3027 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3028 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3029 $('#ferm_lintner').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3030 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3031 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3032 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3033 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3034 max: 200,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3035 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3036 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3037 { stop: 30, color: '#FF0000' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3038 { stop: 40, color: '#EB7331' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3039 { stop: 200, color: '#008C00' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3040 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3041 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3042 return (parseInt(text) * 2) + ' lintner';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3043 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3044 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3045 $('#popupFermentable').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3046 width: 800,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3047 height: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3048 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3049 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3050 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3051 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3052 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3053 cancelButton: $('#FermentableReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3054 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3055 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3056 $('#FermentableReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3057 $('#FermentableReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3058 var row, rowID = $('#fermentableGrid').jqxGrid('getrowid', fermentableRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3059 console.log('FermentableReady row:' + fermentableRow + ' ID:' + rowID);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3060 row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3061 f_name: fermentableData.f_name,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3062 f_origin: fermentableData.f_origin,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3063 f_supplier: fermentableData.f_supplier,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3064 f_amount: fermentableData.f_amount,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3065 f_cost: fermentableData.f_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3066 f_type: fermentableData.f_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3067 f_yield: fermentableData.f_yield,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3068 f_color: fermentableData.f_color,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3069 f_coarse_fine_diff: fermentableData.f_coarse_fine_diff,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3070 f_moisture: fermentableData.f_moisture,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3071 f_diastatic_power: fermentableData.f_diastatic_power,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3072 f_protein: fermentableData.f_protein,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3073 f_max_in_batch: fermentableData.f_max_in_batch,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3074 f_graintype: fermentableData.f_graintype,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3075 f_added: fermentableData.f_added,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3076 f_dissolved_protein: fermentableData.f_dissolved_protein,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3077 f_recommend_mash: fermentableData.f_recommend_mash,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3078 f_add_after_boil: fermentableData.f_add_after_boil,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3079 f_adjust_to_total_100: fermentableData.f_adjust_to_total_100,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3080 f_percentage: fermentableData.f_percentage,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3081 f_di_ph: fermentableData.f_di_ph,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3082 f_acid_to_ph_57: fermentableData.f_acid_to_ph_57,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3083 f_inventory: fermentableData.f_inventory,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3084 f_avail: fermentableData.f_avail
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3085 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3086 $('#fermentableGrid').jqxGrid('updaterow', rowID, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3087 calcPercentages();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3088 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3089 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3090 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3091 // Waters: yes there is impact.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3092 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3093 $('#wf_name').jqxInput({ theme: theme, width: 320, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3094 $('#wf_instock').jqxCheckBox({ theme: theme, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3095 $('#wf_instock').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3096 fermentableinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3097 fermentablelist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3098 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3099 $('#wf_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3100 placeHolder: 'Kies mout:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3101 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3102 source: fermentablelist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3103 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3104 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3105 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3106 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3107 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3108 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3109 var datarecord = fermentablelist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3110 return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC)';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3111 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3112 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3113 $('#wf_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3114 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3115 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3116 datarecord = fermentablelist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3117 $('#wf_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3118 fermentableData.f_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3119 fermentableData.f_origin = datarecord.origin;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3120 fermentableData.f_supplier = datarecord.supplier;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3121 fermentableData.f_type = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3122 fermentableData.f_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3123 fermentableData.f_yield = datarecord.yield;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3124 fermentableData.f_color = datarecord.color;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3125 fermentableData.f_coarse_fine_diff = datarecord.coarse_fine_diff;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3126 fermentableData.f_moisture = datarecord.moisture;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3127 fermentableData.f_diastatic_power = datarecord.diastatic_power;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3128 fermentableData.f_protein = datarecord.protein;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3129 fermentableData.f_max_in_batch = datarecord.max_in_batch;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3130 fermentableData.f_graintype = datarecord.graintype;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3131 fermentableData.f_dissolved_protein = datarecord.dissolved_protein;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3132 fermentableData.f_recommend_mash = datarecord.recommend_mash;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3133 fermentableData.f_add_after_boil = datarecord.add_after_boil;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3134 fermentableData.f_di_ph = datarecord.di_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3135 fermentableData.f_acid_to_ph_57 = datarecord.acid_to_ph_57;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3136 fermentableData.f_inventory = datarecord.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3137 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3138 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3139 $('#wf_amount').jqxNumberInput(Spin3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3140 $('#wf_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3141 console.log('amount changed: ' + event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3142 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3143 fermentableData.f_amount = event.args.value;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3144 if (! to_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3145 calcPercentages();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3146 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3147 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3148 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3149 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3150 $('#wf_percentage').jqxNumberInput(Perc1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3151 $('#wf_percentage').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3152 var newperc, nw, damount, namount, rowscount, rowdata, diff, tw, i, newvalue,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3153 oldvalue = Round(fermentableData.f_percentage, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3154 newvalue = event.args.value;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3155 console.log('percentage changed: ' + newvalue + ' old: ' + oldvalue);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3156 fermentableData.f_percent = newvalue;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3157 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3158 if ((oldvalue != newvalue) && (rowscount > 1)) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3159 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3160 if (rowdata.f_adjust_to_total_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3161 $('#wf_percentage').val(oldvalue);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3162 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3163 diff = newvalue - oldvalue;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3164 tw = 0; // total weight
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3165 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3166 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3167 if (rowdata.f_added < 4)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3168 tw += Round(rowdata.f_amount, 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3169 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3170 tw = Round(tw, 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3171 if (to_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3172 // Adjust this row and the 100% row.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3173 damount = Math.round(tw * diff * 10) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3174 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3175 namount = Round((rowdata.f_amount + damount), 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3176 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', namount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3177 $('#wf_amount').val(namount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3178 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_percentage', rowdata.f_percentage + diff);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3179 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3180 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3181 if (rowdata.f_adjust_to_total_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3182 namount = rowdata.f_amount - damount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3183 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3184 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3185 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3186 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3187 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3188 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3189 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3190 // Adjust all the rows.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3191 nw = tw * diff / 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3192 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3193 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3194 if (rowdata.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3195 if (i == fermentableRow) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3196 namount = Math.round((rowdata.f_amount + nw) * 1000) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3197 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3198 // $('#wf_amount').val(namount); // Will crash the script.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3199 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newvalue);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3200 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3201 namount = Round((rowdata.f_amount - (nw / (rowscount - 1))), 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3202 newperc = Round((namount / tw) * 100, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3203 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3204 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newperc);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3205 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3206 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3207 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3208 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3209 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3210 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3211 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3212 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3213 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3214 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3215 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3216 $('#wf_max_in_batch').jqxNumberInput(Show1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3217 $('#wf_adjust_to_total_100').jqxCheckBox({ theme: theme, width: 120, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3218 $('#wf_adjust_to_total_100').on('checked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3219 if (fermentableData.f_adjust_to_total_100 == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3220 if (to_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3221 // Reset other flag first.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3222 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3223 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3224 if (i != fermentableRow) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3225 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_adjust_to_total_100', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3226 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3227 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3228 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3229 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3230 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3231 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3232 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3233 $('#wf_adjust_to_total_100').on('unchecked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3234 if (fermentableData.f_adjust_to_total_100 != 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3235 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3236 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3237 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3238 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3239 $('#wf_added').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3240 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3241 source: AddedAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3242 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3243 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3244 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3245 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3246 autoDropDownHeight: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3247 dropDownVerticalAlignment: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3248 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3249 $('#wf_added').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3250 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3251 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3252 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_added', index);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3253 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3254 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3255 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3256 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3257 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3258
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3259 // Tab 3, Hoppen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3260 $('#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
3261 $('#est_ibu2').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3262 $('#hop_flavour').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3263 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3264 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3265 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3266 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3267 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3268 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3269 { stop: 20, color: '#004D00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3270 { stop: 40, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3271 { stop: 60, color: '#00BF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3272 { stop: 80, color: '#00FF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3273 { stop: 100, color: '#80FF80' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3274 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3275 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3276 var val = parseInt(text);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3277 if (val < 20)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3278 return 'Weinig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3279 else if (val < 40)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3280 return 'Matig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3281 else if (val < 60)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3282 return 'Redelijk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3283 else if (val < 80)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3284 return 'Veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3285 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3286 return 'Zeer veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3287 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3288 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3289 $('#hop_aroma').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3290 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3291 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3292 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3293 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3294 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3295 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3296 { stop: 20, color: '#004D00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3297 { stop: 40, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3298 { stop: 60, color: '#00BF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3299 { stop: 80, color: '#00FF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3300 { stop: 100, color: '#80FF80' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3301 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3302 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3303 var val = parseInt(text);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3304 if (val < 20)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3305 return 'Weinig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3306 else if (val < 40)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3307 return 'Matig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3308 else if (val < 60)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3309 return 'Redelijk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3310 else if (val < 80)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3311 return 'Veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3312 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3313 return 'Zeer veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3314 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3315 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3316 $('#popupHop').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3317 width: 800,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3318 height: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3319 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3320 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3321 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3322 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3323 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3324 cancelButton: $('#HopReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3325 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3326 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3327 $('#HopReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3328 $('#HopReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3329 var row, rowID = $('#hopGrid').jqxGrid('getrowid', hopRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3330 console.log('HopReady row:' + hopRow + ' ID:' + rowID);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3331 row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3332 h_name: $('#wh_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3333 h_origin: hopData.h_origin,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3334 h_amount: parseFloat($('#wh_amount').jqxNumberInput('decimal')) / 1000,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3335 h_cost: hopData.h_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3336 h_type: hopData.h_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3337 h_form: hopData.h_form,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3338 h_useat: $('#wh_useat').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3339 h_time: hopData.h_time,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3340 h_alpha: hopData.h_alpha,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3341 h_beta: hopData.h_beta,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3342 h_hsi: hopData.h_hsi,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3343 h_humulene: hopData.h_humulene,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3344 h_caryophyllene: hopData.h_caryophyllene,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3345 h_cohumulone: hopData.h_cohumulone,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3346 h_myrcene: hopData.h_myrcene,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3347 h_total_oil: hopData.h_total_oil,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3348 h_inventory: hopData.h_inventory,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3349 h_avail: hopData.h_avail
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3350 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3351 $('#hopGrid').jqxGrid('updaterow', rowID, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3352 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3353 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3354 $('#wh_name').jqxInput({ theme: theme, width: 320, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3355 $('#wh_instock').jqxCheckBox({ theme: theme, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3356 $('#wh_instock').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3357 hopinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3358 hoplist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3359 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3360 $('#wh_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3361 placeHolder: 'Kies hop:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3362 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3363 source: hoplist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3364 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3365 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3366 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3367 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3368 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3369 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3370 var datarecord = hoplist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3371 return datarecord.origin + ' / ' + datarecord.name + ' (' + datarecord.alpha + ' % &alpha;)';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3372 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3373 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3374 $('#wh_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3375 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3376 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3377 datarecord = hoplist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3378 $('#wh_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3379 hopData.h_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3380 hopData.h_origin = datarecord.origin;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3381 hopData.h_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3382 hopData.h_type = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3383 hopData.h_form = datarecord.form;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3384 hopData.h_alpha = datarecord.alpha;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3385 hopData.h_beta = datarecord.beta;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3386 hopData.h_hsi = datarecord.hsi;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3387 hopData.h_humulene = datarecord.humulene;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3388 hopData.h_caryophyllene = datarecord.caryophyllene;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3389 hopData.h_cohumulone = datarecord.cohumulone;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3390 hopData.h_myrcene = datarecord.myrcene;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3391 hopData.h_total_oil = datarecord.total_oil;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3392 hopData.h_inventory = datarecord.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3393 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3394 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3395 $('#wh_amount').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3396 $('#wh_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3397 var ibu, amount = parseFloat(event.args.value) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3398 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
3399 amount, parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(), 0, parseFloat(hopData.h_time), 0);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3400 hopData.h_amount = amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3401 console.log('amount changed: ' + event.args.value + ' time:' + hopData.h_time + ' alpha:' + hopData.h_alpha + ' IBU:' + ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3402 $('#wh_ibu').val(ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3403 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3404 $('#wh_ibu').jqxNumberInput(Show1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3405 $('#wh_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3406 $('#wh_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3407 var ibu, newtime = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3408 // Check limits and correct
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3409 if (hopData.h_useat == 2) { // Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3410 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3411 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3412 $('#wh_time').val(newtime);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3413 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3414 hopData.h_time = newtime;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3415 } else if (hopData.h_useat == 4) { // Whirlpool
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3416 if (newtime > 120) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3417 newtime = 120;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3418 $('#wh_time').val(newtime);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3419 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3420 hopData.h_time = newtime;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3421 } else if (hopData.h_useat == 5) { // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3422 if (newtime > 21) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3423 newtime = 21;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3424 $('#wh_time').val(newtime);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3425 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3426 hopData.h_time = newtime * 1440;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3427 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3428 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
3429 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(), 0, parseFloat(hopData.h_time), 0);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3430 $('#wh_ibu').val(ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3431 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3432 $('#wh_useat').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3433 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3434 source: HopUseAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3435 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3436 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3437 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3438 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3439 autoDropDownHeight: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3440 dropDownVerticalAlignment: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3441 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3442 $('#wh_useat').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3443 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3444 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3445 hopData.h_useat = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3446 if ((index == 0) || (index == 1)) { // Mashhop or First wort hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3447 hopData.h_time = parseFloat(dataRecord.boil_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3448 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3449 $('#wh_time').val(hopData.h_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3450 } else if (index == 3) { // Aroma
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3451 hopData.h_time = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3452 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3453 $('#wh_time').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3454 } else { // Boil, Whirlpool or Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3455 $('#wh_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3456 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3457 if (index == 5) // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3458 $('#wh_pmpt_time').html('Tijd in dagen');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3459 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3460 $('#wh_pmpt_time').html('Tijd in minuten');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3461 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3462 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3463
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3464 // Tab 4, Diversen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3465 $('#popupMisc').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3466 width: 800,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3467 height: 275,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3468 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3469 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3470 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3471 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3472 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3473 cancelButton: $('#MiscReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3474 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3475 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3476 $('#MiscReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3477 $('#MiscReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3478 var row, rowID = $('#miscGrid').jqxGrid('getrowid', miscRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3479 console.log('MiscReady row:' + miscRow + ' ID:' + rowID);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3480 row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3481 m_name: miscData.m_name,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3482 m_amount: miscData.m_amount,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3483 m_cost: miscData.m_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3484 m_type: miscData.m_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3485 m_use_use: miscData.m_use_use,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3486 m_time: miscData.m_time,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3487 m_amount_is_weight: miscData.m_amount_is_weight,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3488 m_inventory: miscData.m_inventory,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3489 m_avail: miscData.m_avail
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3490 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3491 $('#miscGrid').jqxGrid('updaterow', rowID, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3492 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3493 $('#wm_name').jqxInput({ theme: theme, width: 320, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3494 $('#wm_instock').jqxCheckBox({ theme: theme, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3495 $('#wm_instock').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3496 miscinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3497 misclist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3498 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3499 $('#wm_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3500 placeHolder: 'Kies ingredi&euml;nt:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3501 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3502 source: misclist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3503 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3504 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3505 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3506 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3507 dropDownHeight: 500
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3508 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3509 $('#wm_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3510 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3511 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3512 datarecord = misclist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3513 $('#wm_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3514 miscData.m_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3515 miscData.m_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3516 miscData.m_type = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3517 miscData.m_use_use = datarecord.use_use;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3518 miscData.m_amount_is_weight = datarecord.amount_is_weight;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3519 miscData.m_inventory = datarecord.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3520 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3521 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3522 $('#wm_amount').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3523 $('#wm_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3524 console.log('amount changed: ' + event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3525 miscData.m_amount = parseFloat(event.args.value) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3526 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3527 $('#wm_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3528 $('#wm_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3529 console.log('time changed: ' + event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3530 var newtime = parseFloat(event.args.value);
225
ad2e1e3ccaca The miscs grid rebuild to use a popup editor for the rows.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
3531
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3532 if (miscData.m_use_use == 2) { // Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3533 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3534 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3535 $('#wm_time').val(newtime);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3536 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3537 miscData.m_time = newtime;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3538 } else if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) { // Primary or Secondary
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3539 if (newtime > 21) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3540 newtime = 21;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3541 $('#wm_time').val(newtime);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3542 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3543 miscData.m_time = newtime * 1440;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3544 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3545 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3546 $('#wm_use_use').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3547 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3548 source: MiscUseAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3549 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3550 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3551 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3552 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3553 autoDropDownHeight: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3554 dropDownVerticalAlignment: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3555 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3556 $('#wm_use_use').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3557 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3558 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3559 miscData.m_use_use = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3560 if ((index == 2) || (index == 3) || (index == 4)) { // Boil, Primary or Secondary
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3561 $('#wm_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3562 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3563 miscData.m_time = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3564 $('#wm_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3565 $('#wm_time').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3566 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3567 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3568 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3569
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3570 // Tab 5, Gist
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3571 $('#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
3572 $('#est_fg2').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3573 $('#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
3574 $('#est_abv2').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3575 $('#popupYeast').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3576 width: 800,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3577 height: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3578 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3579 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3580 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3581 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3582 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3583 cancelButton: $('#YeastReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3584 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3585 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3586 $('#YeastReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3587 $('#YeastReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3588 var row, rowID = $('#yeastGrid').jqxGrid('getrowid', yeastRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3589 console.log('YeastReady row:' + yeastRow + ' ID:' + rowID);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3590 row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3591 y_name: yeastData.y_name,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3592 y_laboratory: yeastData.y_laboratory,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3593 y_product_id: yeastData.y_product_id,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3594 y_amount: yeastData.y_amount,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3595 y_cost: yeastData.y_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3596 y_type: yeastData.y_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3597 y_form: yeastData.y_form,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3598 y_flocculation: yeastData.y_flocculation,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3599 y_min_temperature: yeastData.y_min_temperature,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3600 y_max_temperature: yeastData.y_max_temperature,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3601 y_attenuation: yeastData.y_attenuation,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3602 y_use: yeastData.y_use,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3603 y_cells: yeastData.y_cells,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3604 y_tolerance: yeastData.y_tolerance,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3605 y_inventory: yeastData.y_inventory,
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
3606 y_sta1: yeastData.y_sta1,
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
3607 y_bacteria: yeastData.y_bacteria,
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
3608 y_harvest_top: yeastData.y_harvest_top,
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
3609 y_harvest_time: yeastData.y_harvest_time,
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
3610 y_pitch_temperature: yeastData.y_pitch_temperature,
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
3611 y_pofpos: yeastData.y_pofpos,
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
3612 y_zymocide: yeastData.y_zymocide,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3613 y_avail: yeastData.y_avail
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3614 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3615 $('#yeastGrid').jqxGrid('updaterow', rowID, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3616 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3617 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3618 $('#wy_name').jqxInput({ theme: theme, width: 320, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3619 $('#wy_laboratory').jqxInput({ theme: theme, width: 320, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3620 $('#wy_product_id').jqxInput({ theme: theme, width: 320, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3621 $('#wy_instock').jqxCheckBox({ theme: theme, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3622 $('#wy_instock').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3623 yeastinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3624 yeastlist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3625 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3626 $('#wy_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3627 placeHolder: 'Kies gist:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3628 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3629 source: yeastlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3630 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3631 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3632 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3633 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3634 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3635 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3636 var datarecord = yeastlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3637 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3638 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3639 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3640 $('#wy_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3641 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3642 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3643 datarecord = yeastlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3644 $('#wy_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3645 $('#wy_laboratory').val(datarecord.laboratory);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3646 $('#wy_product_id').val(datarecord.product_id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3647 yeastData.y_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3648 yeastData.y_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3649 yeastData.y_type = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3650 yeastData.y_form = datarecord.form;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3651 yeastData.y_laboratory = datarecord.laboratory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3652 yeastData.y_product_id = datarecord.product_id;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3653 yeastData.y_min_temperature = datarecord.min_temperature;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3654 yeastData.y_max_temperature = datarecord.max_temperature;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3655 yeastData.y_flocculation = datarecord.flocculation;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3656 yeastData.y_attenuation = datarecord.attenuation;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3657 yeastData.y_cells = datarecord.cells;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3658 yeastData.y_inventory = datarecord.inventory;
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
3659 yeastData.y_sta1 = datarecord.sta1;
561
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 559
diff changeset
3660 yeastData.y_bacteria = datarecord.bacteria;
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
3661 yeastData.y_harvest_top = datarecord.harvest_top;
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
3662 yeastData.y_harvest_time = datarecord.harvest_time;
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
3663 yeastData.y_pitch_temperature = datarecord.pitch_temperature;
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
3664 yeastData.y_pofpos = datarecord.pofpos;
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
3665 yeastData.y_zymocide = datarecord.zymocide;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3666 if (yeastData.y_form == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3667 $('#wy_pmpt_amount').html('Pak(ken):');
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
3668 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3669 $('#wy_pmpt_amount').html('Gewicht gram:');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3670 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3671 $('#wy_pmpt_amount').html('Volume ml:');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3672 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3673 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3674 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3675 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3676 $('#wy_amount').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3677 $('#wy_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3678 console.log('amount changed: ' + event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3679 var amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3680 if (yeastData.y_form == 0) // Liquid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3681 amount = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3682 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3683 amount = parseFloat(event.args.value) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3684 yeastData.y_amount = amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3685 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3686 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3687 $('#wy_use').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3688 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3689 source: YeastUseAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3690 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3691 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3692 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3693 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3694 autoDropDownHeight: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3695 dropDownVerticalAlignment: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3696 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3697 $('#wy_use').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3698 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3699 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3700 yeastData.y_use = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3701 calcFermentabes();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3702 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3703 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3704
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3705 // Tab 6, Maischen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3706 $('#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
3707 $('#mash_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3708 placeHolder: 'Kies schema:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3709 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3710 source: mashlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3711 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3712 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3713 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3714 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3715 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3716 dropDownHorizontalAlignment: 'right'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3717 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3718 $('#mash_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3719 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
3720 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
3721 // First delete all current steps
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3722 rowIDs = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3723 rows = $('#mashGrid').jqxGrid('getdisplayrows');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3724 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3725 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3726 rowIDs.push(row.uid);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3727 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3728 $('#mashGrid').jqxGrid('deleterow', rowIDs);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3729 // Then add the new steps
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3730 datarecord = mashlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3731 $('#mash_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3732 for (i = 0; i < datarecord.steps.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3733 data = datarecord.steps[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3734 row = {};
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3735 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
3736 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
3737 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
3738 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
3739 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
3740 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
3741 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
3742 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
3743 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
3744 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
3745 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
3746 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
3747 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
3748 } 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
3749 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
3750 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3751 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3752 //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
3753 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
3754 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
3755 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
3756 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
3757 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
3758 row['step_wg_ratio'] = 0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3759 $('#mashGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3760 }
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
3761 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3762 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3763 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3764 $('#popupMash').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3765 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
3766 height: 375,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3767 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3768 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3769 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3770 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3771 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3772 cancelButton: $('#MashReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3773 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3774 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3775 $('#MashReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3776 $('#MashReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3777 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3778 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3779 $('#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
3780 $('#wstep_name').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3781 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
3782 rowdata.step_name = $('#wstep_name').val();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3783 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3784 $('#wstep_type').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3785 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3786 source: MashStepTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3787 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3788 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3789 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3790 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3791 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3792 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3793 $('#wstep_type').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3794 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3795 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
3796 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
3797 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
3798 rowdata.step_type = index;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3799 $('#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
3800 $('#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
3801 $('#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
3802 $('#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
3803 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
3804 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
3805 $('#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
3806 $('#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
3807 } 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
3808 $('#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
3809 $('#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
3810 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3811 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3812 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
3813 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
3814 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
3815 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
3816 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3817 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
3818 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
3819 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
3820 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
3821 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
3822 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3823 $('#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
3824 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
3825 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
3826 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
3827 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
3828 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
3829 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
3830 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3831 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3832 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3833 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3834 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3835 $('#wstep_temp').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3836 $('#wstep_temp').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3837 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
3838 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
3839 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
3840 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
3841 (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
3842 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
3843 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
3844 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
3845 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
3846 } 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
3847 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
3848 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
3849 } 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
3850 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
3851 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3852 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3853 $('#wend_temp').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3854 $('#wend_temp').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3855 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3856 rowdata.end_temp = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3857 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3858 $('#wstep_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3859 $('#wstep_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3860 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3861 rowdata.step_time = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3862 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3863 $('#wramp_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3864 $('#wramp_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3865 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3866 rowdata.ramp_time = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3867 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3868 $('#wstep_infuse_amount').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3869 $('#wstep_infuse_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3870 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
3871 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
3872 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
3873 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
3874 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
3875 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
3876 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
3877 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
3878 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
3879 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
3880 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3881 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
3882 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
3883 $('#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
3884 } 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
3885 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
3886 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
3887 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
3888 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
3889 $('#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
3890 $('#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
3891 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3892 $('#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
3893 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
3894 calcWater();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3895 }
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
3896 });
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3897 $('#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
3898 $('#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
3899 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
3900 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
3901 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
3902 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
3903 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
3904 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
3905 $('#wstep_infuse_amount').val(vol);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3906 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3907
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3908 // Tab 7, Water
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3909 $('#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
3910 $('#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
3911
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3912 // Water source 1
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3913 $('#w1_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3914 placeHolder: 'Kies hoofd water:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3915 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3916 source: waterlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3917 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3918 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3919 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3920 dropDownWidth: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3921 dropDownHeight: 400
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3922 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3923 $('#w1_name').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3924 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3925 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3926 datarecord = waterlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3927 dataRecord.w1_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3928 $('#w1_calcium').val(datarecord.calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3929 dataRecord.w1_calcium = datarecord.calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3930 $('#w1_sulfate').val(datarecord.sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3931 dataRecord.w1_sulfate = datarecord.sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3932 $('#w1_chloride').val(datarecord.chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3933 dataRecord.w1_chloride = datarecord.chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3934 $('#w1_sodium').val(datarecord.sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3935 dataRecord.w1_sodium = datarecord.sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3936 $('#w1_magnesium').val(datarecord.magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3937 dataRecord.w1_magnesium = datarecord.magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3938 $('#w1_total_alkalinity').val(datarecord.total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3939 dataRecord.w1_total_alkalinity = datarecord.total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3940 $('#w1_ph').val(datarecord.ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3941 dataRecord.w1_ph = datarecord.ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3942 $('#w1_cost').val(datarecord.cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3943 dataRecord.w1_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3944 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3945 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3946 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3947 $('#w1_amount').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3948 $('#w1_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3949 $('#w1_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3950 $('#w1_sodium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3951 $('#w1_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3952 $('#w1_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3953 $('#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
3954 $('#w1_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3955 // Water source 2
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3956 $('#w2_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3957 placeHolder: 'Kies meng water:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3958 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3959 source: waterlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3960 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3961 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3962 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3963 dropDownWidth: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3964 dropDownHeight: 400
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3965 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3966 $('#w2_name').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3967 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3968 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3969 datarecord = waterlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3970 dataRecord.w2_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3971 $('#w2_calcium').val(datarecord.calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3972 dataRecord.w2_calcium = datarecord.calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3973 $('#w2_sulfate').val(datarecord.sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3974 dataRecord.w2_sulfate = datarecord.sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3975 $('#w2_chloride').val(datarecord.chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3976 dataRecord.w2_chloride = datarecord.chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3977 $('#w2_sodium').val(datarecord.sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3978 dataRecord.w2_sodium = datarecord.sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3979 $('#w2_magnesium').val(datarecord.magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3980 dataRecord.w2_magnesium = datarecord.magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3981 $('#w2_total_alkalinity').val(datarecord.total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3982 dataRecord.w2_total_alkalinity = datarecord.total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3983 $('#w2_ph').val(datarecord.ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3984 dataRecord.w2_ph = datarecord.ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3985 $('#w2_cost').val(datarecord.cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3986 dataRecord.w2_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3987 $('#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
3988 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3989 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3990 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3991 $('#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
3992 $('#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
3993 $('#w2_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3994 $('#w2_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3995 $('#w2_sodium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3996 $('#w2_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3997 $('#w2_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3998 $('#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
3999 $('#w2_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4000 // Water mixed
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4001 $('#wg_amount').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4002 $('#wg_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4003 $('#wg_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4004 $('#wg_sodium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4005 $('#wg_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4006 $('#wg_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4007 $('#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
4008 $('#wg_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4009 // Water treated
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4010 $('#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
4011 $('#wb_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4012 $('#wb_magnesium').jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is lager dan 30.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4013 $('#wb_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4014 $('#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
4015 $('#wb_sodium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4016 $('#wb_chloride').jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4017 $('#wb_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4018 $('#wb_sulfate').jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4019 $('#wb_sulfate').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4020 $('#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
4021 $('#wb_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4022 // Water target profile
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4023 $('#pr_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4024 placeHolder: 'Kies doel profiel:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4025 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4026 source: waterprofiles,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4027 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4028 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4029 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4030 dropDownWidth: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4031 dropDownHeight: 300
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4032 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4033 $('#pr_name').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4034 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4035 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4036 datarecord = waterprofiles.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4037 $('#pr_calcium').val(datarecord.calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4038 $('#pr_sulfate').val(datarecord.sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4039 $('#pr_chloride').val(datarecord.chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4040 $('#pr_sodium').val(datarecord.sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4041 $('#pr_magnesium').val(datarecord.magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4042 $('#pr_total_alkalinity').val(datarecord.total_alkalinity);
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
4043 calcWater();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4044 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4045 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4046 $('#pr_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4047 $('#pr_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4048 $('#pr_sodium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4049 $('#pr_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4050 $('#pr_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4051 $('#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
4052
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4053 // Water agents
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4054 $('#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
4055 $('#wa_cacl2').jqxNumberInput(Spin1dec);
524
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
4056 $('#wa_caso4').jqxTooltip({
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
4057 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
4058 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4059 $('#wa_caso4').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4060 $('#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
4061 $('#wa_mgso4').jqxNumberInput(Spin1dec);
524
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
4062 $('#wa_nacl').jqxTooltip({
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
4063 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
4064 '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
4065 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4066 $('#wa_nacl').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4067 $('#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
4068 $('#mash_ph').jqxNumberInput(SpinpH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4069 $('#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
4070 $('#wa_base_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4071 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4072 source: BaseTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4073 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4074 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4075 width: 170,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4076 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4077 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4078 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4079 $('#wa_base').jqxNumberInput(Spin2dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4080 $('#wa_base').jqxNumberInput({ symbol: ' gr', symbolPosition: 'right' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4081 $('#wa_acid_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4082 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4083 source: AcidTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4084 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4085 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4086 width: 170,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4087 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4088 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4089 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4090 $('#wa_acid').jqxNumberInput(Spin2dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4091 $('#wa_acid').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4092 $('#wa_acid_perc').jqxNumberInput(Perc0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4093 $('#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
4094 // Sparge water
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4095 $('#sparge_temp').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4096 $('#sparge_volume').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4097 $('#sparge_ph').jqxNumberInput(SpinpH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4098 $('#sparge_source').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4099 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4100 source: SpargeSourceAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4101 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4102 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4103 width: 110,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4104 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4105 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4106 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4107 $('#sparge_acid_amount').jqxNumberInput(Spin2dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4108 $('#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
4109 $('#sparge_acid_type').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4110 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4111 source: AcidTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4112 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4113 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4114 width: 110,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4115 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4116 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4117 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4118 $('#sparge_acid_perc').jqxNumberInput(Perc0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4119 $('#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
4120
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4121 // Tabs inside the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4122 $('#jqxTabs').jqxTabs({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4123 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4124 width: 1280,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4125 height: 660,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4126 autoHeight: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4127 position: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4128 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4129
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4130 // Buttons below
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4131 $('#Export').jqxButton({ template: 'info', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4132 $('#Export').bind('click', function() {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
4133 saveRecord(0);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4134 });
175
da16371538c3 When importing from brouwhulp use 0 and 1 instead of false and true for boolean variables. Added Export button to the recipe editor. Added beerxml recipe export.
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
4135
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4136 $('#Delete').jqxButton({ template: 'danger', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4137 $('#Delete').bind('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4138 // Open a popup to confirm this action.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4139 $('#eventWindow').jqxWindow('open');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4140 $('#delOk').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4141 var data = 'delete=true&' + $.param({ record: my_record });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4142 $.ajax({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4143 dataType: 'json',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4144 url: url,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4145 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4146 data: data,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4147 type: 'POST',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4148 success: function(data, status, xhr) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4149 // delete command is executed.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4150 window.location.href = my_return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4151 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4152 error: function(jqXHR, textStatus, errorThrown) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4153 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4154 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4155 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4156 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4157
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4158 $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4159 $('#Cancel').bind('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4160 window.location.href = my_return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4161 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4162
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4163 $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4164 $('#Save').bind('click', function() {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
4165 saveRecord(1);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4166 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4167 createDelElements();
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4168 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4169

mercurial