www/js/rec_edit.js

Tue, 13 Apr 2021 16:54:26 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 13 Apr 2021 16:54:26 +0200
changeset 735
23d972f5d784
parent 710
9646123ea063
child 756
b702c25661e7
permissions
-rw-r--r--

Added new dry-yeast parameters to the recipe editor.

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' },
710
9646123ea063 Fixed st_category_namber to be an integer value instead of float. The calc_acid in a new recipe is integer. Added missing wg_ and wb_ fields in a new recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 667
diff changeset
736 { name: 'st_category_number', type: 'int' },
474
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' },
735
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1592 { name: 'y_gr_hl_lo', type: 'int' },
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1593 { name: 'y_sg_lo', type: 'float' },
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1594 { name: 'y_gr_hl_hi', type: 'int' },
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1595 { name: 'y_sg_hi', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1596 { name: 'y_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1597 ],
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1598 addrow: function(rowid, rowdata, position, commit) { commit(true); },
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1599 deleterow: function(rowid, commit) { commit(true); },
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1600 updaterow: function(rowid, rowdata, commit) { commit(true); }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1601 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1602 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
1603
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1604 $('#yeastGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1605 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1606 height: 350,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1607 source: yeastAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1608 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1609 selectionmode: 'singlerow',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1610 showtoolbar: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1611 rendertoolbar: function(toolbar) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1612 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
1613 toolbar.append(container);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1614 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
1615 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
1616 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
1617 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
1618 // add yeast from dropdownlist.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1619 $('#yaddrowbutton').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1620 placeHolder: 'Kies gist:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1621 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1622 source: yeastlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1623 template: 'primary',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1624 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1625 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1626 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1627 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1628 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1629 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1630 var datarecord = yeastlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1631 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1632 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1633 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1634 $('#yaddrowbutton').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1635 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1636 var datarecord, row = {}, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1637 datarecord = yeastlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1638 row['y_name'] = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1639 row['y_laboratory'] = datarecord.laboratory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1640 row['y_product_id'] = datarecord.product_id;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1641 row['y_type'] = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1642 row['y_form'] = datarecord.form;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1643 row['y_amount'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1644 row['y_cost'] = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1645 row['y_use'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1646 row['y_min_temperature'] = datarecord.min_temperature;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1647 row['y_max_temperature'] = datarecord.max_temperature;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1648 row['y_attenuation'] = datarecord.attenuation;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1649 row['y_flocculation'] = datarecord.flocculation;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1650 row['y_cells'] = datarecord.cells;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1651 row['y_tolerance'] = datarecord.tolerance;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1652 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
1653 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
1654 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
1655 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
1656 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
1657 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
1658 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
1659 row['y_zymocide'] = datarecord.zymocide;
735
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1660 row['y_gr_hl_lo'] = datarecord.gr_hl_lo;
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1661 row['y_sg_lo'] = datarecord.sg_lo;
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1662 row['y_gr_hl_hi'] = datarecord.gr_hl_hi;
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1663 row['y_sg_hi'] = datarecord.sg_hi;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1664 $('#yeastGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1665 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1666 $('#yaddrowbutton').jqxDropDownList('clearSelection');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1667 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1668 $('#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
1669 $('#yinstockbutton').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1670 yeastinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1671 yeastlist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1672 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1673 // delete selected yeast.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1674 $('#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
1675 $('#ydeleterowbutton').on('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1676 var id, rowscount, selectedrowindex = $('#yeastGrid').jqxGrid('getselectedrowindex');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1677 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1678 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1679 id = $('#yeastGrid').jqxGrid('getrowid', selectedrowindex);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1680 $('#yeastGrid').jqxGrid('deleterow', id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1681 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1682 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1683 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1684 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1685 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1686 $('#jqxTabs').jqxTabs('next');
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 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1689 { text: 'Gist', datafield: 'y_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1690 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1691 { text: 'Code', width: 90, datafield: 'y_product_id' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1692 { text: 'Soort', width: 100, datafield: 'y_form',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1693 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1694 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
1695 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1696 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1697 { 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
1698 { 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
1699 { 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
1700 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1701 var amount = '', color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1702 if (value > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1703 amount = dataAdapter.formatNumber(value, 'f1');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1704 if (dataRecord.est_abv > value)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1705 color = '#ff4040';
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 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
1708 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1709 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1710 { 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
1711 { text: 'Voor', width: 120, datafield: 'y_use',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1712 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1713 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
1714 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1715 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1716 { 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
1717 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1718 var amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1719 if (rowdata.y_form == 0) // Liquid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1720 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1721 else if (rowdata.y_form == 1) // Dry
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1722 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1723 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
1724 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1725 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1726 { 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
1727 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1728 var color, amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1729 color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1730 if (value < rowdata.y_amount)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1731 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1732 amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1733 if (rowdata.y_form == 0) // Liquid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1734 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1735 else if (rowdata.y_form == 1) // Dry
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1736 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1737 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
1738 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1739 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1740 { 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
1741 cellsrenderer: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1742 return 'Wijzig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1743 }, buttonclick: function(row) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1744 yeastRow = row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1745 yeastData = $('#yeastGrid').jqxGrid('getrowdata', yeastRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1746 if (yeastData.y_form == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1747 $('#wy_pmpt_amount').html('Pak(ken):');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1748 $('#wy_amount').val(yeastData.y_amount);
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 } else if (yeastData.y_form == 1) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1751 $('#wy_pmpt_amount').html('Gewicht gram:');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1752 $('#wy_amount').val(yeastData.y_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1753 $('#wy_amount').jqxNumberInput({ decimalDigits: 1 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1754 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1755 $('#wy_pmpt_amount').html('Volume ml:');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1756 $('#wy_amount').val(yeastData.y_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1757 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 });
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 $('#wy_name').val(yeastData.y_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1760 $('#wy_laboratory').val(yeastData.y_laboratory);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1761 $('#wy_product_id').val(yeastData.y_product_id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1762 $('#wy_use').val(yeastData.y_use);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1763 // show the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1764 $('#popupYeast').jqxWindow('open');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1765 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1766 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1767 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1768 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1769 };
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
1770
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1771 // inline mash editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1772 var editMash = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1773 var mashSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1774 localdata: data.mashs,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1775 datatype: 'local',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1776 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1777 async: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1778 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1779 { name: 'step_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1780 { 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
1781 { name: 'step_volume', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1782 { 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
1783 { name: 'step_infuse_temp', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1784 { name: 'step_temp', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1785 { 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
1786 { name: 'step_wg_ratio', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1787 { name: 'ramp_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1788 { name: 'end_temp', type: 'float' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1789 ],
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
1790 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
1791 deleterow: function(rowid, commit) { commit(true); }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1792 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1793 mashAdapter = new $.jqx.dataAdapter(mashSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1794 beforeLoadComplete: function(records) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1795 mash_infuse = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1796 var row, i, data = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1797 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1798 row = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1799 if (row.step_type == 0) // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1800 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
1801 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
1802 data.push(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1803 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1804 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1805 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1806 $('#mashGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1807 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1808 height: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1809 source: mashAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1810 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1811 selectionmode: 'singlerow',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1812 showtoolbar: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1813 rendertoolbar: function(toolbar) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1814 //var me = this;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1815 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
1816 toolbar.append(container);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1817 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
1818 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
1819 $('#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
1820 $('#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
1821 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
1822 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
1823 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
1824 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
1825 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
1826 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
1827 } 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
1828 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
1829 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
1830 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
1831 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1832 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
1833 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
1834 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
1835 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
1836 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
1837 row['end_temp'] = 62.0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1838 $('#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
1839 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1840 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1841 // delete selected yeast.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1842 $('#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
1843 $('#sdeleterowbutton').on('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1844 var id, rowscount, selectedrowindex = $('#mashGrid').jqxGrid('getselectedrowindex');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1845 rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1846 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1847 id = $('#mashGrid').jqxGrid('getrowid', selectedrowindex);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1848 $('#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
1849 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1850 }
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 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1853 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1854 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1855 calcInit();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1856 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1857 $('#jqxLoader').jqxLoader('close');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1858 $('#jqxTabs').jqxTabs('first');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1859 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1860 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1861 { text: 'Stap naam', datafield: 'step_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1862 { text: 'Stap type', datafield: 'step_type', width: 175,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1863 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1864 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
1865 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1866 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1867 { 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
1868 { 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
1869 { 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
1870 { 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
1871 { 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
1872 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
1873 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
1874 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
1875 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
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 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 { 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
1879 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
1880 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
1881 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
1882 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
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: '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
1886 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
1887 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
1888 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
1889 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
1890 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
1891 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 { 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
1894 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
1895 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
1896 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
1897 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
1898 }, 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
1899 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
1900 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
1901 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 { 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
1905 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
1906 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
1907 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
1908 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
1909 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
1910 }, 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
1911 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
1912 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
1913 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
1914 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 { 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
1918 cellsrenderer: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1919 return 'Wijzig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1920 }, buttonclick: function(row) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1921 mashRow = row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1922 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
1923 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
1924 $("#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
1925 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
1926 $("#wstep_type").jqxDropDownList('enableAt', 2);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1927 $('#wstep_name').val(mashData.step_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1928 $('#wstep_type').val(mashData.step_type);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1929 $('#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
1930 $('#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
1931 $('#wstep_temp').val(mashData.step_temp);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1932 $('#wend_temp').val(mashData.end_temp);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1933 $('#wstep_time').val(mashData.step_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1934 $('#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
1935 $('#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
1936 $('#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
1937 $('#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
1938 $('#wstep_pmpt_temp').hide();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1939 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
1940 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
1941 $('#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
1942 $('#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
1943 } 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
1944 $('#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
1945 $('#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
1946 }
474
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 // show the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1949 $('#popupMash').jqxWindow('open');
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 ]
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 };
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1957
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1958
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1959 /*
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1960 * 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
1961 */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1962 $('#jqxMenu').jqxMenu('destroy');
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 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
1965 $('#jqxLoader').jqxLoader({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1966 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1967 height: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1968 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1969 text: 'Laden recept ...',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1970 theme: theme
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1971 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1972
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1973 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
1974
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1975 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
1976 if (amount == 0) {
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 id = $('#miscGrid').jqxGrid('getrowid', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1981 $('#miscGrid').jqxGrid('deleterow', id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1982 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1983 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1984 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1985 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1986 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1987 if (row.m_name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1988 found = true;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1989 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount / 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1990 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1991 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1992 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1993 if (! found) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1994 miscs = new $.jqx.dataAdapter(miscInvSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1995 loadComplete: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1996 records = miscs.records;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1997 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1998 record = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1999 if (record.name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2000 row = {};
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2001 row['m_name'] = record.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2002 row['m_amount'] = amount / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2003 row['m_cost'] = record.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2004 row['m_type'] = record.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2005 row['m_use_use'] = record.use_use;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2006 row['m_time'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2007 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
2008 row['m_inventory'] = record.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2009 row['m_avail'] = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2010 $('#miscGrid').jqxGrid('addrow', null, row);
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 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2015 miscs.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2016 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2017 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2018 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2019 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2020
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2021
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2022 // Procedure TFrmWaterAdjustment.CalcWater2;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2023 function calcWater() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2024
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
2025 if (! data_loaded) {
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
2026 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
2027 return;
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
2028 }
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
2029
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2030 var liters = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2031 calcium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2032 magnesium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2033 sodium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2034 total_alkalinity = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2035 bicarbonate = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2036 chloride = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2037 sulfate = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2038 ph = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2039 RA = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2040 frac = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2041 TpH = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2042 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
2043 AT, BT,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2044 r1d, r2d, f1d, f2d, f3d,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2045 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
2046 Res;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2047
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2048 if (dataRecord.w1_name == '') {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2049 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2050 }
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
2051
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2052 // 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
2053 if (dataRecord.w2_name != '') {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2054 liters = dataRecord.w1_amount + dataRecord.w2_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2055 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
2056 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
2057 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
2058 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
2059 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
2060 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
2061 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
2062 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2063 liters = dataRecord.w1_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2064 calcium = dataRecord.w1_calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2065 magnesium = dataRecord.w1_magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2066 sodium = dataRecord.w1_sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2067 chloride = dataRecord.w1_chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2068 sulfate = dataRecord.w1_sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2069 total_alkalinity = dataRecord.w1_total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2070 ph = dataRecord.w1_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2071 }
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
2072 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
2073
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The 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 /* 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
2075 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
2076 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
2077 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
2078 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
2079 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
2080 var wg_bicarbonate = bicarbonate;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2081
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
2082 $('#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
2083 $('#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
2084 $('#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
2085 $('#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
2086 $('#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
2087 $('#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
2088 $('#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
2089 $('#wg_ph').val(Round(ph, 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2090
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
2091 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
2092 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
2093
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
2094 /* 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
2095 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
2096 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
2097 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
2098 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
2099 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
2100 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
2101 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
2102 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
2103 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
2104 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
2105 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2106
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
2107 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
2108 $('#wa_acid_name').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2109 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
2110 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
2111 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2112 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2113 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
2114 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
2115
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
2116 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
2117 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
2118 $('#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
2119 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2120
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2121 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
2122 $('#wa_base_name').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2123 dataRecord.wa_base_name = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2124 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2125 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
2126 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
2127
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2128 AT = dataRecord.wa_acid_name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2129 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
2130
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
2131 /* 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
2132 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
2133
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2134 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
2135 $('.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
2136 /* Auto calculate pH */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2137 TpH = parseFloat(dataRecord.mash_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2138 protonDeficit = ProtonDeficit(TpH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2139 console.log('calc_acid tgt: ' + TpH + ' protonDeficit: ' + protonDeficit);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2140 if (protonDeficit > 0) { // Add acid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2141 $('#wa_base').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2142 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
2143 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
2144 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
2145 Acid *= AcidTypeData[AT].MolWt; // mg
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2146 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
2147 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
2148 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
2149 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
2150 $('#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
2151 setWaterAgent(AcidTypeData[AT].nl, Acid);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2152
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2153 bicarbonate = bicarbonate - protonDeficit * frac / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2154 total_alkalinity = bicarbonate * 50 / 61;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2155 } else if (protonDeficit < 0) { //Add base
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2156 $('#wa_acid').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2157 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
2158 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
2159 r2d = Math.pow(10, (TpH - 10.33));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2160 f1d = 1 / (1 + r1d + r1d * r2d);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2161 f2d = f1d * r1d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2162 f3d = f2d * r2d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2163 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
2164 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
2165 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
2166 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
2167 $('#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
2168 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
2169 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
2170 // 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
2171 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
2172 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
2173 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
2174 // 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
2175 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
2176 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
2177 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
2178 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
2179 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The 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 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
2181 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
2182 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
2183 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
2184 $('#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
2185 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
2186 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
2187 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
2188 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
2189 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
2190 // 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
2191 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
2192 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
2193 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
2194 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
2195 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The 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 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
2197 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
2198 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
2199 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
2200 //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
2201 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
2202 $('#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
2203 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
2204 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
2205 //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
2206 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
2207 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
2208 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
2209 //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
2210 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
2211 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
2212 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
2213 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
2214 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
2215 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The 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 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
2217 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
2218 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
2219 $('#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
2220 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
2221 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
2222 // 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
2223 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
2224 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
2225 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
2226 // 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
2227 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
2228 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
2229 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
2230 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
2231 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
2232 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The 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 break;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2234 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2235 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2236 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
2237 $('#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
2238 $('#est_mash_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2239 } 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
2240 /* 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
2241 $('.c_mashph').hide();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2242 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
2243 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
2244 /* 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
2245 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
2246 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
2247 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
2248 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
2249 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
2250 // 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
2251 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
2252 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
2253 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
2254 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
2255 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
2256 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
2257 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
2258 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
2259 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
2260 // 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
2261 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
2262 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
2263 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
2264 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
2265 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
2266 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
2267 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
2268 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
2269 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
2270 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
2271 // 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
2272 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
2273 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
2274 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
2275 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
2276 break;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2277 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2278 }
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
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 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
2281 // 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
2282 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
2283 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
2284 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
2285 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
2286 Acidmg = Acid;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2287
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
2288 //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
2289 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
2290 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
2291 //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
2292
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
2293 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
2294 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
2295 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
2296 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
2297 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
2298 n++;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2299 if (pd < (protonDeficit - deltapd))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2300 pHa -= deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2301 else if (pd > (protonDeficit + deltapd))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2302 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
2303 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
2304 protonDeficit = Acid * frac;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2305 pd = ProtonDeficit(pHa);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2306 }
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
2307 //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
2308 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
2309 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
2310 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
2311 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
2312 $('#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
2313 $('#est_mash_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2314 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2315
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2316 if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2317 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2318 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2319 Acidmg / 1000 * MMSO4 / (MMSO4 + 2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2320 RA = 1000 * RA / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2321 sulfate = wg_sulfate + RA; // Not add to sulfate??
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2322 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2323 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2324 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2325 Acidmg / 1000 * MMCl / (MMCl + 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2326 RA = 1000 * RA / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2327 chloride = wg_chloride + RA;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2328 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2329
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
2330 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
2331 $('#tgt_bu').val(Round(BUGU, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2332 // 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
2333 if (BUGU < 0.32)
474
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;'>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
2335 else if (BUGU < 0.43)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2336 $('#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
2337 else if (BUGU < 0.52)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2338 $('#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
2339 else if (BUGU < 0.63)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2340 $('#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
2341 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2342 $('#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
2343
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 // 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
2345 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
2346 $('#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
2347 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
2348 $('#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
2349 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
2350 $('#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
2351 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
2352 $('#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
2353 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
2354 $('#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
2355 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
2356 $('#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
2357 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
2358 $('#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
2359 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
2360 $('#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
2361 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
2362 $('#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
2363 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
2364 RA = sulfate / chloride;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2365 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2366 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
2367 $('#got_so4_cl').val(Round(RA, 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2368 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
2369 if (RA < (0.8 * OptSO4Clratio))
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2370 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
2371 else if (RA > (1.2 * OptSO4Clratio))
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2372 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
2373 setRangeIndicator('so4_cl', Res);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2374
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2375 $('#wb_calcium').val(Round(calcium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2376 $('#wb_magnesium').val(Round(magnesium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2377 $('#wb_sodium').val(Round(sodium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2378 $('#wb_sulfate').val(Round(sulfate, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2379 $('#wb_chloride').val(Round(chloride, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2380 $('#wb_total_alkalinity').val(Round(total_alkalinity, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2381
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2382 if (calcium < 40) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2383 setRangeIndicator('calcium', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2384 } else if (calcium > 150) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2385 setRangeIndicator('calcium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2386 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2387 setRangeIndicator('calcium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2388 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2389 if (magnesium >= 0 && magnesium <= 30) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2390 setRangeIndicator('magnesium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2391 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2392 setRangeIndicator('magnesium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2393 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2394 if (sodium <= 150) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2395 setRangeIndicator('sodium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2396 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2397 setRangeIndicator('sodium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2398 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2399 // 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
2400 // 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
2401 if (chloride <= 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2402 setRangeIndicator('chloride', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2403 } else if (chloride <= 100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2404 setRangeIndicator('chloride', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2405 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2406 setRangeIndicator('chloride', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2407 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2408 if (sulfate <= 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2409 setRangeIndicator('sulfate', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2410 } else if (sulfate <= 350) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2411 setRangeIndicator('sulfate', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2412 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2413 setRangeIndicator('sulfate', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2414 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2415 if (ph < 5.2) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2416 setRangeIndicator('ph', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2417 } else if (ph > 5.6) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2418 setRangeIndicator('ph', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2419 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2420 setRangeIndicator('ph', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2421 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2422 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2423 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2424
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
2425
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2426 function calcSparge() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2427
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
2428 /* 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
2429 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
2430 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
2431 var Source_alkalinity = dataRecord.w1_total_alkalinity;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2432 // Select watersource or fallback to the first source.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2433 if (dataRecord.sparge_source == 1) { // Source 2
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 = dataRecord.w2_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2436 Source_alkalinity = dataRecord.w2_total_alkalinity;
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; // Source 1
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 } else if (dataRecord.sparge_source == 2) { // Mixed
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2442 if (dataRecord.w2_ph > 0.0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2443 Source_pH = parseFloat($('#wg_ph').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2444 Source_alkalinity = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2445 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2446 dataRecord.sparge_source = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2447 $('#sparge_source').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2448 }
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2451 // 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
2452 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
2453 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
2454 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
2455 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
2456 var f3 = r1 * r2 / d;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2457
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2458 //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
2459 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
2460 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
2461 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
2462 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
2463 var f343 = r143 * r243 / d43;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2464
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2465 //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
2466 //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
2467 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
2468
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2469 //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
2470 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
2471 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
2472 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
2473 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
2474 var f3g = r1g * r2g / dg;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2475
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2476 //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
2477 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
2478 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
2479
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2480 //Step 8. Get the acid data.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2481 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
2482 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
2483 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
2484 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
2485 $('#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
2486 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
2487 $('#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
2488 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The 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 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
2490
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2491 //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
2492 Acid /= fract;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2493
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2494 //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
2495 Acid *= AcidTypeData[AT].MolWt; //mg
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2496
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
2497 //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
2498 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
2499 Acid *= dataRecord.sparge_volume; //ml acid total
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2500 Acid = Round(Acid, 2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2501 dataRecord.sparge_acid_amount = Acid / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2502 $('#sparge_acid_amount').val(Acid);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2503 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2504
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2505 /*
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2506 * 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
2507 */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2508 function calcFermentablesFromOG(OG) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2509
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2510 console.log('calcFermentablesFromOG(' + OG + ')');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2511 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
2512 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
2513 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
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 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2516 row = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2517 if (row.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2518 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
2519 if (row.f_added == 0) // Mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2520 d = efficiency / 100 * d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2521 tot += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2522 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2523 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2524 if (tot)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2525 totmass = Math.round((sug / tot) * 1000) / 1000;
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 if (totmass) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2528 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2529 row = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2530 if (row.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2531 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
2532 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2533 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2534 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2535 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2536 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2537
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2538 function calcInit() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2539 console.log('calc.init()');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2540
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2541 $('#calc_acid').on('checked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2542 dataRecord.calc_acid = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2543 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2544 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2545 $('#calc_acid').on('unchecked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2546 dataRecord.calc_acid = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2547 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2548 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2549 $('#w1_name').jqxDropDownList('selectItem', dataRecord.w1_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2550 $('#w2_name').jqxDropDownList('selectItem', dataRecord.w2_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2551 // 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
2552 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
2553 $('#w1_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2554 dataRecord.w1_amount = mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2555 $('#wg_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2556 $('#w2_amount').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2557 dataRecord.w2_amount = 0;
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 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2560 $('#w2_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2561 var newval = parseFloat(event.args.value);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2562
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2563 if (newval > mash_infuse) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2564 $('#w2_amount').val(dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2565 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2566 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2567 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
2568 $('#w1_amount').val(dataRecord.w1_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2569 dataRecord.w2_amount = newval;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2570 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
2571 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2572 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2573 $('#wa_cacl2').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2574 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2575 setWaterAgent('CaCl2', 0); // This can prevent double entries.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2576 setWaterAgent('CaCl2', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2577 calcWater();
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 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2580 $('#wa_caso4').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2581 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2582 setWaterAgent('CaSO4', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2583 setWaterAgent('CaSO4', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2584 calcWater();
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 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2587 $('#wa_mgso4').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2588 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2589 setWaterAgent('MgSO4', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2590 setWaterAgent('MgSO4', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2591 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2592 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2593 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2594 $('#wa_nacl').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2595 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2596 setWaterAgent('NaCl', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2597 setWaterAgent('NaCl', event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2598 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2599 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2600 });
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
2601 $('#wa_base_name').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2602 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2603 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2604 setWaterAgent(last_base, 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2605 last_base = BaseTypeData[index].nl;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2606 setWaterAgent(last_base, parseFloat($('#wa_base').jqxNumberInput('decimal')));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2607 dataRecord.wa_base_name = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2608 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2609 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2610 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2611 $('#wa_base').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2612 var name = BaseTypeData[$('#wa_base_name').val()].nl;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2613 setWaterAgent(name, parseFloat(event.args.value));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2614 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2615 });
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
2616 $('#wa_acid_name').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2617 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2618 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2619 setWaterAgent(last_acid, 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2620 last_acid = AcidTypeData[index].nl;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2621 setWaterAgent(last_acid, parseFloat($('#wa_acid').jqxNumberInput('decimal')));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2622 dataRecord.wa_acid_name = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2623 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2624 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2625 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2626 $('#wa_acid').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2627 var name = AcidTypeData[$('#wa_acid_name').val()].nl;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2628 setWaterAgent(name, parseFloat(event.args.value));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2629 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2630 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2631 $('#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
2632
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
2633 $('#color_method').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2634 dataRecord.color_method = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2635 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2636 });
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
2637 $('#ibu_method').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2638 dataRecord.ibu_method = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2639 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2640 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2641 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2642 $('#batch_size').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2643 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
2644 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
2645 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
2646 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
2647 $('#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
2648 dataRecord.sparge_volume *= factor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2649 $('#sparge_volume').val(dataRecord.sparge_volume);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2650 dataRecord.batch_size = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2651 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
2652 adjustWaters(factor);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2653 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2654 adjustHops(factor);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2655 adjustMiscs(factor);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2656 adjustYeasts(factor);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2657 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2658 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2659 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2660 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2661 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2662 $('#boil_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2663 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
2664 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
2665 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
2666 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
2667 $('#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
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 $('#efficiency').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2672 var estog = parseFloat($('#est_og').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2673 dataRecord.efficiency = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2674 console.log('efficiency change:' + dataRecord.efficiency);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2675 calcFermentablesFromOG(estog); // Keep the OG
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2676 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2677 calcIBUs();
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 $('#est_og').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2680 dataRecord.est_og = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2681 console.log('est_og change:' + dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2682 calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2683 calcFermentables(); // Update the recipe details
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2684 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2685 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2686 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2687 $('#mash_ph').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2688 dataRecord.mash_ph = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2689 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2690 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2691
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2692 $('#sparge_ph').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2693 dataRecord.sparge_ph = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2694 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2695 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2696 $('#sparge_volume').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2697 dataRecord.sparge_volume = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2698 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2699 });
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
2700 $('#sparge_source').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2701 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2702 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2703 dataRecord.sparge_source = index;
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 });
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
2707 $('#sparge_acid_type').on('select', function(event) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2708 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2709 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2710 dataRecord.sparge_acid_type = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2711 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
2712 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2713 }
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 $('#sparge_acid_perc').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2716 dataRecord.sparge_acid_perc = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2717 calcSparge();
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 $('#locked').on('checked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2720 dataRecord.locked = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2721 setReadonly(true);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2722 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2723 $('#locked').on('unchecked', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2724 dataRecord.locked = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2725 setReadonly(false);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2726 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2727 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2728
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2729 $('#styleSelect').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2730 placeHolder: 'Kies bierstijl:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2731 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2732 source: styleslist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2733 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2734 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2735 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2736 dropDownVerticalAlignment: 'top',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2737 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2738 dropDownHeight: 350,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2739 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2740 var datarecord = styleslist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2741 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
2742 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2743 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2744 $('#styleSelect').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2745 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2746 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2747 datarecord = styleslist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2748 $('#st_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2749 $('#st_category').val(datarecord.category);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2750 $('#st_category_number').val(datarecord.category_number);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2751 $('#st_letter').val(datarecord.style_letter);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2752 $('#st_guide').val(datarecord.style_guide);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2753 $('#st_type').val(StyleTypeData[datarecord.type].nl);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2754 $('#st_og_min').val(datarecord.og_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2755 $('#st_og_max').val(datarecord.og_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2756 $('#st_fg_min').val(datarecord.fg_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2757 $('#st_fg_max').val(datarecord.fg_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2758 $('#st_ibu_min').val(datarecord.ibu_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2759 $('#st_ibu_max').val(datarecord.ibu_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2760 $('#st_color_min').val(datarecord.color_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2761 $('#st_color_max').val(datarecord.color_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2762 $('#st_carb_min').val(datarecord.carb_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2763 $('#st_carb_max').val(datarecord.carb_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2764 $('#st_abv_min').val(datarecord.abv_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2765 $('#st_abv_max').val(datarecord.abv_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2766 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2767 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2768
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2769 function saveRecord(goback) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2770 var row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2771 record: my_record,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2772 uuid: dataRecord.uuid,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2773 name: $('#name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2774 locked: dataRecord.locked,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2775 notes: $('#notes').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2776 st_name: $('#st_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2777 st_letter: $('#st_letter').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2778 st_guide: $('#st_guide').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2779 st_type: dataRecord.st_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2780 st_category: $('#st_category').val(),
710
9646123ea063 Fixed st_category_namber to be an integer value instead of float. The calc_acid in a new recipe is integer. Added missing wg_ and wb_ fields in a new recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 667
diff changeset
2781 st_category_number: $('#st_category_number').val(),
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2782 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
2783 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
2784 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
2785 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
2786 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
2787 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
2788 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
2789 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
2790 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
2791 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
2792 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
2793 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
2794 type: $('#type').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2795 batch_size: parseFloat($('#batch_size').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2796 boil_size: parseFloat($('#boil_size').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2797 boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2798 efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2799 est_og: parseFloat($('#est_og').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2800 est_fg: parseFloat($('#est_fg').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2801 est_abv: parseFloat($('#est_abv').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2802 est_color: parseFloat($('#est_color').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2803 color_method: $('#color_method').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2804 est_ibu: parseFloat($('#est_ibu').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2805 ibu_method: $('#ibu_method').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2806 est_carb: parseFloat($('#est_carb').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2807 mash_name: $('#mash_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2808 mash_ph: parseFloat($('#mash_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2809 sparge_temp: parseFloat($('#sparge_temp').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2810 sparge_ph: parseFloat($('#sparge_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2811 sparge_volume: parseFloat($('#sparge_volume').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2812 sparge_source: $('#sparge_source').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2813 sparge_acid_type: $('#sparge_acid_type').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2814 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
2815 sparge_acid_amount: dataRecord.sparge_acid_amount,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2816 calc_acid: dataRecord.calc_acid,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2817 w1_name: $('#w1_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2818 w1_amount: parseFloat($('#w1_amount').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2819 w1_calcium: parseFloat($('#w1_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2820 w1_sulfate: parseFloat($('#w1_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2821 w1_chloride: parseFloat($('#w1_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2822 w1_sodium: parseFloat($('#w1_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2823 w1_magnesium: parseFloat($('#w1_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2824 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
2825 w1_ph: parseFloat($('#w1_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2826 w1_cost: dataRecord.w1_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2827 w2_name: $('#w2_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2828 w2_amount: parseFloat($('#w2_amount').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2829 w2_calcium: parseFloat($('#w2_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2830 w2_sulfate: parseFloat($('#w2_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2831 w2_chloride: parseFloat($('#w2_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2832 w2_sodium: parseFloat($('#w2_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2833 w2_magnesium: parseFloat($('#w2_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2834 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
2835 w2_ph: parseFloat($('#w2_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2836 w2_cost: dataRecord.w2_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2837 wg_amount: parseFloat($('#wg_amount').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2838 wg_calcium: parseFloat($('#wg_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2839 wg_sulfate: parseFloat($('#wg_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2840 wg_chloride: parseFloat($('#wg_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2841 wg_sodium: parseFloat($('#wg_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2842 wg_magnesium: parseFloat($('#wg_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2843 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
2844 wg_ph: parseFloat($('#wg_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2845 wb_calcium: parseFloat($('#wb_calcium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2846 wb_sulfate: parseFloat($('#wb_sulfate').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2847 wb_chloride: parseFloat($('#wb_chloride').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2848 wb_sodium: parseFloat($('#wb_sodium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2849 wb_magnesium: parseFloat($('#wb_magnesium').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2850 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
2851 wb_ph: parseFloat($('#wb_ph').jqxNumberInput('decimal')),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2852 wa_acid_name: $('#wa_acid_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2853 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
2854 wa_base_name: $('#wa_base_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2855 fermentables: $('#fermentableGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2856 hops: $('#hopGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2857 miscs: $('#miscGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2858 yeasts: $('#yeastGrid').jqxGrid('getrows'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2859 mashs: $('#mashGrid').jqxGrid('getrows')
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2860 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2861 data = 'update=true&' + $.param(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2862 $.ajax({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2863 dataType: 'json',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2864 url: url,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2865 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2866 async: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2867 data: data,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2868 type: 'POST',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2869 success: function(data, status, xhr) {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2870 console.log('saveRecord(' + goback + ') success');
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2871 if (goback)
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2872 window.location.href = my_return;
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2873 else
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2874 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
2875 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2876 error: function(jqXHR, textStatus, errorThrown) {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
2877 console.log('saveRecord() ' + textStatus);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2878 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2879 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2880 };
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2881
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2882 dataAdapter.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2883
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2884 // initialize the input fields.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2885 // Tab 1, Algemeen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2886 $('#name').jqxTooltip({ content: 'De naam voor dit recept.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2887 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2888 $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2889 $('#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
2890 $('#notes').jqxInput({ theme: theme, width: 960, height: 200 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2891 $('#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
2892 $('#type').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2893 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2894 source: RecipeTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2895 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2896 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2897 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2898 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2899 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2900 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2901 $('#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
2902 $('#efficiency').jqxNumberInput(Perc1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2903 $('#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
2904 $('#batch_size').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2905 $('#batch_size').jqxNumberInput({ min: 4 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2906 $('#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
2907 $('#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
2908 $('#boil_time').jqxTooltip({ content: 'De kooktijd in minuten.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2909 $('#boil_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2910 $('#boil_time').jqxNumberInput({ min: 4, max: 360 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2911
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2912 $('#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
2913 $('#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
2914 $('#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
2915 $('#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
2916 $('#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
2917 $('#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
2918 $('#st_category').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2919 $('#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
2920 $('#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
2921 $('#st_category_number').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2922 $('#st_type').jqxTooltip({ content: 'Het bierstijl type.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2923 $('#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
2924
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2925 $('#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
2926 $('#est_og').jqxNumberInput(SGopts);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2927 $('#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
2928 $('#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
2929 $('#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
2930 $('#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
2931
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2932 $('#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
2933 $('#est_fg').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2934 $('#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
2935 $('#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
2936 $('#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
2937 $('#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
2938
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2939 $('#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
2940 $('#est_abv').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2941 $('#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
2942 $('#st_abv_min').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2943 $('#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
2944 $('#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
2945
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2946 $('#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
2947 $('#est_color').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2948 $('#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
2949 $('#st_color_min').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2950 $('#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
2951 $('#st_color_max').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2952 $('#color_method').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2953 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2954 source: ColorMethodAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2955 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2956 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2957 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2958 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2959 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2960 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2961 $('#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
2962 $('#est_ibu').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2963 $('#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
2964 $('#st_ibu_min').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2965 $('#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
2966 $('#st_ibu_max').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2967 $('#ibu_method').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2968 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2969 source: IBUmethodAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2970 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2971 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2972 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2973 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2974 autoDropDownHeight: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2975 dropDownVerticalAlignment: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2976 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2977 $('#kcal').jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2978 $('#kcal').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2979 $('#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
2980 $('#est_carb').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2981 $('#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
2982 $('#st_carb_min').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2983 $('#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
2984 $('#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
2985
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2986 // Tab 2, Vergistbaar
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2987 $('#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
2988 $('#est_color2').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2989 $('#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
2990 $('#est_og2').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2991 $('#perc_malts').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2992 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2993 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2994 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2995 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2996 max: 120,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2997 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2998 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2999 { stop: 90, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3000 { stop: 100, color: '#EB7331' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3001 { stop: 120, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3002 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3003 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3004 return (Math.round(parseInt(text) * 1.2)) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3005 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3006 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3007 $('#perc_sugars').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3008 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3009 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3010 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3011 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3012 max: 50,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3013 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3014 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3015 { stop: 20, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3016 { stop: 50, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3017 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3018 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3019 return (Math.round(parseInt(text) * 5) / 10) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3020 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3021 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3022 $('#perc_cara').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3023 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3024 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3025 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3026 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3027 max: 50,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3028 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3029 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3030 { stop: 25, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3031 { stop: 50, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3032 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3033 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3034 return (Math.round(parseInt(text) * 5) / 10) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3035 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3036 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3037 $('#ferm_lintner').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3038 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3039 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3040 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3041 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3042 max: 200,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3043 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3044 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3045 { stop: 30, color: '#FF0000' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3046 { stop: 40, color: '#EB7331' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3047 { stop: 200, color: '#008C00' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3048 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3049 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3050 return (parseInt(text) * 2) + ' lintner';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3051 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3052 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3053 $('#popupFermentable').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3054 width: 800,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3055 height: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3056 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3057 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3058 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3059 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3060 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3061 cancelButton: $('#FermentableReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3062 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3063 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3064 $('#FermentableReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3065 $('#FermentableReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3066 var row, rowID = $('#fermentableGrid').jqxGrid('getrowid', fermentableRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3067 console.log('FermentableReady row:' + fermentableRow + ' ID:' + rowID);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3068 row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3069 f_name: fermentableData.f_name,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3070 f_origin: fermentableData.f_origin,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3071 f_supplier: fermentableData.f_supplier,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3072 f_amount: fermentableData.f_amount,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3073 f_cost: fermentableData.f_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3074 f_type: fermentableData.f_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3075 f_yield: fermentableData.f_yield,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3076 f_color: fermentableData.f_color,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3077 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
3078 f_moisture: fermentableData.f_moisture,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3079 f_diastatic_power: fermentableData.f_diastatic_power,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3080 f_protein: fermentableData.f_protein,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3081 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
3082 f_graintype: fermentableData.f_graintype,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3083 f_added: fermentableData.f_added,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3084 f_dissolved_protein: fermentableData.f_dissolved_protein,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3085 f_recommend_mash: fermentableData.f_recommend_mash,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3086 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
3087 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
3088 f_percentage: fermentableData.f_percentage,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3089 f_di_ph: fermentableData.f_di_ph,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3090 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
3091 f_inventory: fermentableData.f_inventory,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3092 f_avail: fermentableData.f_avail
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3093 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3094 $('#fermentableGrid').jqxGrid('updaterow', rowID, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3095 calcPercentages();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3096 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3097 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3098 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3099 // Waters: yes there is impact.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3100 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3101 $('#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
3102 $('#wf_instock').jqxCheckBox({ theme: theme, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3103 $('#wf_instock').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3104 fermentableinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3105 fermentablelist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3106 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3107 $('#wf_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3108 placeHolder: 'Kies mout:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3109 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3110 source: fermentablelist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3111 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3112 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3113 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3114 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3115 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3116 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3117 var datarecord = fermentablelist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3118 return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC)';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3119 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3120 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3121 $('#wf_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3122 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3123 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3124 datarecord = fermentablelist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3125 $('#wf_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3126 fermentableData.f_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3127 fermentableData.f_origin = datarecord.origin;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3128 fermentableData.f_supplier = datarecord.supplier;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3129 fermentableData.f_type = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3130 fermentableData.f_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3131 fermentableData.f_yield = datarecord.yield;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3132 fermentableData.f_color = datarecord.color;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3133 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
3134 fermentableData.f_moisture = datarecord.moisture;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3135 fermentableData.f_diastatic_power = datarecord.diastatic_power;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3136 fermentableData.f_protein = datarecord.protein;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3137 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
3138 fermentableData.f_graintype = datarecord.graintype;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3139 fermentableData.f_dissolved_protein = datarecord.dissolved_protein;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3140 fermentableData.f_recommend_mash = datarecord.recommend_mash;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3141 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
3142 fermentableData.f_di_ph = datarecord.di_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3143 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
3144 fermentableData.f_inventory = datarecord.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3145 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3146 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3147 $('#wf_amount').jqxNumberInput(Spin3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3148 $('#wf_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3149 console.log('amount changed: ' + event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3150 $('#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
3151 fermentableData.f_amount = event.args.value;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3152 if (! to_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3153 calcPercentages();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3154 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3155 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3156 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3157 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3158 $('#wf_percentage').jqxNumberInput(Perc1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3159 $('#wf_percentage').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3160 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
3161 oldvalue = Round(fermentableData.f_percentage, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3162 newvalue = event.args.value;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3163 console.log('percentage changed: ' + newvalue + ' old: ' + oldvalue);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3164 fermentableData.f_percent = newvalue;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3165 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3166 if ((oldvalue != newvalue) && (rowscount > 1)) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3167 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3168 if (rowdata.f_adjust_to_total_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3169 $('#wf_percentage').val(oldvalue);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3170 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3171 diff = newvalue - oldvalue;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3172 tw = 0; // total weight
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3173 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3174 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3175 if (rowdata.f_added < 4)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3176 tw += Round(rowdata.f_amount, 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3177 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3178 tw = Round(tw, 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3179 if (to_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3180 // Adjust this row and the 100% row.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3181 damount = Math.round(tw * diff * 10) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3182 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3183 namount = Round((rowdata.f_amount + damount), 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3184 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', namount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3185 $('#wf_amount').val(namount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3186 $('#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
3187 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3188 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3189 if (rowdata.f_adjust_to_total_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3190 namount = rowdata.f_amount - damount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3191 $('#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
3192 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3193 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3194 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3195 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3196 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3197 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3198 // Adjust all the rows.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3199 nw = tw * diff / 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3200 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3201 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3202 if (rowdata.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3203 if (i == fermentableRow) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3204 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
3205 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3206 // $('#wf_amount').val(namount); // Will crash the script.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3207 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newvalue);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3208 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3209 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
3210 newperc = Round((namount / tw) * 100, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3211 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3212 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newperc);
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 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3215 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3216 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3217 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3218 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3219 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3220 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3221 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3222 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3223 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3224 $('#wf_max_in_batch').jqxNumberInput(Show1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3225 $('#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
3226 $('#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
3227 if (fermentableData.f_adjust_to_total_100 == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3228 if (to_100) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3229 // Reset other flag first.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3230 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3231 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3232 if (i != fermentableRow) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3233 $('#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
3234 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3235 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3236 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3237 $('#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
3238 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3239 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3240 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3241 $('#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
3242 if (fermentableData.f_adjust_to_total_100 != 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3243 $('#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
3244 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3245 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3246 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3247 $('#wf_added').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3248 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3249 source: AddedAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3250 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3251 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3252 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3253 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3254 autoDropDownHeight: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3255 dropDownVerticalAlignment: 'top'
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 $('#wf_added').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3258 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3259 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3260 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_added', index);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3261 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3262 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3263 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3264 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3265 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3266
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3267 // Tab 3, Hoppen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3268 $('#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
3269 $('#est_ibu2').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3270 $('#hop_flavour').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3271 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3272 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3273 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3274 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3275 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3276 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3277 { stop: 20, color: '#004D00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3278 { stop: 40, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3279 { stop: 60, color: '#00BF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3280 { stop: 80, color: '#00FF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3281 { stop: 100, color: '#80FF80' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3282 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3283 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3284 var val = parseInt(text);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3285 if (val < 20)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3286 return 'Weinig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3287 else if (val < 40)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3288 return 'Matig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3289 else if (val < 60)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3290 return 'Redelijk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3291 else if (val < 80)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3292 return 'Veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3293 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3294 return 'Zeer veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3295 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3296 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3297 $('#hop_aroma').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3298 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3299 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3300 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3301 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3302 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3303 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3304 { stop: 20, color: '#004D00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3305 { stop: 40, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3306 { stop: 60, color: '#00BF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3307 { stop: 80, color: '#00FF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3308 { stop: 100, color: '#80FF80' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3309 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3310 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3311 var val = parseInt(text);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3312 if (val < 20)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3313 return 'Weinig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3314 else if (val < 40)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3315 return 'Matig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3316 else if (val < 60)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3317 return 'Redelijk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3318 else if (val < 80)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3319 return 'Veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3320 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3321 return 'Zeer veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3322 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3323 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3324 $('#popupHop').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3325 width: 800,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3326 height: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3327 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3328 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3329 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3330 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3331 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3332 cancelButton: $('#HopReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3333 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3334 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3335 $('#HopReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3336 $('#HopReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3337 var row, rowID = $('#hopGrid').jqxGrid('getrowid', hopRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3338 console.log('HopReady row:' + hopRow + ' ID:' + rowID);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3339 row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3340 h_name: $('#wh_name').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3341 h_origin: hopData.h_origin,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3342 h_amount: parseFloat($('#wh_amount').jqxNumberInput('decimal')) / 1000,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3343 h_cost: hopData.h_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3344 h_type: hopData.h_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3345 h_form: hopData.h_form,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3346 h_useat: $('#wh_useat').val(),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3347 h_time: hopData.h_time,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3348 h_alpha: hopData.h_alpha,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3349 h_beta: hopData.h_beta,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3350 h_hsi: hopData.h_hsi,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3351 h_humulene: hopData.h_humulene,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3352 h_caryophyllene: hopData.h_caryophyllene,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3353 h_cohumulone: hopData.h_cohumulone,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3354 h_myrcene: hopData.h_myrcene,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3355 h_total_oil: hopData.h_total_oil,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3356 h_inventory: hopData.h_inventory,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3357 h_avail: hopData.h_avail
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3358 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3359 $('#hopGrid').jqxGrid('updaterow', rowID, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3360 calcIBUs();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3361 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3362 $('#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
3363 $('#wh_instock').jqxCheckBox({ theme: theme, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3364 $('#wh_instock').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3365 hopinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3366 hoplist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3367 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3368 $('#wh_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3369 placeHolder: 'Kies hop:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3370 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3371 source: hoplist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3372 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3373 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3374 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3375 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3376 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3377 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3378 var datarecord = hoplist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3379 return datarecord.origin + ' / ' + datarecord.name + ' (' + datarecord.alpha + ' % &alpha;)';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3380 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3381 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3382 $('#wh_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3383 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3384 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3385 datarecord = hoplist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3386 $('#wh_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3387 hopData.h_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3388 hopData.h_origin = datarecord.origin;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3389 hopData.h_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3390 hopData.h_type = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3391 hopData.h_form = datarecord.form;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3392 hopData.h_alpha = datarecord.alpha;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3393 hopData.h_beta = datarecord.beta;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3394 hopData.h_hsi = datarecord.hsi;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3395 hopData.h_humulene = datarecord.humulene;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3396 hopData.h_caryophyllene = datarecord.caryophyllene;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3397 hopData.h_cohumulone = datarecord.cohumulone;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3398 hopData.h_myrcene = datarecord.myrcene;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3399 hopData.h_total_oil = datarecord.total_oil;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3400 hopData.h_inventory = datarecord.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3401 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3402 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3403 $('#wh_amount').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3404 $('#wh_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3405 var ibu, amount = parseFloat(event.args.value) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3406 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
3407 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
3408 hopData.h_amount = amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3409 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
3410 $('#wh_ibu').val(ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3411 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3412 $('#wh_ibu').jqxNumberInput(Show1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3413 $('#wh_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3414 $('#wh_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3415 var ibu, newtime = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3416 // Check limits and correct
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3417 if (hopData.h_useat == 2) { // Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3418 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3419 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3420 $('#wh_time').val(newtime);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3421 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3422 hopData.h_time = newtime;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3423 } else if (hopData.h_useat == 4) { // Whirlpool
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3424 if (newtime > 120) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3425 newtime = 120;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3426 $('#wh_time').val(newtime);
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 hopData.h_time = newtime;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3429 } else if (hopData.h_useat == 5) { // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3430 if (newtime > 21) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3431 newtime = 21;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3432 $('#wh_time').val(newtime);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3433 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3434 hopData.h_time = newtime * 1440;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3435 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3436 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
3437 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
3438 $('#wh_ibu').val(ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3439 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3440 $('#wh_useat').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3441 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3442 source: HopUseAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3443 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3444 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3445 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3446 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3447 autoDropDownHeight: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3448 dropDownVerticalAlignment: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3449 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3450 $('#wh_useat').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3451 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3452 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3453 hopData.h_useat = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3454 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
3455 hopData.h_time = parseFloat(dataRecord.boil_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3456 $('#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
3457 $('#wh_time').val(hopData.h_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3458 } else if (index == 3) { // Aroma
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3459 hopData.h_time = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3460 $('#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
3461 $('#wh_time').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3462 } else { // Boil, Whirlpool or Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3463 $('#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
3464 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3465 if (index == 5) // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3466 $('#wh_pmpt_time').html('Tijd in dagen');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3467 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3468 $('#wh_pmpt_time').html('Tijd in minuten');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3469 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3470 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3471
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3472 // Tab 4, Diversen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3473 $('#popupMisc').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3474 width: 800,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3475 height: 275,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3476 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3477 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3478 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3479 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3480 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3481 cancelButton: $('#MiscReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3482 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3483 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3484 $('#MiscReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3485 $('#MiscReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3486 var row, rowID = $('#miscGrid').jqxGrid('getrowid', miscRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3487 console.log('MiscReady row:' + miscRow + ' ID:' + rowID);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3488 row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3489 m_name: miscData.m_name,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3490 m_amount: miscData.m_amount,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3491 m_cost: miscData.m_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3492 m_type: miscData.m_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3493 m_use_use: miscData.m_use_use,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3494 m_time: miscData.m_time,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3495 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
3496 m_inventory: miscData.m_inventory,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3497 m_avail: miscData.m_avail
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 $('#miscGrid').jqxGrid('updaterow', rowID, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3500 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3501 $('#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
3502 $('#wm_instock').jqxCheckBox({ theme: theme, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3503 $('#wm_instock').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3504 miscinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3505 misclist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3506 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3507 $('#wm_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3508 placeHolder: 'Kies ingredi&euml;nt:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3509 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3510 source: misclist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3511 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3512 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3513 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3514 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3515 dropDownHeight: 500
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3516 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3517 $('#wm_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3518 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3519 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3520 datarecord = misclist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3521 $('#wm_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3522 miscData.m_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3523 miscData.m_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3524 miscData.m_type = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3525 miscData.m_use_use = datarecord.use_use;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3526 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
3527 miscData.m_inventory = datarecord.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3528 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3529 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3530 $('#wm_amount').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3531 $('#wm_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3532 console.log('amount changed: ' + event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3533 miscData.m_amount = parseFloat(event.args.value) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3534 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3535 $('#wm_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3536 $('#wm_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3537 console.log('time changed: ' + event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3538 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
3539
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3540 if (miscData.m_use_use == 2) { // Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3541 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3542 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal'));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3543 $('#wm_time').val(newtime);
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 miscData.m_time = newtime;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3546 } 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
3547 if (newtime > 21) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3548 newtime = 21;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3549 $('#wm_time').val(newtime);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3550 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3551 miscData.m_time = newtime * 1440;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3552 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3553 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3554 $('#wm_use_use').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3555 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3556 source: MiscUseAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3557 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3558 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3559 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3560 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3561 autoDropDownHeight: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3562 dropDownVerticalAlignment: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3563 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3564 $('#wm_use_use').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3565 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3566 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3567 miscData.m_use_use = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3568 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
3569 $('#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
3570 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3571 miscData.m_time = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3572 $('#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
3573 $('#wm_time').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3574 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3575 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3576 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3577
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3578 // Tab 5, Gist
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3579 $('#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
3580 $('#est_fg2').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3581 $('#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
3582 $('#est_abv2').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3583 $('#popupYeast').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3584 width: 800,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3585 height: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3586 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3587 resizable: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3588 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3589 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3590 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3591 cancelButton: $('#YeastReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3592 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3593 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3594 $('#YeastReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3595 $('#YeastReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3596 var row, rowID = $('#yeastGrid').jqxGrid('getrowid', yeastRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3597 console.log('YeastReady row:' + yeastRow + ' ID:' + rowID);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3598 row = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3599 y_name: yeastData.y_name,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3600 y_laboratory: yeastData.y_laboratory,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3601 y_product_id: yeastData.y_product_id,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3602 y_amount: yeastData.y_amount,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3603 y_cost: yeastData.y_cost,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3604 y_type: yeastData.y_type,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3605 y_form: yeastData.y_form,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3606 y_flocculation: yeastData.y_flocculation,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3607 y_min_temperature: yeastData.y_min_temperature,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3608 y_max_temperature: yeastData.y_max_temperature,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3609 y_attenuation: yeastData.y_attenuation,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3610 y_use: yeastData.y_use,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3611 y_cells: yeastData.y_cells,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3612 y_tolerance: yeastData.y_tolerance,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3613 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
3614 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
3615 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
3616 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
3617 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
3618 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
3619 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
3620 y_zymocide: yeastData.y_zymocide,
735
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
3621 y_gr_hl_lo: yeastData.y_gr_hl_lo,
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
3622 y_sg_lo: yeastData.y_sg_lo,
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
3623 y_gr_hl_hi: yeastData.y_gr_hl_hi,
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
3624 y_sg_hi: yeastData.y_sg_hi,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3625 y_avail: yeastData.y_avail
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3626 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3627 $('#yeastGrid').jqxGrid('updaterow', rowID, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3628 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3629 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3630 $('#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
3631 $('#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
3632 $('#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
3633 $('#wy_instock').jqxCheckBox({ theme: theme, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3634 $('#wy_instock').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3635 yeastinstock = event.args.checked;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3636 yeastlist.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3637 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3638 $('#wy_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3639 placeHolder: 'Kies gist:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3640 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3641 source: yeastlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3642 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3643 width: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3644 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3645 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3646 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3647 renderer: function(index, label, value) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3648 var datarecord = yeastlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3649 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3650 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3651 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3652 $('#wy_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3653 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3654 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3655 datarecord = yeastlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3656 $('#wy_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3657 $('#wy_laboratory').val(datarecord.laboratory);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3658 $('#wy_product_id').val(datarecord.product_id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3659 yeastData.y_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3660 yeastData.y_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3661 yeastData.y_type = datarecord.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3662 yeastData.y_form = datarecord.form;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3663 yeastData.y_laboratory = datarecord.laboratory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3664 yeastData.y_product_id = datarecord.product_id;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3665 yeastData.y_min_temperature = datarecord.min_temperature;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3666 yeastData.y_max_temperature = datarecord.max_temperature;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3667 yeastData.y_flocculation = datarecord.flocculation;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3668 yeastData.y_attenuation = datarecord.attenuation;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3669 yeastData.y_cells = datarecord.cells;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3670 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
3671 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
3672 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
3673 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
3674 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
3675 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
3676 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
3677 yeastData.y_zymocide = datarecord.zymocide;
735
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
3678 yeastData.y_gr_hl_lo = datarecord.gr_hl_lo;
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
3679 yeastData.y_sg_lo = datarecord.sg_lo;
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
3680 yeastData.y_gr_hl_hi = datarecord.gr_hl_hi;
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
3681 yeastData.y_sg_hi = datarecord.sg_hi;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3682 if (yeastData.y_form == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3683 $('#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
3684 } 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
3685 $('#wy_pmpt_amount').html('Gewicht gram:');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3686 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3687 $('#wy_pmpt_amount').html('Volume ml:');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3688 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3689 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3690 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3691 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3692 $('#wy_amount').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3693 $('#wy_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3694 console.log('amount changed: ' + event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3695 var amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3696 if (yeastData.y_form == 0) // Liquid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3697 amount = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3698 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3699 amount = parseFloat(event.args.value) / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3700 yeastData.y_amount = amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3701 calcFermentables();
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 $('#wy_use').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3704 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3705 source: YeastUseAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3706 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3707 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3708 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3709 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3710 autoDropDownHeight: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3711 dropDownVerticalAlignment: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3712 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3713 $('#wy_use').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3714 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3715 var index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3716 yeastData.y_use = index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3717 calcFermentabes();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3718 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3719 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3720
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3721 // Tab 6, Maischen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3722 $('#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
3723 $('#mash_select').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3724 placeHolder: 'Kies schema:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3725 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3726 source: mashlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3727 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3728 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3729 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3730 dropDownWidth: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3731 dropDownHeight: 500,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3732 dropDownHorizontalAlignment: 'right'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3733 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3734 $('#mash_select').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3735 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
3736 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
3737 // First delete all current steps
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3738 rowIDs = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3739 rows = $('#mashGrid').jqxGrid('getdisplayrows');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3740 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3741 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3742 rowIDs.push(row.uid);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3743 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3744 $('#mashGrid').jqxGrid('deleterow', rowIDs);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3745 // Then add the new steps
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3746 datarecord = mashlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3747 $('#mash_name').val(datarecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3748 for (i = 0; i < datarecord.steps.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3749 data = datarecord.steps[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3750 row = {};
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3751 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
3752 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
3753 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
3754 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
3755 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
3756 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
3757 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
3758 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
3759 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
3760 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
3761 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
3762 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
3763 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
3764 } 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
3765 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
3766 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3767 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3768 //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
3769 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
3770 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
3771 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
3772 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
3773 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
3774 row['step_wg_ratio'] = 0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3775 $('#mashGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3776 }
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
3777 calcMash();
474
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 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3780 $('#popupMash').jqxWindow({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3781 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
3782 height: 375,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3783 position: { x: 230, y: 100 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3784 resizable: false,
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 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3787 autoOpen: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3788 cancelButton: $('#MashReady'),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3789 modalOpacity: 0.40
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3790 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3791 $('#MashReady').jqxButton({ template: 'success', width: '90px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3792 $('#MashReady').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3793 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3794 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3795 $('#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
3796 $('#wstep_name').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3797 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
3798 rowdata.step_name = $('#wstep_name').val();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3799 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3800 $('#wstep_type').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3801 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3802 source: MashStepTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3803 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3804 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3805 width: 180,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3806 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3807 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3808 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3809 $('#wstep_type').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3810 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3811 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
3812 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
3813 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
3814 rowdata.step_type = index;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3815 $('#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
3816 $('#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
3817 $('#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
3818 $('#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
3819 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
3820 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
3821 $('#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
3822 $('#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
3823 } 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
3824 $('#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
3825 $('#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
3826 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 (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
3829 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
3830 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
3831 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
3832 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3833 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
3834 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
3835 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
3836 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
3837 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
3838 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 $('#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
3840 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
3841 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
3842 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
3843 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
3844 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
3845 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
3846 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 calcMash();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3848 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3849 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3850 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3851 $('#wstep_temp').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3852 $('#wstep_temp').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3853 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
3854 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
3855 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
3856 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
3857 (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
3858 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
3859 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
3860 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
3861 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
3862 } 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
3863 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
3864 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
3865 } 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
3866 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
3867 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3868 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3869 $('#wend_temp').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3870 $('#wend_temp').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3871 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3872 rowdata.end_temp = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3873 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3874 $('#wstep_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3875 $('#wstep_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3876 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3877 rowdata.step_time = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3878 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3879 $('#wramp_time').jqxNumberInput(PosInt);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3880 $('#wramp_time').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3881 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3882 rowdata.ramp_time = parseFloat(event.args.value);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3883 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3884 $('#wstep_infuse_amount').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3885 $('#wstep_infuse_amount').on('change', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3886 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
3887 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
3888 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
3889 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
3890 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
3891 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
3892 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
3893 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
3894 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
3895 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
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 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
3898 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
3899 $('#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
3900 } 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
3901 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
3902 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
3903 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
3904 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
3905 $('#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
3906 $('#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
3907 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3908 $('#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
3909 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
3910 calcWater();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3911 }
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
3912 });
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
3913 $('#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
3914 $('#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
3915 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
3916 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
3917 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
3918 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
3919 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
3920 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
3921 $('#wstep_infuse_amount').val(vol);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3922 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
3923
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3924 // Tab 7, Water
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3925 $('#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
3926 $('#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
3927
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3928 // Water source 1
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3929 $('#w1_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3930 placeHolder: 'Kies hoofd water:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3931 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3932 source: waterlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3933 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3934 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3935 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3936 dropDownWidth: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3937 dropDownHeight: 400
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3938 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3939 $('#w1_name').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3940 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3941 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3942 datarecord = waterlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3943 dataRecord.w1_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3944 $('#w1_calcium').val(datarecord.calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3945 dataRecord.w1_calcium = datarecord.calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3946 $('#w1_sulfate').val(datarecord.sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3947 dataRecord.w1_sulfate = datarecord.sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3948 $('#w1_chloride').val(datarecord.chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3949 dataRecord.w1_chloride = datarecord.chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3950 $('#w1_sodium').val(datarecord.sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3951 dataRecord.w1_sodium = datarecord.sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3952 $('#w1_magnesium').val(datarecord.magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3953 dataRecord.w1_magnesium = datarecord.magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3954 $('#w1_total_alkalinity').val(datarecord.total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3955 dataRecord.w1_total_alkalinity = datarecord.total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3956 $('#w1_ph').val(datarecord.ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3957 dataRecord.w1_ph = datarecord.ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3958 $('#w1_cost').val(datarecord.cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3959 dataRecord.w1_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3960 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3961 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3962 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3963 $('#w1_amount').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3964 $('#w1_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3965 $('#w1_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3966 $('#w1_sodium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3967 $('#w1_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3968 $('#w1_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3969 $('#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
3970 $('#w1_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3971 // Water source 2
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3972 $('#w2_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3973 placeHolder: 'Kies meng water:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3974 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3975 source: waterlist,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3976 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3977 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3978 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3979 dropDownWidth: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3980 dropDownHeight: 400
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3981 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3982 $('#w2_name').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3983 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3984 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3985 datarecord = waterlist.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3986 dataRecord.w2_name = datarecord.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3987 $('#w2_calcium').val(datarecord.calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3988 dataRecord.w2_calcium = datarecord.calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3989 $('#w2_sulfate').val(datarecord.sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3990 dataRecord.w2_sulfate = datarecord.sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3991 $('#w2_chloride').val(datarecord.chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3992 dataRecord.w2_chloride = datarecord.chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3993 $('#w2_sodium').val(datarecord.sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3994 dataRecord.w2_sodium = datarecord.sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3995 $('#w2_magnesium').val(datarecord.magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3996 dataRecord.w2_magnesium = datarecord.magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3997 $('#w2_total_alkalinity').val(datarecord.total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3998 dataRecord.w2_total_alkalinity = datarecord.total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
3999 $('#w2_ph').val(datarecord.ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4000 dataRecord.w2_ph = datarecord.ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4001 $('#w2_cost').val(datarecord.cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4002 dataRecord.w2_cost = datarecord.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4003 $('#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
4004 calcWater();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4005 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4006 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4007 $('#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
4008 $('#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
4009 $('#w2_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4010 $('#w2_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4011 $('#w2_sodium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4012 $('#w2_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4013 $('#w2_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4014 $('#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
4015 $('#w2_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4016 // Water mixed
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4017 $('#wg_amount').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4018 $('#wg_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4019 $('#wg_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4020 $('#wg_sodium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4021 $('#wg_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4022 $('#wg_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4023 $('#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
4024 $('#wg_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4025 // Water treated
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4026 $('#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
4027 $('#wb_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4028 $('#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
4029 $('#wb_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4030 $('#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
4031 $('#wb_sodium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4032 $('#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
4033 $('#wb_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4034 $('#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
4035 $('#wb_sulfate').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4036 $('#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
4037 $('#wb_ph').jqxNumberInput(Show2wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4038 // Water target profile
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4039 $('#pr_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4040 placeHolder: 'Kies doel profiel:',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4041 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4042 source: waterprofiles,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4043 displayMember: 'name',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4044 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4045 height: 27,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4046 dropDownWidth: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4047 dropDownHeight: 300
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4048 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4049 $('#pr_name').on('select', function(event) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4050 if (event.args) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4051 var datarecord, index = event.args.index;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4052 datarecord = waterprofiles.records[index];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4053 $('#pr_calcium').val(datarecord.calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4054 $('#pr_sulfate').val(datarecord.sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4055 $('#pr_chloride').val(datarecord.chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4056 $('#pr_sodium').val(datarecord.sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4057 $('#pr_magnesium').val(datarecord.magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4058 $('#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
4059 calcWater();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4060 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4061 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4062 $('#pr_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4063 $('#pr_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4064 $('#pr_sodium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4065 $('#pr_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4066 $('#pr_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4067 $('#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
4068
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4069 // Water agents
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4070 $('#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
4071 $('#wa_cacl2').jqxNumberInput(Spin1dec);
524
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
4072 $('#wa_caso4').jqxTooltip({
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
4073 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
4074 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4075 $('#wa_caso4').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4076 $('#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
4077 $('#wa_mgso4').jqxNumberInput(Spin1dec);
524
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
4078 $('#wa_nacl').jqxTooltip({
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
4079 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
4080 '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
4081 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4082 $('#wa_nacl').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4083 $('#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
4084 $('#mash_ph').jqxNumberInput(SpinpH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4085 $('#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
4086 $('#wa_base_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4087 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4088 source: BaseTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4089 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4090 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4091 width: 170,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4092 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4093 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4094 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4095 $('#wa_base').jqxNumberInput(Spin2dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4096 $('#wa_base').jqxNumberInput({ symbol: ' gr', symbolPosition: 'right' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4097 $('#wa_acid_name').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4098 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4099 source: AcidTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4100 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4101 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4102 width: 170,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4103 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4104 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4105 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4106 $('#wa_acid').jqxNumberInput(Spin2dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4107 $('#wa_acid').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4108 $('#wa_acid_perc').jqxNumberInput(Perc0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4109 $('#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
4110 // Sparge water
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4111 $('#sparge_temp').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4112 $('#sparge_volume').jqxNumberInput(Spin1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4113 $('#sparge_ph').jqxNumberInput(SpinpH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4114 $('#sparge_source').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4115 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4116 source: SpargeSourceAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4117 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4118 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4119 width: 110,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4120 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4121 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4122 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4123 $('#sparge_acid_amount').jqxNumberInput(Spin2dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4124 $('#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
4125 $('#sparge_acid_type').jqxDropDownList({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4126 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4127 source: AcidTypeAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4128 valueMember: 'id',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4129 displayMember: 'nl',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4130 width: 110,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4131 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4132 autoDropDownHeight: true
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4133 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4134 $('#sparge_acid_perc').jqxNumberInput(Perc0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4135 $('#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
4136
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4137 // Tabs inside the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4138 $('#jqxTabs').jqxTabs({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4139 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4140 width: 1280,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4141 height: 660,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4142 autoHeight: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4143 position: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4144 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4145
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4146 // Buttons below
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4147 $('#Export').jqxButton({ template: 'info', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4148 $('#Export').bind('click', function() {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
4149 saveRecord(0);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4150 });
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
4151
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4152 $('#Delete').jqxButton({ template: 'danger', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4153 $('#Delete').bind('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4154 // Open a popup to confirm this action.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4155 $('#eventWindow').jqxWindow('open');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4156 $('#delOk').click(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4157 var data = 'delete=true&' + $.param({ record: my_record });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4158 $.ajax({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4159 dataType: 'json',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4160 url: url,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4161 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4162 data: data,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4163 type: 'POST',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4164 success: function(data, status, xhr) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4165 // delete command is executed.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4166 window.location.href = my_return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4167 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4168 error: function(jqXHR, textStatus, errorThrown) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4169 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4170 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4171 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4172 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4173
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4174 $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4175 $('#Cancel').bind('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4176 window.location.href = my_return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4177 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4178
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4179 $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4180 $('#Save').bind('click', function() {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
4181 saveRecord(1);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4182 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
4183 createDelElements();
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4184 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4185

mercurial